imp.moments(boot.out=NULL, index=1, t=boot.out$t[, index],
w=NULL, def=TRUE, q=NULL)
imp.prob(boot.out=NULL, index=1, t0=boot.out$t0[index],
t=boot.out$t[, index], w=NULL, def=TRUE, q=NULL)
imp.quantile(boot.out=NULL, alpha=NULL, index=1,
t=boot.out$t[, index], w=NULL, def=TRUE, q=NULL)
"boot"
generated by a call to boot
or tilt.boot
.
Use of these functions makes sense only when the bootstrap resampling used
unequal weights for the observations. If the importance weights w<
boot.out$statistic
.
This is not used if the argument t
is supplied.t0[i]
the function will estimate the bootstrap cdf evaluated at
t0[i]
. If imp.prob
is called without the argument t0
then theboot.out
but they can be supplied separately
if required (e.g. when the statistic of interest is a function of the
calculated values in boot.out
must be supplied, in
which case the importance weights are calculated by a call to imp.weights
.w
is missing and it is passed unchanged
to imp.weights
to calculate w
.alpha
levels used for the quantiles, if imp.quantile
is used.imp.prob
is used.imp.moments
this has length 2,
the first component being the estimate of the mean and the second being the
variance estimate. For imp.prob
, raw
is of the same length as t0
, and
for imp.quantile
it is of the same length as alpha
.w
are
rescaled to have average value one before they are used. The format of this
vector is the same as raw
.t*w
on w
. This choice of
weights can be shown to minimize the variance of the weights and also the
Euclidean distance of the weights from the uniform weights. The format of this
vector is the same as raw
.Hesterberg, T. (1995) Weighted average importance sampling and defensive mixture distributions. Technometrics, 37, 185--194.
Johns, M.V. (1988) Importance sampling for bootstrap confidence intervals. Journal of the American Statistical Association, 83, 709--714.
boot
, exp.tilt
, imp.weights
, smooth.f
, tilt.boot
# Example 9.8 of Davison and Hinkley (1997) requires tilting the
# resampling distribution of the studentized statistic to be centred
# at the observed value of the test statistic, 1.84. In this example
# we show how certain estimates can be found using resamples taken from
# the tilted distribution.
data(gravity)
grav1 <- gravity[as.numeric(gravity[,2])>=7,]
grav.fun <- function(dat, w, orig)
{ strata <- tapply(dat[, 2], as.numeric(dat[, 2]))
d <- dat[, 1]
ns <- tabulate(strata)
w <- w/tapply(w, strata, sum)[strata]
mns <- tapply(d * w, strata, sum)
mn2 <- tapply(d * d * w, strata, sum)
s2hat <- sum((mn2 - mns^2)/ns)
as.vector(c(mns[2]-mns[1],s2hat,(mns[2]-mns[1]-orig)/sqrt(s2hat)))
}
grav.z0 <- grav.fun(grav1,rep(1,26),0)
grav.L <- empinf(data=grav1, statistic=grav.fun, stype="w",
strata=grav1[,2], index=3, orig=grav.z0[1])
grav.tilt <- exp.tilt(grav.L,grav.z0[3],strata=grav1[,2])
grav.tilt.boot <- boot(grav1, grav.fun, R=199, stype="w",
strata=grav1[,2], weights=grav.tilt$p,
orig=grav.z0[1])
# Since the weights are needed for all calculations, we shall calculate
# them once only.
grav.w <- imp.weights(grav.tilt.boot)
grav.mom <- imp.moments(grav.tilt.boot, w=grav.w, index=3)
grav.p <- imp.prob(grav.tilt.boot, w=grav.w, index=3, t0=grav.z0[3])
grav.q <- imp.quantile(grav.tilt.boot, w=grav.w, index=3,
alpha=c(0.9,0.95,0.975,0.99))
Run the code above in your browser using DataLab