bootstrap
object.
bootstrapT(data, statistic = <<see below>>, ..., probs=c(25, 50, 950, 975)/1000, pivot=resampPivotT) bootstrapT(bootstrap object, probs=c(25, 50, 950, 975)/1000, pivot=resampPivotT)
Or, this may be a
"bootstrap"
object.
bootstrap
.
pivot
which calculates a pivotal statistic, and
inverse
which solves for the value of the statistic for a given
quantile of the pivotal distribution. See
for details and specifications. The default gives bootstrap-T intervals,
provided the statistic has alternating estimates and standard errors.
The method for data calls
bootstrap
,
which creates or updates the value of the dataset
.Random.seed
.
If you call
bootstrapT
with ordinary data, by default this
function calculates bootstrap-t confidence limits for the mean
(of each column of the data separately).
Steps in this process are
(1) calculate the means and standard deviations for each column,
for the original data and bootstrap samples,
(2) calculate the pivotal statistic for each bootstrap sample,
e.g.
(bootstrap means - means of original data)/(bootstrap stdevs),
(3) calculate quantiles of the bootstrap distribution of the pivotal
statistic
(4) invert those quantiles to obtain confidence limits.
Step (1) is performed by calling
bootstrap
, with a default
statistic that
calculates means and standard deviations.
When
data
has
p
columns, the means are returned in positions
1,3,...,(2p-1)
and standard deviations in positions
2,4,...,2p
.
You may perform bootstrap-t intervals for statistics other than the mean, by supplying your own statistic, that returns estimates and standard errors in odd and even positions, respectively.
If you supply a
bootstrap
object as input (using the
data
argument), step (1) is skipped.
Step (2-4) are calculated within
bootstrapT.bootstrap
.
The default pivotal statistic
computes
(bootstrap estimates - observed estimates) / standardErrors
Other pivotal quantities are appropriate in some situations.
For example, for confidence intervals for a population variance
(or standard deviation) try
which calculates the ratio
bootstrap variances/observed variance
. This does not require
standard errors.
Similarly,
gives bootstrap "reflection" intervals
(these are known by various names); see example below.
The default statistic returns means and standard deviations;
the latter differ from standard errors by a factor of
sqrt(n)
.
This difference cancels out when the distribution of the pivotal
statistic is inverted. In other words, confidence limits are not affected
by scaling factors on "standard errors".
Efron, B. and Tibshirani, R.J. (1993), An Introduction to the Bootstrap, San Francisco: Chapman & Hall.
x <- cbind(a=runif(30), b=runif(30)) bootstrapT(x, seed=1) # set seed for comparison below # Save bootstrap results, then call bootstrapT: bfit <- bootstrap(x, rbind(mean=colMeans(x), stdev=colStdevs(x)), seed=1) bootstrapT(bfit) # same as previous # Bootstrap-ratio confidence interval for standard deviations bootstrapT(bfit, pivot=resampPivotRatio) # (Ignore the "mean" rows, look only at the "stdev" rows.) # Bootstrap "reflection" interval bootstrapT(bfit, pivot=resampPivotDiff) # Those are equivalent to reflecting bootstrap quantiles about the observed bfit$observed - (limits.percentile(bfit)-bfit$observed)[,4:1] # Bootstrap T for linear regression coefficients fit <- lm(Fuel ~ Weight + Disp. + Mileage , fuel.frame) summary(fit)$coef # first two columns are estimates and std errs # Use transpose to put estimates in positions 1,3,5,7 boot <- bootstrap(fit, t(summary(fit)$coef[,1:2])) boot bootstrapT(boot)