bootindex: Indices to induce block bootstraps

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

These functions generate the random indices necessary to implement the moving blocks bootstrap (Kunsch, 1989) and the circular blocks bootstrap (Politis and Romano, 1994)

Usage

1
2
3

Arguments

nobs

The length of each bootstrap process.

blocklength

The block length or, in the case of the stationary bootstrap, the expected block length.

Details

Both the moving blocks bootstrap and the circular blocks bootstrap resample from the sequence X = X[1],...,X[n] by drawing length blocklength consecutive observations repeatedly and then pasting the blocks until the resampled sequence has the same length as the original. The blocks are drawn independently of each other. The circular block bootstrap allows (for example) X[n-1], X[n], X[1], X[2] to be a valid block of length 4, and the moving blocks bootstrap does not. The functions bootindex_movingblock and bootindex_circularblock give the indices that induce the bootstrap, so for example we get a particular circular block bootstrap draw of X with block length 8 from the command X[bootindex_movingblock(length(X), 8)].

Value

A vector of indices that corresponds to a single bootstrap draw.

Author(s)

Gray Calhoun gcalhoun@iastate.edu

References

Calhoun, G. 2011, Documentation appendix: An asymptotically normal out-of-sample test of equal predictive accuracy for nested models. Unpublished manuscript.

Kunsch, H. R. 1989, The Jackknife and the Bootstrap for general stationary observations. Annals of Statistics, 17(3), pages 1217–1241.

Liu, R. Y. and Kesar, S. 1992, Moving blocks Jackknife and Bootstrap capture weak dependence, in R. LePage and L. Billard, editors, Exploring the limits of Bootstrap, John Wiley, pages 225–248.

Politis, D. N. and Romano, J. P. 1992, A circular block-resampling procedure for stationary data, in R. LePage and L. Billard, editors, Exploring the limits of Bootstrap, John Wiley, pages 263–270.

See Also

boot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Example of hypothesis test that mean = 0
nobs <- 200
nboot <- 299
level <- .1
X <- 2 + arima.sim(n = nobs, list(ma = c(0.5)))

naive <- replicate(nboot, mean(X[sample(1:nobs, nobs, replace = TRUE)])) - mean(X)
smart1 <- replicate(nboot, mean(X[bootindex_circularblock(nobs, 5)])) - mean(X)
smart2 <- replicate(nboot, mean(X[bootindex_movingblock(nobs, 5)])) - mean(X)
smart3 <- replicate(nboot, mean(X[bootindex_stationary(nobs, 5)])) - mean(X)

## corresponding critical values
quantile(naive, 1 - level)
quantile(smart1, 1 - level)
quantile(smart2, 1 - level)
quantile(smart3, 1 - level)

## Not run: 
mc <- replicate(300, {
  X <- arima.sim(n = nobs, list(ma = c(0.5)))
  naive <- replicate(nboot, mean(X[sample(1:nobs, nobs, replace = TRUE)])) - mean(X)
  smart <- replicate(nboot, mean(X[bootindex_circularblock(nobs, 5)])) - mean(X)
  c(naive = mean(X) >= quantile(naive, 1 - level),
    smart = mean(X) >= quantile(smart, 1 - level))
  })
rowMeans(mc)

## End(Not run)

grayclhn/oosanalysis-R-library documentation built on May 17, 2019, 8:33 a.m.