Description Usage Arguments Details Value References Examples
Methods for confint
to compute confidence intervals
on numerical vectors and numerical components of data frames.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  ## S3 method for class 'numeric'
confint(object, parm, level = 0.95, ...,
method = "percentile", margin.of.error = "stderr" %in% method ==
"stderr")
## S3 method for class 'do.tbl_df'
confint(object, parm, level = 0.95, ...,
method = "percentile", margin.of.error = "stderr" %in% method,
df = NULL)
## S3 method for class 'do.data.frame'
confint(object, parm, level = 0.95, ...,
method = "percentile", margin.of.error = "stderr" %in% method,
df = NULL)
## S3 method for class 'data.frame'
confint(object, parm, level = 0.95, ...)
## S3 method for class 'summary.lm'
confint(object, parm, level = 0.95, ...)

object 
and R object 
parm 
a vector of parameters 
level 
a confidence level 
... 
additional arguments 
method 
a character vector of methods to use for creating confidence intervals. Choices are "percentile" (or "quantile") which is the default, "stderr" (or "se"), "bootstrapt", and "reverse" (or "basic")) 
margin.of.error 
if true, report intervals as a center and margin of error. 
df 
degrees for freedom. This is required when 
The methods of producing confidence intervals from bootstrap distributions are currently quite naive. In particular, when using the standard error, assistance may be required with the degrees of freedom, and it may not be possible to provide a correct value in all situations. None of the methods include explicit bias correction. Let q_a be the a quantile of the bootstrap distribution, let t_a, df be the a quantile of the t distribution with df degrees of freedom, let SE_b be the standard deviation of the bootstrap distribution, and let \hat{θ} be the estimate computed from the original data. Then the confidence intervals with confidence level 1  2a are
(q_a, q_{1a})
( 2 \hat{θ}  q_{1a}, 2\hat{θ}  q_{a} )
(\hat{θ}  t_{1a,df} SE_b, \hat{θ} + t_{1a,df} SE_b) .
When df
is not provided,
at attempt is made to determine an appropriate value, but this should be double checked.
In particular, missing data an lead to unreliable results.
The bootstrapt confidence interval is computed much like the reverse confidence interval but the bootstrap t distribution is used in place of a theoretical t distribution. This interval has much better properties than the reverse (or basic) method, which is here for comparison purposes only and is not recommended.
When applied to a data frame, returns a data frame giving the
confidence interval for each variable in the data frame using
t.test
or binom.test
, unless the data frame was produced using do
, in which case
it is assumed that each variable contains resampled statistics that serve as an estimated sampling
distribution from which a confidence interval can be computed using either a central proportion
of this distribution or using the standard error as estimated by the standard deviation of the
estimated sampling distribution. For the standard error method, the user must supply the correct
degrees of freedom for the t distribution since this information is typically not available in
the output of do()
.
When applied to a numerical vector, returns a vector.
Tim C. Hesterberg (2015): What Teachers Should Know about the Bootstrap: Resampling in the Undergraduate Statistics Curriculum, The American Statistician, http://dx.doi.org/10.1080/00031305.2015.1089789.
1 2 3 4 5 6 7 8 9 10 11 12 13 14  if (require(mosaicData)) {
bootstrap < do(500) * diffmean( age ~ sex, data=resample(HELPrct) )
confint(bootstrap)
confint(bootstrap, method = "percentile")
confint(bootstrap, method = "boot")
confint(bootstrap, method = "se", df=nrow(HELPrct)  1)
confint(bootstrap, margin.of.error = FALSE)
confint(bootstrap, margin.of.error = TRUE, level=0.99, method=c("boot", "se", "perc") )
bootstrap2 < do(500)*mean( resample(1:10) )
confint(bootstrap2)
}
lm(width ~ length * sex, data = KidsFeet) %>%
summary() %>%
confint()

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.