ankargren / mfbvar

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

Model with all monthly variables causes an error #8

Open alexhubbardOD opened 5 years ago

alexhubbardOD commented 5 years ago

Would be great to be able to use the same function even with data of all the same frequency. Right now, the estimate_mfbvar function throws an error:

prior_obj <- set_prior(Y = mf_sweden[, c("unemp", "infl", "ip", "eti")], freq = c(rep("m", 4)), n_lags = 4, n_burnin = 20, n_reps = 20) mod_minn <- estimate_mfbvar(prior_obj, prior_type = "minn")

Error in if (aggregation[i] == "m") { : missing value where TRUE/FALSE needed

ankargren commented 5 years ago

That is actually also included in the new version of the package (and yes, I know I've been hyping it as a catch-all solution to your answers). The new version is almost finished as most of the code is in place. What remains is the documentation and some convenience functions and stuff like that, but I haven't had time to do that yet as I'm currently finalizing my thesis. If you want it now you could try the development version by doing (untested, but I think that's the correct devtools syntax): devtools::install_github("ankargren/mfbvar@0.5.0.9000") I think your code snippet should work then (although I changed the prior_type argument to simply prior which may make it complain). But, as I said, the documentation is not up to date yet.

alexhubbardOD commented 5 years ago

Thanks, for the update. Good luck with the thesis, I’m sure it will be awesome from what I’ve seen from your package!

On Wed, Jun 5, 2019 at 12:04 PM Sebastian Ankargren < notifications@github.com> wrote:

That is actually also included in the new version of the package (and yes, I know I've been hyping it as a catch-all solution to your answers). The new version is almost finished as most of the code is in place. What remains is the documentation and some convenience functions and stuff like that, but I haven't had time to do that yet as I'm currently finalizing my thesis. If you want it now you could try the development version by doing (untested, but I think that's the correct devtools syntax): devtools::install_github("ankargren/mfbvar@0.5.0.9000)" I think your code snippet should work then (although I changed the prior_type argument to simply prior which may make it complain). But, as I said, the documentation is not up to date yet.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ankargren/mfbvar/issues/8?email_source=notifications&email_token=AJTB44SXONG6A5NSBDYFF7TPZAE47A5CNFSM4HT6SNSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXAWQMA#issuecomment-499214384, or mute the thread https://github.com/notifications/unsubscribe-auth/AJTB44VKNEK4UBFCVH7ZR4TPZAE47ANCNFSM4HT6SNSA .

-- Alex Hubbard, PhD Portfolio and Macro Risk Associate, Economist Opendoor Labs, Inc. alex.hubbard@opendoor.com

CylonScion commented 4 years ago

FYI: In the current cran version (0.5.1), the above example with all monthly variables works but plotting the model object throws an error:

plot(mod_minn)

Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' is a list, but does not have components 'x' and 'y'

ankargren commented 4 years ago

FYI: In the current cran version (0.5.1), the above example with all monthly variables works but plotting the model object throws an error:

plot(mod_minn)

Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' is a list, but does not have components 'x' and 'y'

Yes -- support for single-frequency models is somewhat limited since that was originally not the purpose of the package. Because of this, there is no plotting method for single-frequency models (and so R resorts to the default method for plot, which fails). I'm sure it would be possible to modify the method used for mixed-frequency models fairly easily, so I'd happily accept pull requests implementing it but I currently don't have the time to do it myself.