From 9b059d42ed47f5900d69a1487510fd6f101346af Mon Sep 17 00:00:00 2001 From: Franz Mohr Date: Sat, 8 Jul 2023 08:37:00 +0200 Subject: [PATCH] Better handling of unsuccessful Gibbs samplers --- R/submodel_test_statistics.R | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/R/submodel_test_statistics.R b/R/submodel_test_statistics.R index 2556349..020a1dd 100644 --- a/R/submodel_test_statistics.R +++ b/R/submodel_test_statistics.R @@ -137,15 +137,13 @@ submodel_test_statistics <- function(object, ...){ teststats[i, "r"] <- object[[i]][["model"]][["rank"]] } - # Skip tests if posterior simulation was not successful + # Test if Gibbs sampler was successful if (!is.null(object[[i]][["error"]])) { if (object[[i]][["error"]]) { loglik[[pos[i]]] <- NA - next } } else { - if (tvp) { temp_pars <- list() length(temp_pars) <- tt @@ -222,7 +220,7 @@ submodel_test_statistics <- function(object, ...){ } else { A0 <- diag(k_domestic) } - u[, period] <- y[, period] - matrix(temp_pars[[period]][j, ], k_domestic) %*% x[, period] + u[, period] <- A0 %*% y[, period] - matrix(temp_pars[[period]][j, ], k_domestic) %*% x[, period] } } else { if (structural) {