tidyLPA icon indicating copy to clipboard operation
tidyLPA copied to clipboard

Feature request: tidyLPA, multiply imputed data, and `with()`

Open jrcalabrese opened this issue 3 years ago • 2 comments

Hello, I am interested in running latent profile analysis with multiply imputed data. I have conducted multiple imputation with the mice package, but combining with and estimate_profiles results in an error message: Error in df[, select_vars, drop = FALSE] : incorrect number of dimensions. I have included a sample below. I understand that this is likely a mice issue as much as it is a tidyLPA issue, but I would appreciate any ideas or suggestions. Thank you for your help.

library(tidyverse)
library(tidyLPA)
library(mice)
set.seed(123)

data(airquality)

imp <- mice::mice(airquality, 
                  m = 5, maxit = 5,
                  print = FALSE)

est_imp <- with(imp, 
            estimate_profiles(imp, n_profiles = 3, 
                              variances = "equal", 
                              covariances = "equal"))
#> Error in df[, select_vars, drop = FALSE]: incorrect number of dimensions

jrcalabrese avatar Dec 22 '21 17:12 jrcalabrese

There is no straightforward way to integrate latent profiles across imputed datasets, that's very much an open area of research. I would direct you to tidySEM, which can accommodate missing data through FIML (note that rows with all missing must still be deleted). The tidySEM function is mx_profiles(). It's less well documented than tidyLPA though.

cjvanlissa avatar Dec 22 '21 18:12 cjvanlissa

See also this discussion: http://www.statmodel.com/discussion/messages/13/21255.html?1537308155

cjvanlissa avatar Dec 22 '21 18:12 cjvanlissa