File: reg_intervals.Rd

package info (click to toggle)
r-cran-rsample 1.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,932 kB
  • sloc: sh: 13; makefile: 2
file content (72 lines) | stat: -rw-r--r-- 2,265 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/reg_intervals.R
\name{reg_intervals}
\alias{reg_intervals}
\title{A convenience function for confidence intervals with linear-ish parametric models}
\usage{
reg_intervals(
  formula,
  data,
  model_fn = "lm",
  type = "student-t",
  times = NULL,
  alpha = 0.05,
  filter = term != "(Intercept)",
  keep_reps = FALSE,
  ...
)
}
\arguments{
\item{formula}{An R model formula with one outcome and at least one predictor.}

\item{data}{A data frame.}

\item{model_fn}{The model to fit. Allowable values are "lm", "glm",
"survreg", and "coxph". The latter two require that the \code{survival} package
be installed.}

\item{type}{The type of bootstrap confidence interval. Values of "student-t" and
"percentile" are allowed.}

\item{times}{A single integer for the number of bootstrap samples. If left
NULL, 1,001 are used for t-intervals and 2,001 for percentile intervals.}

\item{alpha}{Level of significance.}

\item{filter}{A logical expression used to remove rows from the final result, or \code{NULL} to keep all rows.}

\item{keep_reps}{Should the individual parameter estimates for each bootstrap
sample be retained?}

\item{...}{Options to pass to the model function (such as \code{family} for \code{glm()}).}
}
\value{
A tibble with columns "term", ".lower", ".estimate", ".upper",
".alpha", and ".method". If \code{keep_reps = TRUE}, an additional list column
called ".replicates" is also returned.
}
\description{
A convenience function for confidence intervals with linear-ish parametric models
}
\examples{
\dontshow{if (rlang::is_installed("broom")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
\donttest{
set.seed(1)
reg_intervals(mpg ~ I(1 / sqrt(disp)), data = mtcars)

set.seed(1)
reg_intervals(mpg ~ I(1 / sqrt(disp)), data = mtcars, keep_reps = TRUE)
}
\dontshow{\}) # examplesIf}
}
\references{
Davison, A., & Hinkley, D. (1997). \emph{Bootstrap Methods and their
Application}. Cambridge: Cambridge University Press.
doi:10.1017/CBO9780511802843

\emph{Bootstrap Confidence Intervals},
\url{https://rsample.tidymodels.org/articles/Applications/Intervals.html}
}
\seealso{
\code{\link[=int_pctl]{int_pctl()}}, \code{\link[=int_t]{int_t()}}
}