--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.
Hi Maria,
It might be helpful to share your script to see what you’re actually trying to do, but what you’ve described is certainly possible in lavaan. The link that Leslie provided for you is a good start. Currently lavaan will do probit regression not logistic regression for categorical endogenous variables (by default). But probit regression is fine to use and easy (maybe easier?) to interpret.
I’m not sure the extent that logistic regression has been implemented in lavaan, maybe there’s something more current than this https://groups.google.com/forum/#!topic/lavaan/zDcHbOnxdRg. From what I can see it’s still not implemented:
library(lavaan)
mydata <- read.csv("https://stats.idre.ucla.edu/stat/data/binary.csv")
mod <- "
admit ~ gre
"
fit <- sem(mod, data = mydata, link = "logit", ordered = "admit", estimator = "MML")
results in:
<0 x 0 matrix>
Error in lav_model_gradient_mml(lavmodel = lavmodel, GLIST = GLIST, THETA = THETA[[g]], :
logit link not implemented yet; use probit
In addition: Warning messages:
1: In lav_options_set(opt) :
lavaan WARNING: link will be set to “probit” for estimator = “MML”
2: In lav_model_lik_mml(lavmodel = lavmodel, THETA = THETA, TH = TH, :
lavaan WARNING: --- VETAx not positive definite
#Reached acceptable fit with latent variables, so I can use them in SEM
###########SEM#######################
structuralmodel2 <- 'Relevance =~ RELEVA1 + RELEVA2 + RELEVA3
Motivation =~ TSRQ1_1 + TSRQ3_1 + TSRQ6_1 + TSRQ8_1 + TSRQ12_1 + TSRQ14_1
Attitude_pro =~ Ap_CON_1 + Ap_UIT_1 + Ap_GEZ_1 + Ap_VB_1 + Ap_TEV_1 + Ap_SCH_1
Attitude_dis =~ Ac_ONT_1 + Ac_GEW_1 + Ac_VER_1 + Ac_SOM_1 + Ac_EEN_1 + Ac_ONZ_1
Social_norm =~ SNPART_1 + SNKIND_1 + SNVRIE_1
Social_support =~ SSPART_1 + SSKIND_1 + SSVRIE_1
Selfefficacy =~ SEKWAA_1 + SESOM_1 + SESTRE_1 + SEETEN_1 + SEKOFF_1 + SEPAUZ_1 + SEFEES_1 + SEAANB_1 + SEGEN_1
Intention =~ INTEN_2 + INTEN_1 + INTEN_3
Ap_CON_1 ~~ Ap_GEZ_1
SEAANB_1 ~~ SEGEN_1
SEETEN_1 ~~ SEKOFF_1
SEKWAA_1 ~~ SESOM_1
SEKWAA_1 ~~ SESTRE_1
TSRQ1_1 ~~ TSRQ3_1
SESOM_1 ~~ SESTRE_1
SEETEN_1 ~~ SEPAUZ_1
Relevance ~ Content + Frame + CTFT
Motivation ~ Relevance + Content + Frame + CTFT
Attitude_pro ~ Motivation
Attitude_dis ~ Motivation
Social_norm ~ Motivation
Social_support ~ Motivation
Selfefficacy ~ Motivation
Intention ~ Attitude_pro + Attitude_dis + Social_norm + Social_support
+ Selfefficacy + Motivation
PP_FU1 ~ Intention + Attitude_pro + Attitude_dis + Social_norm + Social_support
+ Selfefficacy + Motivation'
fit3 <- sem(structuralmodel2, data=data, estimator = "WLS", ordered = "PP_FU1")
summary (fit2, fit.measures = TRUE, standardized = TRUE)
Here I get an error message now: "Error in chol.default(S) :
the leading minor of order 265 is not positive definite"
I appreciate any help possible!
Thank you in advance,
Maria