Skip to content

Commit

Permalink
pass quadrature data to bsam
Browse files Browse the repository at this point in the history
  • Loading branch information
ecmerkle committed Dec 1, 2024
1 parent 29bf36b commit 2caf26b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 1,6 @@
Package: blavaan
Title: Bayesian Latent Variable Analysis
Version: 0.5-6.1314
Version: 0.5-6.1316
Authors@R: c(person(given = "Edgar", family = "Merkle",
role = c("aut", "cre"),
email = "[email protected]",
Expand Down
8 changes: 6 additions & 2 deletions R/lav_export_stanmarg.R
Original file line number Diff line number Diff line change
Expand Up @@ -1136,14 1136,18 @@ lav2standata <- function(lavobject, dosam = FALSE) {
if (dosam) {
lavmodel <- lavobject@Model

dat$ngh <- 1L
dat$ghnode <- array(0, 1)
dat$ghwt <- array(1, 1)

## single group only
lvvars <- 1:NCOL(lavmodel@GLIST$lambda)

dummy.ov.x.idx <- lavmodel@ov.x.dummy.ov.idx[[1]]
dummy.lv.x.idx <- lavmodel@ov.x.dummy.lv.idx[[1]]
dummy.ov.idx <- c(lavmodel@ov.y.dummy.ov.idx[[1]], dummy.ov.x.idx)
dummy.lv.idx <- c(lavmodel@ov.y.dummy.lv.idx[[1]], dummy.lv.x.idx)

dat$Ndum <- array(length(dummy.ov.idx), 1)
dum_ov_idx <- c(allvars[allvars %in% dummy.ov.idx],
allvars[!(allvars %in% dummy.ov.idx)])
Expand Down
6 changes: 5 additions & 1 deletion R/stanmarg_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 242,7 @@ stanmarg_data <- function(YX = NULL, S = NULL, YXo = NULL, N, Ng, grpnum, # data
phi_r_sign_c = NULL, dumlv_c = NULL, wigind_c = NULL,
Ndum = NULL, dum_ov_idx = NULL, dum_lv_idx = NULL, # for bsam
Ndum_x = NULL, dum_ov_x_idx = NULL, dum_lv_x_idx = NULL,
ngh = NULL, ghnode = NULL, ghwt = NULL,
...) {

dat <- list()
Expand Down Expand Up @@ -283,7 284,10 @@ stanmarg_data <- function(YX = NULL, S = NULL, YXo = NULL, N, Ng, grpnum, # data
dat$Ndum_x <- Ndum_x
dat$dum_ov_x_idx <- dum_ov_x_idx
dat$dum_lv_x_idx <- dum_lv_x_idx

dat$ngh <- ngh
dat$ghnode <- ghnode
dat$ghwt <- ghwt

dat$use_suff <- 1L
if (ord | multilev) dat$use_suff <- 0L

Expand Down

0 comments on commit 2caf26b

Please sign in to comment.