bootstrap
generates bootstrap samples for general stationary
data and computes the bootstrap estimate of standard error and bias
if a statistic is given.bootstrap(x, nb = 1, statistic = NULL, b = NULL,
type = c("stationary","block"), ...)
type
is "stationary"
, then b
is the
mean block length. If type
is "block"
, then b
is the fixed block length."stationary"
(stationary bootstrap with mean block length b
) and
"block"
(blockwise bootstrap with block length
statistic
which are
passed unchanged each time statistic
is called.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:
statistic
to each of
the simulated time series.statistic
to the
original series.statistic
.statistic
.bootstrap
.type
is "stationary"
, then the stationary
bootstrap scheme with mean block length b
according to Politis
and Romano (1994) is used to generate the simulated series. For
type
equals "block"
, the blockwise bootstrap with block
length b
according to Kuensch (1989) is used. Note, that this bootstrap procedure does not implement the block of
blocks bootstrap. Hence, it may only be used for symmetric statistics,
i.e., for statistics which are invariant under permutations of
x
.
For consistency, the (mean) block length b
should grow with
n
at an appropriate rate. If b
is not given, then a
default growth rate of const * n^(1/3)
is used (n
is the
number of observations in x
). This rate is "optimal" under
certain conditions (see the references for more details). However, in
general the growth rate depends on the specific properties of the
process which has generated x
. Therefore, a default value for
const
has been determined by a Monte Carlo simulation using a
Gaussian AR(1) process (AR(1)-parameter of 0.5, 500
observations). const
has been 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.
D. N. Politis and J. P. Romano (1994): The Stationary Bootstrap. Journal of the American Statistical Association 89, 1303--1313.
sample
,
surrogate
n <- 500 # Generate AR(1) process
a <- 0.6
e <- rnorm(n+100)
x <- double(n+100)
x[1] <- rnorm(1)
for(i in 2:(n+100)) {
x[i] <- a * x[i-1] + e[i]
}
x <- ts(x[-(1:100)])
bootstrap(x, nb=500, statistic=mean) # ok
bootstrap(x, nb=500, statistic=mean, type="block", b=1) # wrong here
# std. error for mean should approximately be
sqrt(1/(n*(1-a)^2))
Run the code above in your browser using DataLab