Description Usage Arguments Details Value See Also Examples
The function creates an object storing all information needed for estimating a mixed-frequency BVAR. The object includes data as well as details for the model and its priors.
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 | set_prior(
Y,
aggregation = "average",
prior_Pi_AR1 = 0,
lambda1 = 0.2,
lambda2 = 0.5,
lambda3 = 1,
lambda4 = 10000,
block_exo = NULL,
n_lags,
n_fcst = 0,
n_thin = 1,
n_reps,
n_burnin = n_reps,
freq = NULL,
d = NULL,
d_fcst = NULL,
prior_psi_mean = NULL,
prior_psi_Omega = NULL,
check_roots = FALSE,
s = -1000,
prior_ng = c(0.01, 0.01),
prior_phi = c(0.9, 0.1),
prior_sigma2 = c(0.01, 4),
n_fac = NULL,
n_cores = 1,
verbose = FALSE,
...
)
update_prior(prior_obj, ...)
|
Y |
data input. For monthly-quarterly data, should be a list with components containing regularly spaced time series (that inherit from |
aggregation |
the aggregation scheme used for relating latent high-frequency series to their low-frequency observations. The default is |
prior_Pi_AR1 |
The prior means for the AR(1) coefficients. |
lambda1 |
The overall tightness. |
lambda2 |
(Only if |
lambda3 |
The tightness of the intercept prior variance. |
lambda4 |
(Minnesota only) Prior variance of the intercept. |
block_exo |
(Only if |
n_lags |
The number of lags. |
n_fcst |
The number of periods to forecast. |
n_thin |
Store every |
n_reps |
The number of replications. |
n_burnin |
The number of burn-in replications. |
freq |
(Only used if |
d |
(Steady state only) Either a matrix with same number of rows as |
d_fcst |
(Steady state only) The deterministic terms for the forecasting period (not used if |
prior_psi_mean |
(Steady state only) Vector of length |
prior_psi_Omega |
(Steady state only) Matrix of size |
check_roots |
Logical, if roots of the companion matrix are to be checked to ensure stationarity. |
s |
(Hierarchical steady state only) scalar giving the tuning parameter for the Metropolis-Hastings proposal for the kurtosis parameter. If |
prior_ng |
(Hierarchical steady state only) vector with two elements giving the parameters |
prior_phi |
(Only used with common stochastic volatility) Vector with two elements |
prior_sigma2 |
(Only used with common stochastic volatility) Vector with two elements |
n_fac |
(Only used with factor stochastic volatility) Number of factors to use for the factor stochastic volatility model |
n_cores |
(Only used with factor stochastic volatility) Number of cores to use for drawing regression parameters in parallel |
verbose |
Logical, if progress should be printed to the console. |
... |
(Only used with factor stochastic volatility) Arguments to pass along to |
prior_obj |
an object of class |
Some support is provided for single-frequency data sets, where Y
contains variables sampled with the same frequency.
The aggregation weights that can be used for aggregation
are intra-quarterly averages (aggregation = "average"
), where the quarterly observations y_{q,t} are assumed to relate to the underlying monthly series z_{q,,t} through:
y_{q,t} = \frac{1}{3}(z_{q,,t} + z_{q,,t-1} + z_{q,, t-2})
If aggregation = "triangular"
, then instead
y_{q,t} = \frac{1}{9}(z_{q,,t} + 2z_{q,,t-1} + 3z_{q,, t-2}) + 2z_{q,, t-3}) + z_{q,, t-4})
The latter is typically used when modeling growth rates, and the former when working with log-levels.
If the steady-state prior is to be used, the deterministic matrix needs to be supplied, or a string indicating that the intercept should be the only deterministic term (d = "intercept"
). If the latter, d_fcst
is automatically set to be intercept only. Otherwise, if forecasts are requested
(n_fcst > 0
) also d_fcst
must be provided. Finally, the prior means of the steady-state parameters must (at the very minimum) also be
provided in prior_psi_mean
. The steady-state prior involves inverting the lag polynomial. For this reason, draws in which the largest eigenvalue
(in absolute value) of the lag polynomial is greater than 1 are discarded and new draws are made if check_roots = TRUE
. The maximum number of
attempts is 1,000.
For modeling stochastic volatility by the factor stochastic volatility model, the number of factors to use must be supplied. Further arguments can be passed along, but are not included as formal arguments. If the default settings are not overriden, the defaults used are as follows (see fsvsample
for descriptions):
priormu
= c(0, 10)
priorphiidi
= c(10, 3)
priorphifac
= c(10, 3)
priorsigmaidi
= 1
priorsigmafac
= 1
priorfacload
= 1
restrict
= "none"
The function update_prior
can be used to update an existing prior object. See the examples.
An object of class mfbvar_prior
that is used as input to estimate_mfbvar
.
estimate_mfbvar
, update_prior
, interval_to_moments
, print.mfbvar_prior
, summary.mfbvar_prior
, fsvsample
1 2 3 4 5 6 7 8 9 | # Standard list-based way
prior_obj <- set_prior(Y = mf_usa, n_lags = 4, n_reps = 100)
prior_obj <- update_prior(prior_obj, n_fcst = 4)
# Weekly-monthly mix of data, four weeks per month
Y <- matrix(rnorm(400), 100, 4)
Y[setdiff(1:100,seq(4, 100, by = 4)), 4] <- NA
prior_obj <- set_prior(Y = Y, freq = c(rep("w", 3), "m"),
n_lags = 4, n_reps = 10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.