Learn R Programming

distillery (version 1.2-1)

pbooter: Parametric Bootstrap Resampling

Description

Creates sample statistics for several replicated samples derived by sampling from a parametric distribution.

Usage

pbooter(x, statistic, B, rmodel, rsize, v.terms, verbose = FALSE, ...)

Arguments

x

Original data set. If it is a vector, then it is assumed to be univariate. If it is a matrix, it is assumed to be multivariate where each column is a variate.

statistic

Function that minimally takes arguments: data and . The argument data must be the input data for which resamples are taken. Must return a vector of all desired statistics.

B

number of bootstrap resamples to make.

rmodel

Function that generates the data to be applied to statistic. Must have arguments size, giving the size of the data to be returned, and .

rsize

Number giving the resample size for each bootstrap sample. If missing and x is a vector, it will be the length of x, and if it is a matrix, it will be the number of rows of x.

v.terms

If statistic returns variance estimates for other parameters, then use this argument to specify the indices returned that give the variance estimates. There must be a component for every other parameter returned, and they must be in the same order as the other parameters (see examples below). If an estimate does not exist, an NA should be returned for that spot.

verbose

logical, should progress information be printed to the screen?

Optional arguments to statistic or rmodel.

Value

A list object of class “booted” is returned with components:

call

the function call

data

original data series

statistic

statistic argument passed in

statistic.args

all other arguments passed by …

B

Number of bootstrap replicate samples

v.terms

if variance terms are returned by statistic, the argument is repeated in the returned object.

rsize

the size of the bootstrap resamples.

rdata

rsize by B matrix giving the rmodel generated data.

v

B length vector or B column matrix (if statistic returns a vector) giving the estimated parameter variances for each bootstrap replicate.

orig.v

vector giving the parameter variances (i.e. se^2) of statistic when applied to the original data.

original.est

vector giving the estimated parameter values when statistic is applied to the original data.

results

B length vector or B column matrix giving the parameter estimates for each bootstrap resample.

type

character stating whether the resample method is iid or cbb.

Details

Similar functionality to boot from boot when sim = “parametric”. In this case, the function is a little simpler, and is intended for use with ci.booted, or just ci. It is similar to booter, but uses parametric sampling instead of resampling from the original data.

References

Efron, B. and Tibshirani, R. J. (1998) An Introduction to the Bootstrap. Chapman \& Hall, Boca Raton, Florida, 436 pp.

See Also

booter, ci.booted tibber

Examples

Run this code
# NOT RUN {
z <- rnorm( 100 )

zfun <- function( data, ... ) {

    return( c( mean( data ), var( data ), mean( data^2 ), var( data^2 ) ) )

} # end of 'zfun' function.

rfun <- function( size, ... ) rnorm( size, ... )

res <- pbooter( x = z, statistic = zfun, rmodel = rfun, B = 500,
    rsize = 100, v.terms = c(2, 4) )

print( res )

# }
# NOT RUN {
ci( res )
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab