Skip to content

Commit

Permalink
handle unexported object
Browse files Browse the repository at this point in the history
  • Loading branch information
ecmerkle committed Jul 11, 2021
1 parent 54e9cdd commit fd2efbe
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions R/blav_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ get_ll <- function(postsamp = NULL, # one posterior sample

## check for missing, to see if we can easily get baseline ll for chisq
mis <- FALSE
if(any(is.na(unlist(lavdata@X)))) mis <- TRUE

if(any(is.na(unlist(lavdata@X)))){
mis <- TRUE
lavmvh1 <- getFromNamespace("lav_mvnorm_missing_h1_estimate_moments", "lavaan")
}

if(measure[1] %in% c("logl", "chisq") & !mis){
if(casewise){
ll.samp <- rep(NA, sum(unlist(lavdata@nobs)))
Expand Down Expand Up @@ -128,10 +131,10 @@ get_ll <- function(postsamp = NULL, # one posterior sample
tmpsat <- 0
for(g in 1:length(implied$cov)){
## high tolerance speed boost
tmpsat <- tmpsat + lavaan:::lav_mvnorm_missing_h1_estimate_moments(Y = lavdata@X[[g]],
Mp = lavdata@Mp[[g]],
#max.iter = 20,
tol = 1e-2)$fx
tmpsat <- tmpsat + lavmvh1(Y = lavdata@X[[g]],
Mp = lavdata@Mp[[g]],
#max.iter = 20,
tol = 1e-2)$fx
}
ll.samp <- c(tmpll, tmpsat)
} else {
Expand Down

0 comments on commit fd2efbe

Please sign in to comment.