Description Usage Arguments Details Value Note Author(s) References Examples
This functions performs the data-based algorithm of Hall, Horowitz and Jing (1995), henceforth HHJ, for the selection of optimal block length sizes in the case of block bootstrap of Kunsch (1989).
1 2 3 4 5 | HHJ(data, statistic, R = 100L, nsteps = 5L, type.est = "bias.variance",
type.optm = 0, ran.gen = function(tser, n.sim, args) tser,
ran.args = NULL, allow.parallel = TRUE, errorhandling = "try",
n.try = 5L, m.init = "default", type.sub.blocks = "fast", seed = 123,
packages = NULL, export = NULL, ...)
|
data |
A univariate or multivariate time series. It might be vector, matrix or data frame to be passed to statistic. |
statistic |
A function which when applied to data returns a vector containing the statistic of interest. Each time statistic is called it is passed a time series of length n which is of the same class as the original tseries. Any other arguments which statistic takes must remain constant for each bootstrap replicate and should be supplied through the . . . argument to tsboot. |
R |
A positive integer giving the number of bootstrap replicates required. The default value is 100. |
nsteps |
A positive integer with the number of steps (iterations) in the HHJ algorithm. The default value is 5. |
type.est |
A character describing the type of estimation being undertaken. Accepted values are: 'bias.variance', 'one.sided.distribution' and 'two.sided.distribution'. The default value is 'bias.variance'. |
type.optm |
0 for mean of the parameters vector or a positive integer giving the index of the desired parameter to optimize in the same order as provided by statistic. For more details see the section "Details" bellow. |
ran.gen |
This is a function of three arguments. The first
argument is a time series, it is the result of selecting
|
ran.args |
This will be supplied to |
allow.parallel |
Logical TRUE/FALSE indicating whether parallel computation via the foreach package should be used. The default value is TRUE. OBS:paralllel backend must be registered prior to calling HHJ. |
errorhandling |
A character, accepted values are 'try' and 'pass'. |
n.try |
A positive integer indicating the maximum number of tries if errorhandling='try'. The default value is 3. |
m.init |
A positive integer smaller then the number
of observations (n.obs.) in |
type.sub.blocks |
A character, accepted values are: 'fast'
and 'complete', the former implements a sampling scheme
in the subsets of |
seed |
Numeric, the seed to |
packages |
If |
export |
If |
... |
Extra argumetns to |
This functions implements the iterative version of the
Hall, Horowitz and Jing (1995) algorithm. Here some
modifications are implemented in the fashion of Barroso
(2017). Namely, a vectorized algorithm is implemented
where the user might supply which parameter to optimize
over or use a default value. The default value is obtained
by minimizin the mean MSE vector (if a vector or
parameters is returned by statistic). For the MBB step
the tsboot
function from the
boot package is used. Additionaly, with the
argument type.sub.blocks
the user might use a
sampling sche on the subsets of m.init
. There is
one sample from the quantile 1/3, another for the 2/3
and the last one for the 1/3-2/3.
A dataframe, the first column for the iteration step and the second for the estimated optimal block length.
For bugs and further requests please refer to https://github.com/matheusbarroso/dboot
Matheus de Vasconcellos Barroso
Kunsch, Hans R. 1989. The Jakknife and the Bootstrap For General Stationary Observations. The Annals of Statistics. 1989, Vol. 17, 3, pp. 1217-1241.
Hall, P., Horowitz, J. L e Jing, B-Y. 1995. On blocking rules for the bootstrap with dependent data. Biometrika. 82, 1995, pp. 561-574.
Barroso, Matheus de V. 2018. BOOTSTRAP METHODS FOR GENERALIZED AUTOREGRESSIVE MOVING AVERAGE MODELS
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 29 30 31 32 33 | ## Not run:
library(gamlss)
library(dboot)
db <- example_HHJ
fam <- "PO"
ord <- c(0,1)
library(doParallel)
no_cores <- if(detectCores()==1) 1 else detectCores() -1
registerDoParallel(no_cores)
HHJ(db,bootf,R = 10,nsteps=1,ord=ord,fam=fam,
export=c("garmaFit2"), packages=c("gamlss"))
HHJ(db,bootf,R = 10, errorhandling="pass",ord=ord,seed=124
fam=fam,export=c("garmaFit2"), packages=c("gamlss"),n.try=3)
HHJ(db,bootf,R = 10,nsteps=2,ord=ord,fam=fam,
export=c("garmaFit2"), packages=c("gamlss"),n.try=2)
HHJ(db,bootf,R = 10,nsteps=1,ord=ord,fam=fam,
export=c("garmaFit2"), packages=c("gamlss"),type.sub.blocks="complete")
HHJ(db,bootf,R = 10,nsteps=2,ord=ord,fam=fam,
export=c("garmaFit2"), packages=c("gamlss"),type.optm=2)
HHJ(db,bootf,R = 10,nsteps=3,ord=ord,fam=fam,
export=c("garmaFit2"), packages=c("gamlss"),m.init=6)
HHJ(db,bootf,R = 10,nsteps=1,ord=ord,fam=fam,
export=c("garmaFit2"), packages=c("gamlss"),m.init=6,allow.parallel=FALSE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.