Generates bootstrap replicates of a time series using the maximum entropy bootstrap algorithm with Rcpp implementation for improved performance. This method is particularly useful for non-stationary time series and preserves the dependence structure of the original data.

meboot(
  x,
  reps = 999,
  trim = list(trim = 0.1, xmin = NULL, xmax = NULL),
  reachbnd = TRUE,
  expand.sd = TRUE,
  force.clt = TRUE,
  scl.adjustment = FALSE,
  sym = FALSE,
  colsubj,
  coldata,
  coltimes,
  ...
)

Arguments

x

A numeric vector or time series object to be bootstrapped.

reps

Number of bootstrap replicates to generate (default: 999).

trim

Controls tail behavior. Can be a single numeric value specifying the trim proportion (e.g., 0.10 for 10% trimming), or a list with components:

trim

Trim proportion for tail calculation (default: 0.10)

xmin

Lower bound for generated values (optional)

xmax

Upper bound for generated values (optional)

reachbnd

Logical indicating whether to allow generated values to reach the boundaries xmin and xmax (default: TRUE).

expand.sd

Logical indicating whether to expand the standard deviation of the ensemble (default: TRUE).

force.clt

Logical indicating whether to force the central limit theorem compliance by centering each replicate (default: TRUE).

scl.adjustment

Logical indicating whether to adjust the scale of the ensemble to match the original data's variance (default: FALSE).

sym

Logical indicating whether to force symmetry in the maximum entropy density (default: FALSE).

colsubj

Deprecated parameter from original meboot (included for compatibility).

coldata

Deprecated parameter from original meboot (included for compatibility).

coltimes

Deprecated parameter from original meboot (included for compatibility).

...

Additional arguments passed to expansion functions.

Value

A list with the following components:

x

Original time series data

ensemble

Matrix of bootstrap replicates (n x reps)

xx

Sorted original data

z

Intermediate points between sorted values

dv

Absolute differences between consecutive observations

dvtrim

Trimmed mean of differences

xmin

Lower bound used for generation

xmax

Upper bound used for generation

desintxb

Interval means satisfying mean-preserving constraint

ordxx

Ordering index of original data

kappa

Scale adjustment factor (if scl.adjustment = TRUE)

Details

The maximum entropy bootstrap algorithm generates replicates that:

  • Preserve the dependence structure of the original time series

  • Can handle non-stationary time series

  • Satisfy the ergodic theorem and central limit theorem

  • Maintain the mean and autocorrelation structure

The Rcpp implementation provides significant performance improvements over the original R implementation, especially for large datasets and many replications.

References

Vinod, H. D., & Lopez-de-Lacalle, J. (2009). Maximum entropy bootstrap for time series: The meboot R package. Journal of Statistical Software, 29(5), 1-19.

Examples

# \donttest{
# Basic usage with a time series
set.seed(123)
x <- ts(rnorm(100), start = c(2000, 1), frequency = 12)
result <- meboot(x, reps = 1000)

# Plot first few replicates
matplot(result$ensemble[, 1:5], type = "l", lty = 1)
lines(result$x, col = "black", lwd = 2)


# With custom bounds
result_bounded <- meboot(x, reps = 100, 
                             trim = list(trim = 0.1, xmin = -3, xmax = 3))
#> Warning: expand.sd and force.clt were set to FALSE to enforce limits xmin/xmax.

# With scale adjustment
result_scaled <- meboot(x, reps = 100, scl.adjustment = TRUE)
# }