Parametric Bootstrapping

DESCRIPTION:

Performs parametric bootstrap; i.e., draws samples from a fitted parametric model, calculates specified statistics on these simulated data sets, and summarizes the bootstrap distribution.

USAGE:

parametricBootstrap(data, statistic, rsampler, B=1000, 
           args.stat, args.rsampler, dsampler, 
           seed = .Random.seed,  
           label, statisticNames, 
           block.size = min(100, B), 
           trace = resampleOptions()$trace, 
           assign.frame1 = F, save.samples = F, 
           statistic.is.random, seed.statistic = 500) 

REQUIRED ARGUMENTS:

data
data on which the original statistic is calculated. May be a vector, matrix, or data frame.
statistic
statistic to be bootstrapped; a function or expression that returns a vector or matrix. It may be a function which accepts data as the first argument; other arguments may be passed using args.stat.
Or it may be an expression such as mean(x,trim=.2). If data is given by name (e.g. data=x) then use that name in the expression, otherwise (e.g. data=air[,4]) use the name data in the expression. If data is a data frame, the expression may involve variables in the data frame.
rsampler
parametric function which generates the simulated data. The first argument to this function should be the sample size (and called n), which will be passed in automatically by parametricBootstrap; other arguments, if any, should be provided in a list ( args.rsampler).

OPTIONAL ARGUMENTS:

B
number of bootstrap resamples to be drawn. This may be a vector, whose sum is the total number of resamples.
args.stat
list of other arguments, if any, passed to statistic when calculating the statistic on the resamples.
args.rsampler
list of other arguments, if any, passed to rsampler when performing the parametric sampling.
dsampler
function which provides the density corresponding to rsampler. This argument is not currently used.
seed
seed for generating parametric resamples. May be a legal random number seed or an integer between 0 and 1023 which is passed to set.seed.
label
character, if supplied is used when printing, and as the main title for plotting.
statisticNames
character vector of length equal to the number of statistics calculated; if supplied is used as the statistic names for printing and plotting.
block.size
control variable specifying the number of resamples to calculate at once (in the innermost of the nested for() loops).
trace
logical flag indicating whether the algorithm should print a message indicating which set of replicates is currently being drawn. The default is determined by .
assign.frame1
logical flag indicating whether the resampled data should be assigned to frame 1 before evaluating the statistic. Try assign.frame1=T if all estimates are identical (this is slower).
save.samples
logical flag indicating whether to save the resampled data. Note that this may require a large quantity of memory.
statistic.is.random
logical flag indicating whether the statistic itself performs randomization, in which case we need to keep track of two parallel seeds, one for the sampling and one for the statistic. If this argument is missing, the algorithm attempts to determine if the statistic involves randomization by evaluating it and checking whether the random seed has changed.
seed.statistic
random number seed to be used for the statistic if it uses randomization.

VALUE:

an object of class parametricBootstrap which inherits from resamp. This has components call, observed, replicates, estimate, B, n, dim.obs, seed.start, seed.end, rsampler, args.rsampler, parent.frame, defaultLabel, and possibly dsampler and label. The data frame estimate has three columns containing the bootstrap estimates of Bias, Mean, and SE. See for a description of many components.

SIDE EFFECTS:

If assign.frame1=T, you must be sure that this assignment does not overwrite some quantity of interest stored in frame 1.

If the function is interrupted it saves current results (all complete sets of block.size replicates) to .parametricBootstrap.partial.results. This object is nearly the same as if parametricBootstrap were called with a smaller value of B. (If the function is interrupted before a complete set of block.size replicates is formed, a one-component list with B = 0 is saved to .parametricBootstrap.partial.results, for use with the function.)

DETAILS:

Performs parametric bootstrapping for a wide scope of statistics and expressions. Function rsampler and its arguments (passed on by args.rsampler) specify the parametric distribution from which bootstrap samples are drawn.

REFERENCES:

Davison, A.C. and Hinkley, D.V. (1997), Bootstrap Methods and Their Application, Cambridge University Press.

Efron, B. and Tibshirani, R.J. (1993), An Introduction to the Bootstrap, San Francisco: Chapman & Hall.

SEE ALSO:

, , .

More details on some arguments, see .

Print, summarize, plot: , , , , ,

Description of a "parametricBootstrap" object, extract parts: , .

Confidence intervals: , .

Modify a "parametricBootstrap" object: , .

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

EXAMPLES:

# Apply parametric bootstrap to mean 
# and demonstrate summary(), plot() 
temp <- parametricBootstrap(iris[,1,1], mean, rsampler = rnorm, 
    args.rsampler = list(mean = mean(iris[,1,1]), 
    sd = sqrt(var(iris[,1,1])))) 
temp 
summary(temp) 
plot(temp)