sem-in-r / seminr

Natural feeling domain-specific language for building structural equation models in R for estimation by covariance-based methods (like LISREL/Lavaan) or partial least squares (like SmartPLS)
58 stars 19 forks source link

how to get the latent variable scores #218

Closed maoyimin closed 3 years ago

maoyimin commented 3 years ago

Sometimes, we need to get the latent variable scores and use them in the subsequent analysis. It can be easily achieved in the Smartpls, but I can not find the relative functions in Seminr.

soumyaray commented 3 years ago

Thank you @maoyimin for using SEMinR! You can get construct scores quite easily from your estimated model object:

pls_model <- estimate_pls(...)
pls_model$construct_scores  # <- this gives you a dataframe of construct scores

# you can also make a nice scatterplot of scores from a pair of constructs!
plot(pls_model$construct_scores[, c("CONSTRUCT1", "CONSTRUCT2")])

Do let us know if the above works. If the above does not work for you, for any reason, could you kindly share the code for your model (you may rename constructs to keep the theory confidential)?

soumyaray commented 3 years ago

@maoyimin does the above response solve your issue? I'll close this issue for now but feel free to reply or reopen it if it does not address your concern.

MohammedAlrezq commented 8 months ago

@soumyaray, I do have a follow-up question about the latent variable scores in seminr (for PLS-SEM). I could only obtain the standardized scores but I wonder if there is a way to get unstandardized scores too?

soumyaray commented 7 months ago

Hi! Can I ask what you would like to do with the unstandardized score? And how complex is your model? For simple models we have a routine (not yet made public) that can do the trick. You can find the function at: https://github.com/sem-in-r/seminr/blob/unstandardize/R/unstandardize.R

You may try to copy/paste the function into your R console and then run it (it requires passing in an estimated SEMinR model object). It will likely not work if you have higher order constructs or other complications.

MohammedAlrezq commented 7 months ago

Hi Thanks for your prompt response. I would like to do a further analysis based on the latent scores from PLS-SEM. More specifically, I want to use the scores to perform a necessary condition analysis. The model is not that complex, it includes IVs and DVs with no higher order constructs or mediating variables. Thank you very much for sharing the link. I will check it out

MuthukumaraswamyDPK commented 6 months ago

@soumyaray I am working with Categorical data and dummy variables for PLS-SEM analysis. I want to carry out an NCA for the Dependent variable and the independent variables of my reflective constructs and structural model to find the bottlenecks. I am unable to access the latent score which is a reflective construct of 4 categorical indicators. Any hint and support in this would be highly appreciated.

MuthukumaraswamyDPK commented 6 months ago

Hi Thanks for your prompt response. I would like to do a further analysis based on the latent scores from PLS-SEM. More specifically, I want to use the scores to perform a necessary condition analysis. The model is not that complex, it includes IVs and DVs with no higher order constructs or mediating variables. Thank you very much for sharing the link. I will check it out

@MohammedAlrezq Could you please share your experience and the method that you employed to carry out an NCA after PLS-SEM predict. How did you get the latent score? How did you interpret the results? I would appreciate if you could share your method and learning.