Hi all,
My question is in regards to estimation of covariances for exogenous variables in a path model. I am trying to estimate the following model below:
I noticed that unlike an SEM with latent variables, lavaan does not appear to automatically estimate a covariance between my exogenous variables when running a path analysis with observed variables. Since I normally see path diagrams include covariances between exogenous variables, I went ahead and wrote that into the code as can be seen below (NM_Density~~NR_Density):
DNT.second.order.PATH <- '
#Regressions
Per_org_supp ~ a1*NM_Density + Gender + Education + Age
Job_Satisfaction ~ b1*NM_Density + Gender + Education + Age
Work_Goal_Satisfaction ~ c1*NM_Density + Gender + Education + Age
Burnout ~ d1*NR_Density + Gender + Education + Age
Turnover_Intentions ~ e1*NR_Density + Gender + Education + Age
Conflict_Culture ~ f1*NR_Density + Gender + Education + Age
NM_Density~~NR_Density'
set.seed(62973)
fDNT.second.order.PATH <- cfa(DNT.second.order.PATH,data=d_,se="robust.sem", estimator = 'MLM', bootstrap=2000)
To my surprise, I received the following error message. Yet, when I deleted the code for the covariance (NM_Density~~NR_Density), my model ran just fine.
Warning message:
In lav_partable_vnames(FLAT, "ov.x", warn = TRUE) : lavaan WARNING:
model syntax contains variance/covariance/intercept formulas
involving (an) exogenous variable(s): [NM_Density NR_Density];
These variables will now be treated as random introducing
additional free parameters. If you wish to treat those variables
as fixed, remove these formulas from the model syntax. Otherwise,
consider adding the fixed.x = FALSE option.
However, to my surprise, when I ran the model again, this time without the control variables (code below), I did not receive this error message, and Lavaan appeared to be able to estimate the covariance parameter. Does anyone have any insight that would help me make sense of this? I think ideally I'd like to have the model run with both my control variables and while also estimating the exogenous variable covariance; yet that currently seems not possible. Thank you!!!
DNT.second.order.PATH.2 <- '
#Regressions
Per_org_supp ~ a1*NM_Density
Job_Satisfaction ~ b1*NM_Density
Work_Goal_Satisfaction ~ c1*NM_Density
Burnout ~ d1*NR_Density
Turnover_Intentions ~ e1*NR_Density
Conflict_Culture ~ f1*NR_Density
NM_Density~~NR_Density'
set.seed(62973)
fDNT.second.order.PATH.2 <- cfa(DNT.second.order.PATH.2,data=d_,se="robust.sem", estimator = 'MLM', bootstrap=2000)