gas_bootstrap function

Bootstrap GAS Model

Bootstrap GAS Model

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 = 1e+06)), parallel_function = NULL, parallel_arguments = list())

Arguments

  • gas_object: An optional GAS estimate, i.e. a list of S3 class gas returned by function gas().
  • method: A method used for bootstrapping. Supported methods are "parametric", "simple_block", "moving_block", and "stationary_block".
  • rep_boot: A number of bootstrapping repetitions.
  • block_length: A length of blocks for methods "simple_block" and "moving_block". A mean length of blocks for method "stationary_block".
  • quant: A numeric vector of probabilities determining quantiles.
  • y: A time series. For univariate time series, a numeric vector or a matrix with a single column. For multivariate times series, a numeric matrix with observations in rows.
  • x: Optional exogenous variables. For a single variable common for all time-varying parameters, a numeric vector. For multiple variables common for all time-varying parameters, a numeric matrix with observations in rows. For individual variables for each time-varying parameter, a list of numeric vectors or matrices in the above form. The number of observation must be equal to the number of observations of y.
  • distr: A conditional distribution. See distr() for available distributions.
  • param: A parametrization of the conditional distribution. If NULL, default parametrization is used. See distr() for available parametrizations.
  • scaling: A scaling function for the score. The supported scaling functions are the unit scaling (scaling = "unit"), the inverse of the Fisher information matrix scaling (scaling = "fisher_inv"), and the inverse square root of the Fisher information matrix scaling (scaling = "fisher_inv_sqrt"). The latter two scalings use the Fisher information for the time-varying parameters only. For the full Fisher information matrix for both time-varying and static parameters, there are the "full_fisher_inv" and "full_fisher_inv_sqrt" scalings. For the individual Fisher information for each parameter, there are the "diag_fisher_inv" and "diag_fisher_inv_sqrt" scalings. Note that when the parametrization is orthogonal (see distr()), there are no differences between these scaling variants.
  • regress: A specification of the regression and dynamic equation with regard to exogenous variables. The supported specifications are exogenous variables and dynamics within the same equation (regress = "joint") and separate equations for exogenous variables and dynamics in the fashion of regression models with dynamic errors (regress = "sep"). In a stationary model without exogenous variables, the two specifications are equivalent, although with differently parametrized intercept.
  • p: A score order. For order common for all parameters, a numeric vector of length 1. For individual order for each parameter, a numeric vector of length equal to the number of parameters. Defaults to 1L.
  • q: An autoregressive order. For order common for all parameters, a numeric vector of length 1. For individual order for each parameter, a numeric vector of length equal to the number of parameters. Defaults to 1L.
  • par_static: An optional logical vector indicating static parameters. Overrides x, p, and q.
  • par_link: An optional logical vector indicating whether the logarithmic/logistic link should be applied to restricted parameters in order to obtain unrestricted values. Defaults to applying the logarithmic/logistic link for time-varying parameters and keeping the original link for constant parameters.
  • par_init: An optional numeric vector of initial values of time-varying parameters. For NA values or when NULL, set initial values to unconditional values of time-varying parameters. For example, in the case of GAS(1,1) model with regress = "joint", to omega / (1 - phi1). Not to be confused with starting values for the optimization coef_start.
  • lik_skip: A numeric value specifying the number of skipped observations at the beginning of the time series or after NA values in the likelihood computation. Defaults to 0L, i.e. the full likelihood. If NULL, it is selected as max(p,q), i.e. the conditional likelihood.
  • coef_fix_value: An optional numeric vector of values to which coefficients are to be fixed. NA values represent coefficients to be estimated.
  • coef_fix_other: An optional square numeric matrix of multiples of the estimated coefficients, which are to be added to the fixed coefficients. This allows the fixed coefficients to be linear combinations of the estimated coefficients. A coefficient given by row is fixed on coefficient given by column. By this logic, all rows corresponding to the estimated coefficients should contain only NA values. Furthermore, all columns corresponding to the fixed coefficients should also contain only NA values.
  • coef_fix_special: An optional character vector of predefined structures of coef_fix_value and coef_fix_other. Useful mainly for multidimensional models. Value "panel_structure" forces all regression, autoregression, and score coefficients to be the same for all time-varying parameters within their group. Value "zero_sum_intercept" forces all constant parameters to sum up to zero within their group. Value "random_walk" forces all autoregressive coefficients to be equal to one (should be used with caution due to nonstationarity; par_init must be specified). Multiple predefined structures can be used together. Also can be used in combination with custom coef_fix_value and coef_fix_other.
  • coef_bound_lower: An optional numeric vector of lower bounds on coefficients.
  • coef_bound_upper: An optional numeric vector of upper bounds on coefficients.
  • coef_est: A numeric vector of estimated coefficients.
  • optim_function: An optimization function. For suitable wrappers of common R optimization functions, see wrappers_optim. Can be set to NULL if the optimal solution should not be computed, which can be useful if the goal is only to evaluate the fit for the coefficients specified in argument coef_start.
  • optim_arguments: An optional list of arguments to be passed to the optimization function.
  • parallel_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.
  • parallel_arguments: An optional list of arguments to be passed to the optimization function.

Returns

A list of S3 class gas_bootstrap with components: - data$y: The time series.

  • data$x: The exogenous variables.

  • model$distr: The conditional distribution.

  • model$param: The parametrization of the conditional distribution.

  • model$scaling: The scaling function.

  • model$regress: The specification of the regression and dynamic equation.

  • model$t: The length of the time series.

  • model$n: The dimension of the model.

  • model$m: The number of exogenous variables.

  • model$p: The score order.

  • model$q: The autoregressive order.

  • model$par_static: The static parameters.

  • model$par_link: The parameters with the logarithmic/logistic links.

  • model$par_init: The initial values of the time-varying parameters.

  • model$lik_skip: The number of skipped observations at the beginning of the time series or after NA values in the likelihood computation.

  • model$coef_fix_value: The values to which coefficients are fixed.

  • model$coef_fix_other: The multiples of the estimated coefficients, which are added to the fixed coefficients.

  • model$coef_fix_special: The predefined structures of coef_fix_value and coef_fix_other.

  • model$coef_bound_lower: The lower bounds on coefficients.

  • model$coef_bound_upper: The upper bounds on coefficients.

  • model$coef_est: The estimated coefficients.

  • bootstrap$method: The method used for bootstrapping.

  • bootstrap$coef_set: The bootstrapped sets of coefficients.

  • bootstrap$coef_mean: The mean of bootstrapped coefficients.

  • bootstrap$coef_vcov: The variance-covariance matrix of bootstrapped coefficients.

  • bootstrap$coef_sd: The standard deviation of bootstrapped coefficients.

  • bootstrap$coef_pval: The p-value of bootstrapped coefficients.

  • bootstrap$coef_quant: The quantiles of bootstrapped coefficients.

Note

Supported generic functions for S3 class gas_bootstrap include summary(), plot(), coef(), and vcov().

Examples

# 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)

References

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") .

See Also

gas()

wrappers_parallel

  • Maintainer: Vladimír Holý
  • License: GPL-3
  • Last published: 2024-02-02