Imp.Estimates | R Documentation |
Central moment, tail probability, and quantile estimates for a statistic under importance resampling.
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.out |
A object of class |
alpha |
The alpha levels for the required quantiles. The default is to calculate the 1%, 2.5%, 5%, 10%, 90%, 95%, 97.5% and 99% quantiles. |
index |
The index of the variable of interest in the output of
|
t0 |
The values at which tail probability estimates are required. For
each value |
t |
The bootstrap replicates of a statistic. By default these are taken
from the bootstrap output object |
w |
The importance resampling weights for the bootstrap replicates. If they are
not supplied then |
def |
A logical value indicating whether a defensive mixture is to be used
for weight calculation. This is used only if |
q |
A vector of probabilities specifying the resampling distribution
from which any estimates should be found. In general this would
correspond to the usual bootstrap resampling distribution which
gives equal weight to each of the original observations. The
estimates depend on this distribution only through the importance
weights |
A list with the following components :
alpha |
The |
t0 |
The values at which the tail probabilities are estimated, if
|
raw |
The raw importance resampling estimates. For |
rat |
The ratio importance resampling estimates. In this method the
weights |
reg |
The regression importance resampling estimates. In this method the weights
which are used are derived from a regression of |
Davison, A. C. and Hinkley, D. V. (1997) Bootstrap Methods and Their Application. Cambridge University Press.
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.
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 <- as.vector(tapply(d * w, strata, sum)) # drop names
mn2 <- tapply(d * d * w, strata, sum)
s2hat <- sum((mn2 - mns^2)/ns)
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])
unlist(grav.p)
grav.q <- imp.quantile(grav.tilt.boot, w = grav.w, index = 3,
alpha = c(0.9, 0.95, 0.975, 0.99))
as.data.frame(grav.q)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.