Skip to content

Commit

Permalink
use original design matrix in savs
Browse files Browse the repository at this point in the history
  • Loading branch information
ygeunkim committed Nov 15, 2024
1 parent 7d3f2d5 commit 6add121
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion inst/include/bvhardraw.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ inline void draw_coef(Eigen::Ref<Eigen::VectorXd> coef, Eigen::Ref<const Eigen::
//
// @param coef non-zero coef
// @param x design matrix
inline void draw_savs(Eigen::Ref<Eigen::VectorXd> sparse_coef, Eigen::Ref<Eigen::VectorXd> coef, Eigen::MatrixXd& x) {
inline void draw_savs(Eigen::Ref<Eigen::VectorXd> sparse_coef, Eigen::Ref<Eigen::VectorXd> coef, Eigen::Ref<Eigen::MatrixXd> x) {
sparse_coef.setZero();
// for (int i = 0; i < coef.size(); ++i) {
// double mu_i = 1 / (coef[i] * coef[i]);
Expand Down
5 changes: 2 additions & 3 deletions inst/include/bvharmcmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class McmcTriangular {
);
coef_vec = coef_mat.reshaped();
}
draw_mn_savs(sparse_coef.col(j), coef_mat.col(j), design_coef, prior_prec_j.cwiseSqrt());
draw_mn_savs(sparse_coef.col(j), coef_mat.col(j), x, prior_prec_j.cwiseSqrt());
}
}
void updateImpact() {
Expand All @@ -183,8 +183,7 @@ class McmcTriangular {
prior_chol_prec.segment(contem_id, j - 1),
rng
);
draw_savs(sparse_contem.segment(contem_id, j - 1), contem_coef.segment(contem_id, j - 1), design_contem);
// draw_mn_savs(sparse_contem.segment(contem_id, j - 1), contem_coef.segment(contem_id, j - 1), design_contem, prior_chol_prec.segment(contem_id, j - 1));
draw_savs(sparse_contem.segment(contem_id, j - 1), contem_coef.segment(contem_id, j - 1), latent_innov.leftCols(j - 1));
}
}
void updateLatent() { latent_innov = y - x * coef_mat; }
Expand Down

0 comments on commit 6add121

Please sign in to comment.