umx
umx copied to clipboard
unable to run model with non-overlapping planned missingness
Hello! I'm trying to run an EFA with planned missingness. The challenge is that the missing pattern is such that there are no complete observations:
library(umx)
example_data <- data.frame(
item1 = rnorm(90),
item2 = rnorm(90),
item3 = rnorm(90),
item4 = c(rnorm(30), rep(NA, 60)),
item5 = c(rep(NA, 30), rnorm(30), rep(NA, 30)),
item6 = c(rep(NA, 60), rnorm(30))
)
umxEFA(example_data, factors=1)
Running this fails on umx_var. Here's the error & traceback():
A latent variable 'F1' was created.
Error in var(df, use = use) : no complete element pairs
6: var(df, use = use)
5: umx_var(data, format = "diag")
4: xmu_check_variance(data[, setdiff(namesNeeded, fullCovs), drop = FALSE])
3: xmu_make_mxData(data = data, type = type, verbose = verbose)
2: umxRAM(model = name, data = data, autoRun = FALSE, umxPath(factors,
to = manifests, connect = "unique.bivariate"), umxPath(v.m. = manifests),
umxPath(v1m0 = factors))
1: umxEFA(example_data, factors = 1)
Running umx_var(example_data) confirms the error; looks like it's called to compute starting values.
Is there a way we can either 1) create starting values without complete obs, or 2) pass our own starting values to bypass this error?
Thanks for taking a look at this!
Here's my umx version info, for completeness:
umx version: 4.19.0
OpenMx version: 2.21.8 [GIT v2.21.8]
R version: R version 4.2.2 (2022-10-31)
Platform: x86_64-conda-linux-gnu
Default optimizer: SLSQP
NPSOL-enabled?: No
OpenMP-enabled?: Yes