data-edu / tidyLPA

Easily carry out Latent Profile Analysis (LPA) using open-source or commercial software
https://data-edu.github.io/tidyLPA/
Other
56 stars 17 forks source link

Variable names for variables 10, 11, 12... #158

Closed Roy-Levy closed 4 years ago

Roy-Levy commented 4 years ago

I am running a model with 13 observed variables and 4 classes in Mplus. My code is:

fitted.model<- data.for.analysis %>% estimate_profiles( n_profiles=4, models=2,
package = "MplusAutomation", DEFINE = "STANDARDIZE X1-X13;", keepfiles=TRUE
)

When I extract the parameter estimates, I noticed that the variable names for the 10th-13th variables do not match the variable names of the raw data. The 10th variable name appears to be the name of the first variable with a '0' appended. The 11th variable name appears to be the name of the first variable with a '1' appended.

Here are the names of my variables in the raw data: colnames(data.for.analysis) [1] "NBAA" "NBVA" "CeNmUp_I" "DgSpnW_I" "DgSpnR_I" "PlNWWW" "LcSpnW_I" "LcSpnR_I" "VsSpnW_I" "VsSpnR_I" [11] "BndPBSW" "BndVBW" "BndCmBW"

And here are the names of my variables in the estimated parameters (in the column called 'Parameter'): [1] "NBAA" "NBVA" "CeNmUp_I" "DgSpnW_I" "DgSpnR_I" "PlNWWW" "LcSpnW_I" "LcSpnR_I" "VsSpnW_I" "NBAA0"
[11] "NBAA1" "NBAA2" "NBAA3"

Notice that the 10th variable name is "NBAA0", the 11th is "NBAA1" and so on.

cjvanlissa commented 4 years ago

Gotcha. I'll fix this. Meanwhile, the results should be fine, but as you discovered, the labels are wrong.

cjvanlissa commented 4 years ago

This should be fixed in the latest version on my github; can you try to run:

devtools::install_github("cjvanlissa/tidyLPA")

And then re-run your code? You can replace DEFINE = "STANDARDIZE X1-X13;", with DEFINE = "STANDARDIZE NBAA-VsSpnR_I;"

Roy-Levy commented 4 years ago

Thanks for the fix. And my compliments on a fine R package.

jrosen48 commented 4 years ago

okay to close this?