diff --git a/R/specify_bsvarSIGN.R b/R/specify_bsvarSIGN.R index 59c232e..7257bb6 100644 --- a/R/specify_bsvarSIGN.R +++ b/R/specify_bsvarSIGN.R @@ -250,8 +250,7 @@ specify_prior_bsvarSIGN = R6::R6Class( for (i in 1:(p + 5)) { x = cbind(x, Y[(p + 5 + 1):T - i, n]) } - s2.ols[n] = sum(((diag(T - p - 5) - x %*% solve(t(x) %*% x) %*% t(x)) %*% y)^2) / - (T - p - 5) + s2.ols[n] = sum(((diag(T - p - 5) - x %*% solve(t(x) %*% x) %*% t(x)) %*% y)^2) / (T - p - 5) } hyper = matrix(NA, N + 3, 1) diff --git a/src/bsvars_sign.cpp b/src/bsvars_sign.cpp index 313142c..0af252b 100644 --- a/src/bsvars_sign.cpp +++ b/src/bsvars_sign.cpp @@ -105,8 +105,8 @@ Rcpp::List bsvar_sign_cpp( psi = hyper.rows(3, N + 2); // update Minnesota prior - prior_V = diagmat(lambda * lambda * prior_v % - join_vert(repmat(1 / psi, p, 1), + prior_V = diagmat(prior_v % + join_vert(lambda * lambda * repmat(1 / psi, p, 1), ones(K - N * p))); prior_S = diagmat(psi); @@ -121,7 +121,7 @@ Rcpp::List bsvar_sign_cpp( post_B = result(0); post_V = result(1); post_S = result(2); - // post_nu = as_scalar(post(3)); + post_nu = as_scalar(result(3)); // sample reduced-form parameters Sigma = iwishrnd(post_S, post_nu);