A function for bootstrapping coefficients of generalized autoregressive score (GAS) models of Creal et al. (2013) and Harvey (2013).
Method "parametric" repeatedly simulates time series using the parametric model and re-estimates coefficients.
Methods "simple_block", "moving_block", and "stationary_block" perform the standard variations of the circular block bootstrap.
Instead of supplying arguments about the model, the function can be applied to the gas object obtained by the gas() function.
The function enables parallelization.
gas_bootstrap(
gas_object = NULL,
method = "parametric",
rep_boot = 1000L,
block_length = NULL,
quant = c(0.025, 0.975),
y = NULL,
x = NULL,
distr = NULL,
param = NULL,
scaling = "unit",
regress = "joint",
p = 1L,
q = 1L,
par_static = NULL,
par_link = NULL,
par_init = NULL,
lik_skip = 0L,
coef_fix_value = NULL,
coef_fix_other = NULL,
coef_fix_special = NULL,
coef_bound_lower = NULL,
coef_bound_upper = NULL,
coef_est = NULL,
optim_function = wrapper_optim_nloptr,
optim_arguments = list(opts = list(algorithm = "NLOPT_LN_NELDERMEAD", xtol_rel = 0,
maxeval = 10000)),
parallel_function = NULL,
parallel_arguments = list()
)A list of S3 class gas_bootstrap with components:
The time series.
The exogenous variables.
The conditional distribution.
The parametrization of the conditional distribution.
The scaling function.
The specification of the regression and dynamic equation.
The length of the time series.
The dimension of the model.
The number of exogenous variables.
The score order.
The autoregressive order.
The static parameters.
The parameters with the logarithmic/logistic links.
The initial values of the time-varying parameters.
The number of skipped observations at the beginning of the time series or after NA values in the likelihood computation.
The values to which coefficients are fixed.
The multiples of the estimated coefficients, which are added to the fixed coefficients.
The predefined structures of coef_fix_value and coef_fix_other.
The lower bounds on coefficients.
The upper bounds on coefficients.
The estimated coefficients.
The method used for bootstrapping.
The bootstrapped sets of coefficients.
The mean of bootstrapped coefficients.
The variance-covariance matrix of bootstrapped coefficients.
The standard deviation of bootstrapped coefficients.
The p-value of bootstrapped coefficients.
The quantiles of bootstrapped coefficients.
An optional GAS estimate, i.e. a list of S3 class gas returned by function gas().
A method used for bootstrapping. Supported methods are "parametric", "simple_block", "moving_block", and "stationary_block".
A number of bootstrapping repetitions.
A length of blocks for methods "simple_block" and "moving_block". A mean length of blocks for method "stationary_block".
A numeric vector of probabilities determining quantiles.
When gas_object is not supplied, the estimated model can be specified using these individual arguments. See the arguments and value of the gas() function for more details.
An optimization function. For suitable wrappers of common R optimization functions, see wrappers_optim.
An optional list of arguments to be passed to the optimization function.
A parallelization function. For suitable wrappers of common R parallelization functions, see wrappers_parallel. Can be set to NULL if no parallelization is to be used.
An optional list of arguments to be passed to the optimization function.
Creal, D., Koopman, S. J., and Lucas, A. (2013). Generalized Autoregressive Score Models with Applications. Journal of Applied Econometrics, 28(5), 777–795. tools:::Rd_expr_doi("10.1002/jae.1279").
Harvey, A. C. (2013). Dynamic Models for Volatility and Heavy Tails: With Applications to Financial and Economic Time Series. Cambridge University Press. tools:::Rd_expr_doi("10.1017/cbo9781139540933").
gas()
wrappers_parallel
# Load the Daily Toilet Paper Sales dataset
data("toilet_paper_sales")
y <- toilet_paper_sales$quantity
x <- as.matrix(toilet_paper_sales[3:9])
# Estimate GAS model based on the negative binomial distribution
est_negbin <- gas(y = y, x = x, distr = "negbin", regress = "sep")
est_negbin
# Bootstrap the model (can be time-consuming for a larger number of samples)
boot_negbin <- gas_bootstrap(est_negbin, rep_boot = 10)
boot_negbin
# Plot boxplot of bootstrapped coefficients
plot(boot_negbin)
Run the code above in your browser using DataLab