Baseline model specification

59 views
Skip to first unread message

Leslie Rutkowski

unread,
Mar 2, 2021, 12:50:11 PM3/2/21
to lavaan
Hi all,

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:

Model 1: use "fixed.x = FALSE" command in sem() and only regression terms in model object gives:

Model Test User Model:
                                                      
  Test statistic                                11.107
  Degrees of freedom                             5
  P-value (Chi-square)                     0.049

Model Test Baseline Model:

  Test statistic                               165.608
  Degrees of freedom                               9
  P-value                                              0.000

model1@baseline$partable$ustart includes the exogenous covariance

Model 2: identical to Model 1 except explicitly include exogenous variance/covariance terms in model object gives: 

Model Test User Model:
                                                      
  Test statistic                                11.107
  Degrees of freedom                                 5
  P-value (Chi-square)                           0.049

Model Test Baseline Model:

  Test statistic                               165.944
  Degrees of freedom                                10
  P-value                                        0.000

model2@baseline$partable$ustart does not include the exogenous covariance

So, why is the exogenous covariance part of the baseline model in Model 1 but not in Model 2?

Thanks,
Leslie

Reproducible code follows:
# 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





Reply all
Reply to author
Forward
0 new messages