# tgsboot: Bootstrap for Stationary Data In analytics: Regression Outlier Detection, Stationary Bootstrap, Testing Weak Stationarity, NA Imputation, and Other Tools for Data Analysis

## Description

Generate bootstrap samples for stationary data, using a truncated geometric distribution to more accurately determine the value of the `p` parameter involved in the algorithm.

## Usage

 `1` ```tgsboot(tseries, nb = 1, b.info = FALSE) ```

## Arguments

 `tseries` a numeric vector or time series giving the original data. `nb` the number of bootstrap series to compute. `b.info` if TRUE, the value of the `b` parameter found is returned as well. The default is FALSE.

## Details

The value of the `b` parameter involved in the stationary bootstrap algorithm is determined using the heuristic laid out in Politis & White (2004). Then, the value of the `p` parameter is found by numerically solving a polynomial of order N+1 in variable `q`, where q = 1-p and N is the length of the data supplied. The previous polynomial is derived using the expectation of a truncated geometric distribution (for the stochastic block length), shown in Olatayo (2014).

The general structure of the algorithm is similar to the one laid out in James & Yang (2010).

## Value

If b.info is FALSE, a matrix or time series with nb columns and length(tseries) rows containing the bootstrap data. Each column contains one bootstrap sample. If b.info is TRUE, a list with two fields: one containing the bootstrap data, and another containing the `b` value found.

## References

Politis, D.N. and Romano, J.P. (1994), 'The stationary bootstrap', Journal of the American Statistical Association 89(428), 1303-1313.

Politis, D.N. and White, H. (2004), 'Automatic block-length selection for the dependent bootstrap', Econometric Reviews 23(1), 53-70.

Olatayo, T.O. (2014), 'Truncated geometric bootstrap method for timeseries stationary process', Applied Mathematics 5, 2057-2061.

James, J. and Yang, L. (2010), 'Stop-losses, maximum drawdown-at-risk and replicating financial time series with the stationary bootstrap', Quantitative Finance 10(1), 1-12.

## Examples

 ```1 2 3 4 5 6``` ```set.seed(123) x = rnorm(1e4) boot = tgsboot(x) boot = tgsboot(x, b.info = TRUE) boot = tgsboot(x, nb = 2) boot = tgsboot(x, nb = 2, b.info = TRUE) ```

analytics documentation built on May 2, 2019, 3:37 p.m.