ankargren / mfbvar

R package for Mixed-Frequency Bayesian VARs
https://ankargren.github.io/mfbvar
38 stars 21 forks source link

random seed option for replication #3

Closed CylonScion closed 5 years ago

CylonScion commented 5 years ago

Hi, is there a way to set a random seed so as to get the exact same forecast results upon re-running the code (on the same computer/code/data etc.)?

Also, any plans on adding fevd/irf analysis in the future?

Thanks.

ankargren commented 5 years ago

Hi,

Yes, you can set the seed as you would normally do and that should give you the same forecasts. Here is the example from predict.mfbvar:

set.seed(10)
prior_obj <- set_prior(Y = mf_sweden[, 4:5], freq = c("m", "q"),
                       n_lags = 4, n_burnin = 20, n_reps = 20, n_fcst = 4)
mod_minn <- estimate_mfbvar(prior_obj, prior_type = "minn")
predict(mod_minn, pred_quantiles = 0.5, tidy = TRUE)

If you run this chunk multiple times the output will be the same.

As for IRFs/FEVDs, the package has mostly been developed with forecasting in mind. That being said, what you ask for is a relatively simple addition so it would probably be a good idea to add that.