jtextor / dagitty

Graphical analysis of structural causal models / graphical causal models.
GNU General Public License v2.0
255 stars 47 forks source link

issue with lavaanToGraph with parameters fixed to 0 #66

Open mrhemtulla opened 1 year ago

mrhemtulla commented 1 year ago

If a parameter is fixed to zero in lavaan by specifying the parameter and fixing it with 0*, lavaanToGraph reads that as though the parameter is estimated, and the independence is not coded. Example:

Sigma <- matrix(c(1, .5, .5, .5, 1, .5, .5, .5, 1), 3, 3)
colnames(Sigma) <- c("X", "M", "Y")
Model <- 'Y ~ M
          M ~ X
          X ~ 0*Y'

fitModel <- sem(model = Model, sample.cov = Sigma, sample.nobs = 100)
param <- parameterEstimates(fitModel)
dag <- lavaanToGraph(param)
plot(dag)