Skip to content

Commit

Permalink
monitor PS for std.lv
Browse files Browse the repository at this point in the history
  • Loading branch information
ecmerkle committed May 10, 2024
1 parent 7734f3e commit 0da0d05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion R/bsam.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ bsam <- function(..., ngibbs = 50L) {
dotdotdot <- list(...)

if (!("mcmcextra" %in% names(dotdotdot))) {
mcmcextra <- list(dosam = TRUE, data = list(ngibbs = ngibbs, fullpsi_c = 0))
mcmcextra <- list(dosam = TRUE, data = list(ngibbs = ngibbs, fullpsi_c = 0), monitor = "PS")
} else {
mcmcextra <- dotdotdot$mcmcextra
mcmcextra$dosam <- TRUE
mcmcextra$monitor <- c(mcmcextra$monitor, "PS")
mcmcextra$data <- c(mcmcextra$data, list(ngibbs = ngibbs, fullpsi_c = 0L))
}

Expand Down
11 changes: 6 additions & 5 deletions inst/stan/stanmarg_bsam.stan
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,12 @@ generated quantities { // these matrices are saved in the output but do not figu
gamma0[mm] = rep_vector(0, maxdim);
Omega_inv[mm] = diag_matrix(gamma0[mm]);

if (Ndum[mm] > 0) {
for (j in 1:Ndum[mm]) {
Theta_sd_dum[g, dum_ov_idx[mm, j], dum_ov_idx[mm, j]] = pow(.0001, .5);
}
}

for (r in 1:m) {
real askel = Alpha_skeleton[g, r, 1];
if (is_inf(askel)) {
Expand Down Expand Up @@ -1466,11 +1472,6 @@ generated quantities { // these matrices are saved in the output but do not figu

// sample lvs
Psi0_inv = inverse_spd( quad_form_sym(Psi[g], IBinv') );
if (Ndum[mm] > 0) {
for (j in 1:Ndum[mm]) {
Theta_sd_dum[g, dum_ov_idx[mm, j], dum_ov_idx[mm, j]] = pow(.0001, .5);
}
}
Lamt_Thet_inv = Lambda[g]' * inverse_spd( quad_form_sym(Theta_r[g], Theta_sd_dum[g]) ); // mxp

D = inverse_spd( Lamt_Thet_inv * Lambda[g] + Psi0_inv );
Expand Down

0 comments on commit 0da0d05

Please sign in to comment.