flexMeboot {meboot} | R Documentation |
Flexible Extension of the Maximum Entropy Bootstrap Procedure
Description
This function extends the maximum entropy bootstrap procedure
implemented in meboot
to allow for for a flexible trend up, flat or down.
Usage
flexMeboot (x, reps = 9, segment = 5, forc = FALSE, myseq = seq(-1, 1, by = 1))
Arguments
x |
vector of data, |
reps |
number of replicates to generate. |
segment |
block size. |
forc |
logical. If TRUE the ensemble is forced to satisfy the central limit theorem.
See |
myseq |
directions for trend within a block of data is chosen randomly with the user's choice
limited by the range of values given by myseq. For example, |
Details
flexMeboot
uses non-overlapping blocks having only m observations.
A trend is replaced by
,
where
B = sample(myseq) * b
.
Its steps are as follows:
Choose block size
segment
denoted here as(default equal to
) and divide the original time series
x
of lengthinto
blocks or subsets. Note that when
is not an integer the
-th block will have a few more than
items. Hence let us denote the number of observations in each block as
which equals
for most blocks, except the
-th.
Regress each block having m observations as subsets of
x
on the set, and store the intercept
, the slope
of
and the residuals
.
Note that the positive (negative) sign of the slope
in this regression determines the up (down) direction of the time series in that block. Hence the next step of the algorithm replaces
by
, defined by a randomly chosen weight
. For example, when the random choice yields
, the sign of
is reversed. Our weighting independently injects some limited flexibility to the directions of values block segments of the original time series.
Reconstruct all time series blocks as:
, by adding back the residual
of the regression on
.
The next step applies the function
meboot
to each block of time serie-now having a modified trend-and create a large number,, of resampled time series for each of the
blocks.
Sequentially join the
replicates of all
blocks or subsets together.
Value
A matrix containing by columns
the bootstrapped replicated of the original data x
.
References
Vinod, H.D. (2012), Constructing Scenarios of Time Heterogeneous Series for Stress Testing, Available at SSRN: https://www.ssrn.com/abstract=1987879.
See Also
Examples
set.seed(235)
myseq <- seq(-1, 1, by = 0.5)
xx <- flexMeboot(x = AirPassengers, myseq = myseq, reps = 3)
matplot(cbind(AirPassengers, xx), type = "l")