Nested covariates in latent profile anaylsis


In preparation for project week, I was wondering if anyone knew how to control for covariates, especially multi-level nested covariates (like family and site in the ABCD dataset), when running a latent profile analysis (LPA) in R.

I saw that M-plus seems to allow for the inclusion of nested variables by adding TYPE=COMPLEX TWOLEVEL MIXTURE to the model. However, we were planning on using the tidyLPA R package rather than M-plus, or other proprietary software.

So we were wondering if it is possible to run a model like this in R? Additionally, could one possible work around be to: regress out the effects of covariates on input variables before hand and run the LPA on the residuals?

Thanks so much for your thoughts!