LeonieHagitte / ShareSEM

0 stars 0 forks source link

render function #15

Closed LeonieHagitte closed 5 months ago

LeonieHagitte commented 7 months ago

its this repo https://github.com/jhorzek/mxsem

it enables the set up of the model in lavaan and then transforms it automatically- I tried it with the model of casp alone and that worked well! I will think about on how i code the predictors in a lavaan model - but would be thankful for ideas, if you know that out of stands @brandmaier ?

LeonieHagitte commented 7 months ago

like this would have been my thought?

casp_modmxsem <- '
  # Latent variables
  control  =~ cC1 + cC2 + cC3 
  autonomy =~ cA1 + cA2 + cA3
  pleasure =~ cP1 + cP2 + cP3
  self_real =~ cS1 + cS2 + cS3

  # Regression paths from predictors to latent variables
  control ~ b1*gender + b2*age
  autonomy ~ b3*gender + b4*age
  pleasure ~ b5*gender + b6*age
  self_real ~ b7*gender + b8*age
'
LeonieHagitte commented 7 months ago

i added a file https://github.com/LeonieHagitte/ShareSEM/blob/main/mxsem%20model.R where i tried to do it and it seems to run but i am not sure if i did it corectly @brandmaier

brandmaier commented 5 months ago

The package seems to be really useful! The code above, however, is not a MNLFA model but a classic MIMIC model, where there are latent variables (control, autonomy,...) with several indicators (cC, cA,...) and several predictors (gender, age).

I can see that you translated the entire MNLFA using mxsem syntax. Cool stuff. I will have a look!