I'm wondering if I've run into a possible bug in how the baseline model is specified in lavaan. Or I don't understand the rationale for one option vs. the other. I include reproducible code below, however the fundamental issue is this:
So, why is the exogenous covariance part of the baseline model in Model 1 but not in Model 2?
# principles and practice of sem (4th ed.), rex kline
# recursive path model of illness, figure 7.5 (p. 159), table 4.2
library(lavaan)
# input the correlations in lower diagonal form
rothLower.cor <- '
1.00
-.03 1.00
.39 .07 1.00
-.05 -.23 -.13 1.00
-.08 -.16 -.29 .34 1.00 '
# name the variables and convert to full correlation matrix
rothFull.cor <- getCov(rothLower.cor, names = c("exercise","hardy","fitness",
"stress","illness"))
# display the correlations
rothFull.cor
# add the standard deviations and convert to covariances
rothFull.cov <- cor2cov(rothFull.cor, sds = c(66.50,38.00,18.40,33.50,62.48))
# path model 1 - fixed.x = FALSE
roth.model1 <- '
# regressions
illness ~ fitness + stress
fitness ~ exercise
stress ~ hardy'
reduced1 <- sem(roth.model1,
sample.cov=rothFull.cov,
sample.nobs=373, fixed.x = FALSE, sample.cov.rescale = FALSE)
summary(reduced1, fit.measures = TRUE, rsquare = TRUE)
parameterestimates(reduced1)
fitmeasures(reduced1, fit.measures = c("chisq", "df"))
reduced1@baseline$test$standard$stat
# path model 2 - fixed.x = FALSE & variance terms specified
roth.model2 <- '
# regressions
illness ~ fitness + stress
fitness ~ exercise
stress ~ hardy
exercise ~~ exercise
hardy ~~ hardy
exercise ~~ hardy'
reduced2 <- sem(roth.model2,
sample.cov=rothFull.cov,
sample.nobs=373, fixed.x = FALSE, sample.cov.rescale = FALSE)
summary(reduced2, fit.measures = TRUE, rsquare = TRUE)
parameterestimates(reduced2)
fitmeasures(reduced2, fit.measures = c("chisq", "df"))
reduced2@baseline$test$standard$stat