From 6add121cabb2ef5340ab93efe2493994504dcc9e Mon Sep 17 00:00:00 2001 From: Young Geun Kim Date: Fri, 15 Nov 2024 20:16:12 +0900 Subject: [PATCH] use original design matrix in savs --- inst/include/bvhardraw.h | 2 +- inst/include/bvharmcmc.h | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/inst/include/bvhardraw.h b/inst/include/bvhardraw.h index c32eb034..5de5f8ad 100644 --- a/inst/include/bvhardraw.h +++ b/inst/include/bvhardraw.h @@ -368,7 +368,7 @@ inline void draw_coef(Eigen::Ref coef, Eigen::Ref sparse_coef, Eigen::Ref coef, Eigen::MatrixXd& x) { +inline void draw_savs(Eigen::Ref sparse_coef, Eigen::Ref coef, Eigen::Ref x) { sparse_coef.setZero(); // for (int i = 0; i < coef.size(); ++i) { // double mu_i = 1 / (coef[i] * coef[i]); diff --git a/inst/include/bvharmcmc.h b/inst/include/bvharmcmc.h index bb89379f..11deec0e 100644 --- a/inst/include/bvharmcmc.h +++ b/inst/include/bvharmcmc.h @@ -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() { @@ -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; }