Description Usage Arguments Details Value References See Also Examples
This function generates 5 different types of equitailed twosided nonparametric confidence intervals. These are the first order normal approximation, the basic bootstrap interval, the studentized bootstrap interval, the bootstrap percentile interval, and the adjusted bootstrap percentile (BCa) interval. All or a subset of these intervals can be generated.
1 2 3 4 5 
boot.out 
An object of class 
conf 
A scalar or vector containing the confidence level(s) of the required interval(s). 
type 
A vector of character strings representing the type of intervals
required. The value should be any subset of the values

index 
This should be a vector of length 1 or 2. The first element of

var.t0 
If supplied, a value to be used as an estimate of the variance of
the statistic for the normal approximation and studentized intervals.
If it is not supplied and 
var.t 
This is a vector (of length 
t0 
The observed value of the statistic of interest. The default value
is 
t 
The bootstrap replicates of the statistic of interest. It must be a
vector of length 
L 
The empirical influence values of the statistic of interest for the
observed data. These are used only for BCa intervals. If a
transformation is supplied through the parameter 
h 
A function defining a transformation. The intervals are calculated
on the scale of 
hdot 
A function of one argument returning the derivative of 
hinv 
A function, like 
... 
Any extra arguments that 
The formulae on which the calculations are based can be found in
Chapter 5 of Davison and Hinkley (1997). Function boot
must be
run prior to running this function to create the object to be passed as
boot.out
.
Variance estimates are required for studentized intervals. The variance of the observed statistic is optional for normal theory intervals. If it is not supplied then the bootstrap estimate of variance is used. The normal intervals also use the bootstrap bias correction.
Interpolation on the normal quantile scale is used when a noninteger order statistic is required. If the order statistic used is the smallest or largest of the R values in boot.out a warning is generated and such intervals should not be considered reliable.
An object of type "bootci"
which contains the intervals.
It has components
R 
The number of bootstrap replicates on which the intervals were based. 
t0 
The observed value of the statistic on the same scale as the intervals. 
call 
The call to It will also contain one or more of the following components depending
on the value of 
normal 
A matrix of intervals calculated using the normal approximation. It will have 3 columns, the first being the level and the other two being the upper and lower endpoints of the intervals. 
basic 
The intervals calculated using the basic bootstrap method. 
student 
The intervals calculated using the studentized bootstrap method. 
percent 
The intervals calculated using the bootstrap percentile method. 
bca 
The intervals calculated using the adjusted bootstrap percentile (BCa) method. These latter four components will be matrices with 5 columns, the first column containing the level, the next two containing the indices of the order statistics used in the calculations and the final two the calculated endpoints themselves. 
Davison, A.C. and Hinkley, D.V. (1997) Bootstrap Methods and Their Application, Chapter 5. Cambridge University Press.
DiCiccio, T.J. and Efron B. (1996) Bootstrap confidence intervals (with Discussion). Statistical Science, 11, 189–228.
Efron, B. (1987) Better bootstrap confidence intervals (with Discussion). Journal of the American Statistical Association, 82, 171–200.
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  # confidence intervals for the city data
ratio < function(d, w) sum(d$x * w)/sum(d$u * w)
city.boot < boot(city, ratio, R = 999, stype = "w", sim = "ordinary")
boot.ci(city.boot, conf = c(0.90, 0.95),
type = c("norm", "basic", "perc", "bca"))
# studentized confidence interval for the two sample
# difference of means problem using the final two series
# of the gravity data.
diff.means < function(d, f)
{ n < nrow(d)
gp1 < 1:table(as.numeric(d$series))[1]
m1 < sum(d[gp1,1] * f[gp1])/sum(f[gp1])
m2 < sum(d[gp1,1] * f[gp1])/sum(f[gp1])
ss1 < sum(d[gp1,1]^2 * f[gp1])  (m1 * m1 * sum(f[gp1]))
ss2 < sum(d[gp1,1]^2 * f[gp1])  (m2 * m2 * sum(f[gp1]))
c(m1  m2, (ss1 + ss2)/(sum(f)  2))
}
grav1 < gravity[as.numeric(gravity[,2]) >= 7, ]
grav1.boot < boot(grav1, diff.means, R = 999, stype = "f",
strata = grav1[ ,2])
boot.ci(grav1.boot, type = c("stud", "norm"))
# Nonparametric confidence intervals for mean failure time
# of the airconditioning data as in Example 5.4 of Davison
# and Hinkley (1997)
mean.fun < function(d, i)
{ m < mean(d$hours[i])
n < length(i)
v < (n1)*var(d$hours[i])/n^2
c(m, v)
}
air.boot < boot(aircondit, mean.fun, R = 999)
boot.ci(air.boot, type = c("norm", "basic", "perc", "stud"))
# Now using the log transformation
# There are two ways of doing this and they both give the
# same intervals.
# Method 1
boot.ci(air.boot, type = c("norm", "basic", "perc", "stud"),
h = log, hdot = function(x) 1/x)
# Method 2
vt0 < air.boot$t0[2]/air.boot$t0[1]^2
vt < air.boot$t[, 2]/air.boot$t[ ,1]^2
boot.ci(air.boot, type = c("norm", "basic", "perc", "stud"),
t0 = log(air.boot$t0[1]), t = log(air.boot$t[,1]),
var.t0 = vt0, var.t = vt)

BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 999 bootstrap replicates
CALL :
boot.ci(boot.out = city.boot, conf = c(0.9, 0.95), type = c("norm",
"basic", "perc", "bca"))
Intervals :
Level Normal Basic
90% ( 1.098, 1.848 ) ( 1.019, 1.743 )
95% ( 1.026, 1.920 ) ( 0.888, 1.782 )
Level Percentile BCa
90% ( 1.298, 2.022 ) ( 1.296, 2.014 )
95% ( 1.259, 2.152 ) ( 1.257, 2.149 )
Calculations and Intervals on Original Scale
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 999 bootstrap replicates
CALL :
boot.ci(boot.out = grav1.boot, type = c("stud", "norm"))
Intervals :
Level Normal Studentized
95% (5.872, 0.251 ) (7.194, 0.050 )
Calculations and Intervals on Original Scale
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 999 bootstrap replicates
CALL :
boot.ci(boot.out = air.boot, type = c("norm", "basic", "perc",
"stud"))
Intervals :
Level Normal Basic
95% ( 35.5, 183.2 ) ( 24.3, 169.8 )
Level Studentized Percentile
95% ( 43.0, 301.2 ) ( 46.3, 191.8 )
Calculations and Intervals on Original Scale
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 999 bootstrap replicates
CALL :
boot.ci(boot.out = air.boot, type = c("norm", "basic", "perc",
"stud"), h = log, hdot = function(x) 1/x)
Intervals :
Level Normal Basic
95% ( 4.042, 5.476 ) ( 4.109, 5.530 )
Level Studentized Percentile
95% ( 3.894, 5.825 ) ( 3.836, 5.257 )
Calculations and Intervals on Transformed Scale
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 999 bootstrap replicates
CALL :
boot.ci(boot.out = air.boot, type = c("norm", "basic", "perc",
"stud"), var.t0 = vt0, var.t = vt, t0 = log(air.boot$t0[1]),
t = log(air.boot$t[, 1]))
Intervals :
Level Normal Basic
95% ( 4.076, 5.441 ) ( 4.109, 5.530 )
Level Studentized Percentile
95% ( 3.894, 5.825 ) ( 3.836, 5.257 )
Calculations and Intervals on Original Scale
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.