gas_filter | R Documentation |
A function for obtaining filtered time-varying parameters of generalized autoregressive score (GAS) models of Creal et al. (2013) and Harvey (2013).
It captures parameter uncertainty and can also be used for forecasting.
Method "simulated_coefs"
computes a path of time-varying parameters for each simulated coefficient set under assumption of asymptotic normality with given variance-covariance matrix (see Blasques et al., 2016).
Method "given_coefs"
computes a path of time-varying parameters for each supplied coefficient set.
Instead of supplying arguments about the model, the function can be applied to the gas
object obtained by the gas()
function.
gas_filter(
gas_object = NULL,
method = "simulated_coefs",
coef_set = NULL,
rep_gen = 1000L,
t_ahead = 0L,
x_ahead = NULL,
rep_ahead = 1000L,
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,
coef_fix_value = NULL,
coef_fix_other = NULL,
coef_fix_special = NULL,
coef_bound_lower = NULL,
coef_bound_upper = NULL,
coef_est = NULL,
coef_vcov = NULL
)
gas_object |
An optional GAS estimate, i.e. a list of S3 class |
method |
A method used for parameter uncertainty. Supported methods are |
coef_set |
A numeric matrix of coefficient sets in rows for |
rep_gen |
A number of generated coefficient sets for |
t_ahead |
A number of observations to forecast. |
x_ahead |
Out-of-sample 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 |
rep_ahead |
A number of simulation repetitions for forecasting when |
quant |
A numeric vector of probabilities determining quantiles. |
y , x , distr , param , scaling , regress , p , q , par_static , par_link , par_init , coef_fix_value , coef_fix_other , coef_fix_special , coef_bound_lower , coef_bound_upper , coef_est , coef_vcov |
When |
A list
of S3 class gas_filter
with components:
data$y |
The time series. |
data$x |
The exogenous variables. |
data$x_ahead |
The out-of-sample exogenous variables. Only when |
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$t_ahead |
The length of the out-of-sample time series. Only when |
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$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 |
model$coef_bound_lower |
The lower bounds on coefficients. |
model$coef_bound_upper |
The upper bounds on coefficients. |
model$coef_set |
The coefficient sets. |
filter$method |
The method used for parameter uncertainty. |
filter$par_tv_mean |
The mean of the time-varying parameters. |
filter$par_tv_sd |
The standard deviation of the time-varying parameters. |
filter$par_tv_quant |
The quantiles of the time-varying parameters. |
filter$score_tv_mean |
The mean of the scores. |
filter$score_tv_sd |
The standard deviation of the scores. |
filter$score_tv_quant |
The quantiles of the scores. |
filter$y_ahead_mean |
The mean of the forecasted time series. Only when |
filter$y_ahead_sd |
The standard deviation of the forecasted time series. Only when |
filter$y_ahead_quant |
The quantiles of the forecasted time series. Only when |
filter$par_tv_ahead_mean |
The mean of the forecasted time-varying parameters. Only when |
filter$par_tv_ahead_sd |
The standard deviation of the forecasted time-varying parameters. Only when |
filter$par_tv_ahead_quant |
The quantiles of the forecasted time-varying parameters. Only when |
filter$score_tv_ahead_mean |
The mean of the forecasted scores. Only when |
filter$score_tv_ahead_sd |
The standard deviation of the forecasted scores. Only when |
filter$score_tv_ahead_quant |
The quantiles of the forecasted scores. Only when |
Supported generic functions for S3 class gas_filter
include summary()
ans plot()
.
Blasques, F., Koopman, S. J., Łasak, K., and Lucas, A. (2016). In-Sample Confidence Bands and Out-of-Sample Forecast Bands for Time-Varying Parameters in Observation-Driven Models. International Journal of Forecasting, 32(3), 875–887. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ijforecast.2015.11.018")}.
Creal, D., Koopman, S. J., and Lucas, A. (2013). Generalized Autoregressive Score Models with Applications. Journal of Applied Econometrics, 28(5), 777–795. \Sexpr[results=rd]{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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1017/cbo9781139540933")}.
gas()
# 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
# Filter the time-varying parameters by the "simulated_coefs" method
flt_negbin <- gas_filter(est_negbin, rep_gen = 100)
flt_negbin
# Plot the time-varying parameters with confidence bands
plot(flt_negbin)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.