Skip to content

Commit

Permalink
margloglik, attempt to handle partable without group column
Browse files Browse the repository at this point in the history
  • Loading branch information
ecmerkle committed Mar 23, 2024
1 parent caf2c7b commit 359c0da
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion R/margloglik.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,18 @@ margloglik <- function(lavpartable, lavmodel, lavoptions,
## first deal with any wishart priors
wps <- which(sapply(pricom, function(x) x[1] %in% c("dwish", "lkj_corr")))
if(length(wps) > 0){
ngroups <- max(lavpartable$group)
if("group" %in% names(lavpartable)){
ngroups <- max(lavpartable$group)
} else {
if("block" %in% names(lavpartable)){
lavpartable$group <- lavpartable$block
ngroups <- max(lavpartable$block)
} else {
lavpartable$group <- rep(1, length(lavpartable$lhs))
ngroups <- 1
}
}

targdist <- ifelse(grepl("stan", target), "lkj_corr", "dwish")
for(k in 1:ngroups){
## TODO? ensure that covpars are ordered the same as varpars?
Expand Down

0 comments on commit 359c0da

Please sign in to comment.