timeboot {greybox}R Documentation

Time series bootstrap

Description

The function implements a bootstrap inspired by the Maximum Entropy Bootstrap

Usage

timeboot(y, nsim = 100, intermittent = c("yes", "no"),
  type = c("additive", "multiplicative"), kind = c("nonparametric",
  "parametric"), lag = frequency(y), scale = NULL)

Arguments

y

The original time series

nsim

Number of iterations (simulations) to run.

intermittent

Whether to treat the demand as intermittent or not.

type

Type of bootstrap to use. "additive" means that the randomness is added, while "multiplicative" implies the multiplication.

kind

A kind of the bootstrap to do: nonparametric or parametric. The latter relies on the normal distribution, while the former uses the empirical distribution of differences of the data.

lag

The lag to use in the calculation of differences. Should be 1 for non-seasonal data.

scale

Scale (sd) to use in the normal distribution. Estimated as mean absolute differences of the data if omitted.

Details

The function implements the following algorithm:

1. Sort the data in the ascending order, recording the original order of elements; 2. Take first differences of the sorted series and sort them; 3. Create contingency table based on the differences and take the cumulative sum of it. This way we end up with an empirical CDF of differences; 4. Generate random numbers from the uniform distribution between 0 and 1; 5. Get the differences that correspond to the random numbers (randomly extract empirical quantiles). This way we take the empirical density into account when selecting the differences; 6. Add the random differences to the sorted series from (1) to get a new time series; 7. Sort the new time series in the ascending order; 8. Reorder (7) based on the initial order of series.

If the multiplicative bootstrap is used then logarithms of the sorted series are used and at the very end, the exponent of the resulting data is taken. This way the discrepancies in the data have similar scale no matter what the level of the original series is. In case of the additive bootstrap, the trended series will be noisier when the level of series is low.

Value

The function returns:

Author(s)

Ivan Svetunkov, ivan@svetunkov.ru

References

Vinod HD, López-de-Lacalle J (2009). "Maximum Entropy Bootstrap for Time Series: The meboot R Package." Journal of Statistical Software, 29(5), 1–19. doi:10.18637/jss.v029.i05.

Examples

timeboot(AirPassengers) |> plot()


[Package greybox version 2.0.1 Index]