Reweight a bootstrap distribution

DESCRIPTION:

Diagnostic procedure, estimate how a bootstrap distribution would change if sampling had been from a different distribution (with the same values, but different probabilities on those values).

USAGE:

reweight(boot.obj, data.weights, 
         probs, L, tau, tilt="exponential", subset.statistic, 
         subjectDivide = F, modifiedStatistic = NULL, 
         frame.eval = boot.obj$parent.frame) 

REQUIRED ARGUMENTS:

boot.obj
a bootstrap object, produced by .

OPTIONAL ARGUMENTS:

data.weights
a vector of length equal to the number of observations (or subjects) in the original sample. If the sampling was by subject, these may be observation weights or subject weights. In the latter case, the vector may be named, in which case the names must correspond to the unique values of the subject argument from boot.obj. Otherwise the weights are taken to be ordered with respect to the sorted values of subject. The default implies equal weights.

In place of data.weights, one of tau or probs may be supplied, and will be used with L to calculate data.weights using tilting. If data.weights and L are both missing, L will be computed from boot.obj using .

probs
scalar, between 0 and 1; if supplied then tau is chosen to reweight the bootstrap distribution to approximately satisfy the hypothesis that the true parameter is equal to the probs quantile of the unweighted bootstrap distribution.
L
vector of values of length n, to be used for computing probabilities by exponential or maximum likelihood tilting.
tau
scalar, tilting parameter
tilt
tilting method: one of "exponential" or "ml"
subset.statistic
scalar integer, which column of L to use for tilting; default 1.
subjectDivide
logical flag, meaningful only if the sampling in boot.obj was by subject. Internal calculations involve assigning weights to subjects; if TRUE then the weight for each subject is divided among observations for that subject before calculating the statistic; if FALSE the subject weight is replicated to observations for that subject. Also, if TRUE and data.weights contains observation weights, then initial subject weights will be the sums of weights for the observations.
modifiedStatistic
if the bootstrap statistic is an expression that calls a function with a "hidden" weights argument, then pass this to indicate how to call your function. See below.
frame.eval
frame where the data and other objects used when creating boot.obj can be found. You need to specify this if objects can't be found by their original names, or have changed; see .

VALUE:

an object of class "reweight" which inherits from "resamp". This is similar to the original object except that the observed value has been recomputed using the weighted empirical distribution with probabilities data.weights, and the bootstrap distribution now has unequal weights to reflect the sampling probabilities.

DETAILS:

No new sampling is performed; instead the weights are calculated using importance sampling identities.

The name "Splus.resamp.weights" is reserved for internal use by reweight. To avoid naming conflicts, that name can not be used as a variable name in the data argument to boot.obj, if data is a data frame.

When the bootstrap statistic is an expression, for example mean(x), a modified expression mean(x, weights = Splus.resamp.weights) is created. Only calls to functions that have an argument named weights are modified; e.g. sum(x)/length(x) would fail because sum does not have a weights argument. If the expression calls a function with a "hidden" weights argument, e.g. you may pass weights as part of the ... list, then use the modifiedStatistic argument to specify that, e.g. modifiedStatistic = myFun(x, weights = Splus.resamp.weights). (You must use the name Splus.resamp.weights in modifiedStatistic.) An expression such as mean(y[a==1]) is converted to mean(y[a==1], weights = Splus.resamp.weights) which will fail because the weights vector was not subscripted along with y. In cases such as these pass a function that performs the desired calculations, or use
modifiedStatistic = mean(y[a==1], weights = Splus.resamp.weights[a==1])

An error occurs if the bootstrap statistic can not be successfully modified to accomodate weights and modifiedStatistic is not provided.

The bootstrap statistic should be "functional"; that is, the observed value of the statistic should be equal to the value computed with equal weights. A warning occurs if this is not the case.

REFERENCES:

Hesterberg, T.C. (2001), "Bootstrap Tilting Diagnostics" Proceedings of the Statistical Computing Section, American Statistical Association (CD-ROM)

SEE ALSO:

, , , .

For an annotated list of functions in the package, including other high-level resampling functions, see: .

EXAMPLES:

x <- rexp(30) 
bfit <- bootstrap(x, mean, save.indices=T) 
rfit <- reweight(bfit, L=x, probs=.2) 
bfit 
rfit 
plot(bfit) 
plot(rfit)