Skip to content

Commit

Permalink
debug lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwang15 committed Jul 16, 2024
1 parent f199ce8 commit 8328f01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions R/specify_bsvarSIGN.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/bsvars_sign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<vec>(K - N * p)));
prior_S = diagmat(psi);

Expand All @@ -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);
Expand Down

0 comments on commit 8328f01

Please sign in to comment.