From 5ee75102340f0180de054109d880fad826bc6f99 Mon Sep 17 00:00:00 2001 From: ecmerkle Date: Thu, 28 Mar 2024 21:27:48 -0500 Subject: [PATCH] possibly addressing #74: for two-level models, loudly use listwise deletion when missing data are encountered --- DESCRIPTION | 2 +- R/blavaan.R | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3cd0c700..624b562f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: blavaan Title: Bayesian Latent Variable Analysis -Version: 0.5-3.1251 +Version: 0.5-3.1253 Authors@R: c(person(given = "Edgar", family = "Merkle", role = c("aut", "cre"), email = "merklee@missouri.edu", diff --git a/R/blavaan.R b/R/blavaan.R index 672bebea..b31eb431 100644 --- a/R/blavaan.R +++ b/R/blavaan.R @@ -321,7 +321,15 @@ blavaan <- function(..., # default lavaan arguments dotdotdot$do.fit <- TRUE; dotdotdot$warn <- FALSE if(LAV@Data@data.type != "moment" && target == "stan"){ ## if no missing, set missing = "listwise" to avoid meanstructure if possible - if(!any(is.na(unlist(lavInspect(LAV, 'data'))))) dotdotdot$missing <- "listwise" + if(!any(is.na(unlist(lavInspect(LAV, 'data'))))){ + dotdotdot$missing <- "listwise" + } else { + if("cluster" %in% dotNames) { + ## set missing = "listwise" for two-level models + dotdotdot$missing <- "listwise" + cat("blavaan NOTE: for two-level models, listwise deletion is currently the only missingness option.\n\n") + } + } } # for initial values/some parameter setup: