From 6919c2fbea6625c8c870a71a35f7b376a0a95474 Mon Sep 17 00:00:00 2001 From: Nikolas Kuschnig Date: Fri, 16 Feb 2024 10:47:41 +0100 Subject: [PATCH] Wrap up for CRAN --- NEWS.md | 5 +++-- R/64_irf_method.R | 9 +++------ inst/tinytest/test_BVAR.R | 8 +++++--- tests/tinytest.R | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/NEWS.md b/NEWS.md index 53e5b99..5d29b61 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,11 @@ -# v1.0.5, CRAN Update 9 +# v1.0.5, CRAN Update 10 - Add historical decompositions and RMSE/LPS, and WAIC for analysis - Improve the algorithm to draw sign restrictions - Shocks are now built and checked per variable - Fix the CRAN *NOTE* on missing "tangle output" -- Keep older FRED-datasets due to small changes in naming +- Update FRED-datasets to 2023-10 vintage + - Newer FRED-QD files include (unannounced) small naming changes # v1.0.4, CRAN Update 9 diff --git a/R/64_irf_method.R b/R/64_irf_method.R index 899652f..093e649 100644 --- a/R/64_irf_method.R +++ b/R/64_irf_method.R @@ -99,12 +99,9 @@ irf.bvar <- function(x, ..., conf_bands, n_thin = 1L, verbose = FALSE) { sigma <- x[["sigma"]] # Check sign restrictions - if(!is.null(irf[["sign_restr"]]) && length(irf[["sign_restr"]]) != M ^ 2) { - stop("Dimensions of provided sign restrictions do not fit the data.") - } - if(!is.null(irf[["zero_restr"]]) && length(irf[["zero_restr"]]) != M ^ 2) { - stop("Dimensions of provided zero and sign restrictions ", - "do not fit the data.") + if(!is.null(irf[["sign_restr"]]) && length(irf[["sign_restr"]]) != M ^ 2 || + !is.null(irf[["zero_restr"]]) && length(irf[["zero_restr"]]) != M ^ 2) { + stop("Dimensions of provided restrictions do not fit the data.") } # Sampling --- diff --git a/inst/tinytest/test_BVAR.R b/inst/tinytest/test_BVAR.R index 3efa251..831ede4 100644 --- a/inst/tinytest/test_BVAR.R +++ b/inst/tinytest/test_BVAR.R @@ -164,7 +164,7 @@ expect_silent(irfs3 <- irf(run2, opt_irf3)) expect_silent(print(irfs1)) expect_silent(print(summary(irfs1))) -expect_silent(print(fevd(run))) # Access +expect_silent(print(fevd(run) <- fevd(run))) # Access expect_silent(print(fevd(run2))) # Recalculates expect_silent(print(fevd(irfs2))) # Recalculates expect_silent(plot(irfs1, vars_res = 1, vars_imp = 1)) @@ -250,6 +250,8 @@ expect_silent(print(companion(run, conf_bands = 0.1))) expect_silent(print(hist_decomp(run, type = "mean"))) expect_silent(print(hist_decomp(run, type = "quantile"))) -expect_silent(print(rmse(run, type = "mean"))) -expect_silent(print(lps(run, conf_bands = 0.1))) +expect_silent(print(rmse(run))) +expect_silent(print(rmse(run, holdout = data2[1:10, ]))) +expect_silent(print(lps(run))) +expect_silent(print(lps(run, holdout = data2[1:10, ]))) expect_silent(print(WAIC(run))) diff --git a/tests/tinytest.R b/tests/tinytest.R index aa061fc..bcdff9a 100644 --- a/tests/tinytest.R +++ b/tests/tinytest.R @@ -3,7 +3,7 @@ if(requireNamespace("tinytest", quietly = TRUE)) { set.seed(42) home <- length(unclass(packageVersion("BVAR"))[[1]]) == 4 # 0.0.0.9000 - home <- TRUE + # home <- TRUE if(home) { # Only run locally, let CRAN test examples and the vignette tinytest::test_package("BVAR", at_home = home, pattern = "^.*\\.[rR]$") }