tseries (version 0.8-0)

bootstrap: Generate Bootstrap Data and Statistics

Description

Generates bootstrap samples from the original data and computes the bootstrap estimate of standard error and bias for a given statistic (if this is given).

Usage

bootstrap(x, nb = 1, statistic = NULL, b = NULL,
          type = c("stationary","block"), ...)

Arguments

x
a numeric vector or time series giving the original data.
nb
the number of bootstrap series to compute.
statistic
a function which when applied to a time series returns a vector containing the statistic(s) of interest.
b
if type is "stationary", then b is the mean block length. If type is "block", then b is the fixed block length.
type
the type of bootstrap to generate the simulated time series. The possible input values are "stationary" (stationary bootstrap with mean block length b) and "block" (moving blocks bootstrap with block len
...
additional arguments for statistic which are passed unchanged each time statistic is called.

Value

  • If statistic is NULL, then it returns a matrix or time series with nb columns and length(x) rows containing the bootstrap data. Each column contains one bootstrap sample.

    If statistic is given, then a list of class "resample.statistic" with the following elements is returned:

  • statisticthe results of applying statistic to each of the simulated time series.
  • orig.statisticthe results of applying statistic to the original series.
  • biasthe bias of the statistics computed as in a bootstrap setup.
  • sethe standard error of the statistics computed as in a bootstrap setup.
  • callthe original call of bootstrap.

Details

If type is "stationary", then the stationary bootstrap scheme with mean block length b generates the simulated series. If type is "block", then the moving blocks bootstrap with block length b generates the simulated series.

For consistency, the (mean) block length b should grow with n as const * n^(1/3), where n is the number of observations in x. Note, that in general const depends on intricate properties of the process x. The default value for const has been determined by a Monte Carlo simulation using a Gaussian AR(1) (AR(1)-parameter of 0.5, 500 observations) process for x. It is chosen such that the mean square error for the bootstrap estimate of the variance of the empirical mean is minimized.

Missing values are not allowed.

There is a special print method for objects of class "resample.statistic" which by default uses max(3, getOption("digits") - 3) digits to format real numbers.

References

H. R. Kuensch (1989): The Jackknife and the Bootstrap for General Stationary Observations. The Annals of Statistics 17, 1217--1241.

D. N. Politis and J. P. Romano (1994): The Stationary Bootstrap. Journal of the American Statistical Association 89, 1303--1313.

See Also

sample, surrogate

Examples

Run this code
n <- 500  # Generate AR(1) process
e <- rnorm(n)  
x <- double(n)
x[1] <- rnorm(1)
for(i in 2:n) {
  x[i] <- 0.5 * x[i-1] + e[i]
}
x <- ts(x)

theta <- function(x)  # Autocorrelations up to lag 10
  return(acf(x, plot=FALSE)$acf[2:11])

bootstrap(x, nb=50, statistic=theta)

Run the code above in your browser using DataLab