Skip to content

Commit

Permalink
Better handling of unsuccessful Gibbs samplers
Browse files Browse the repository at this point in the history
  • Loading branch information
franzmohr committed Jul 8, 2023
1 parent eb23a4e commit 9b059d4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions R/submodel_test_statistics.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9b059d4

Please sign in to comment.