Dear users,
I want to fit the estimates and intercepts of a path analyses model with the values I want, to check lately differences in the predicted values.
Fixing the estimates is not a problem, but how can I fix the intercepts? I tried several alternatives, and I have problems mainly with negatives.
Option a (with the negative values in parentheses and adding a + before, also doesnt work)
FixedGlobalMod <- '
M1 ~ 0.797*X-0.006
M2 ~ 0.008*X+0.291*M1-0.010
M3 ~ 0.344*M1 + 0.206*M2-0.005
Y ~ 0.215*M2+0.013*M3-0.013
'
fitFixedGlobalMod <-sem(FixedGlobalMod, data= TrueModelData, estimator= "ML", meanstructure=TRUE)
Error in lav_syntax_parse_rhs(rhs = rhs.formula[[2L]], op = op) :
lavaan ERROR: I'm confused parsing this line: -0.797 * X0.006
Option b (with the negative values in parentheses also donest work)
FixedGlobalMod <- '
#regressions
M1 ~ 0.797*X
M2 ~ 0.008*X+0.291*M1
M3 ~ 0.344*M1 + 0.206*M2
Y ~ 0.215*M2+0.013*M3
#intercepts
M1 ~ -0.006
M2 ~ -0.010
M3 ~ 0.005
Y ~ -0.013
'
fitFixedGlobalMod <-sem(FixedGlobalMod, data= TrueModelData, estimator= "ML", meanstructure=TRUE)
Error in lav_syntax_parse_rhs(rhs = rhs.formula[[2L]], op = op) :
lavaan ERROR: I'm confused parsing this line: -0.006
When intercepts are positives, it seems that there is no problem to fix it, but then the output says that intercept are zero, all of them
Option c, positive intercepts
FixedGlobalMod <- '
M1 ~ 0.797*X+0.006
M2 ~ 0.008*X+0.291*M1+0.010
M3 ~ 0.344*M1 + 0.206*M2+0.005
Y ~ 0.215*M2+0.013*M3+0.013
'
fitFixedGlobalMod <-sem(FixedGlobalMod, data= TrueModelData, estimator= "ML", meanstructure=TRUE)
lavaan 0.6-3 ended normally after 13 iterations
Optimization method NLMINB
Number of free parameters 4
Number of observations 10000
Estimator ML
Model Fit Test Statistic 2620.942
Degrees of freedom 14
P-value (Chi-square) 0.000
Parameter Estimates:
Information Expected
Information saturated (h1) model Structured
Standard Errors Standard
Regressions:
Estimate Std.Err z-value P(>|z|)
M1 ~
X 0.797
M2 ~
X 0.008
M1 0.291
M3 ~
M1 0.344
M2 0.206
Y ~
M2 0.215
M3 0.013
Intercepts:
Estimate Std.Err z-value P(>|z|)
.M1 0.000
.M2 0.000
.M3 0.000
.Y 0.000
Variances:
Estimate Std.Err z-value P(>|z|)
.M1 0.978 0.014 70.711 0.000
.M2 0.984 0.014 70.711 0.000
.M3 1.302 0.018 70.711 0.000
.Y 1.093 0.015 70.711 0.000
FixedGlobalMod <- '
#regressions
M1 ~ 0.797*X
M2 ~ 0.008*X+0.291*M1
M3 ~ 0.344*M1 + 0.206*M2
Y ~ 0.215*M2+0.013*M3
#intercepts
M1 ~ -0.006*1
M2 ~ -0.010*1
M3 ~ 0.005*1
Y ~ -0.013*1
'
fitFixedGlobalMod <-sem(FixedGlobalMod, data= TrueModelData, estimator= "ML", meanstructure=TRUE)
summary(fitFixedGlobalMod)
lavaan 0.6-3 ended normally after 13 iterations
Optimization method NLMINB
Number of free parameters 4
Number of observations 10000
Estimator ML
Model Fit Test Statistic 2617.776
Degrees of freedom 14
P-value (Chi-square) 0.000
Parameter Estimates:
Information Expected
Information saturated (h1) model Structured
Standard Errors Standard
Regressions:
Estimate Std.Err z-value P(>|z|)
M1 ~
X 0.797
M2 ~
X 0.008
M1 0.291
M3 ~
M1 0.344
M2 0.206
Y ~
M2 0.215
M3 0.013
Intercepts:
Estimate Std.Err z-value P(>|z|)
.M1 -0.006
.M2 -0.010
.M3 0.005
.Y -0.013
Variances:
Estimate Std.Err z-value P(>|z|)
.M1 0.978 0.014 70.711 0.000
.M2 0.984 0.014 70.711 0.000
.M3 1.302 0.018 70.711 0.000
.Y 1.093 0.015 70.711 0.000