Hi all,
I am a bit confused about how to tell lavaan "don't include the covariance between two exogenous variables" ...
Because the two exogenous variables were manipulated by me, they should not, and they cannot have any correlation...
I tried fixed.x = T or F, they give me the same results. the degree of freedom didn't change...
It seems a very simple model C ~ A + B cannot be tested in lavaan.
Please see the coding sample, if I made any mistake there.
> A = runif(100, min = 1, max = 100)
> B = runif(100, min = 1, max = 100)
> error = runif(100, min = 1, max = 10)
> C = A + B + error
> test <- data.frame(A, B, C)
> mod <- 'C ~ A + B'
> mod.fit <- sem(mod, data = test, fixed.x = T)
> summary(mod.fit, standardized = T, rsq = T)
lavaan (0.5-16) converged normally after 1 iterations
Number of observations 100
Estimator ML
Minimum Function Test Statistic 0.000
Degrees of freedom 0
P-value (Chi-square) 1.000
Parameter estimates:
Information Expected
Standard Errors Standard
Estimate Std.err Z-value P(>|z|) Std.lv Std.all
Regressions:
C ~
A 1.011 0.010 100.961 0.000 1.011 0.637
B 1.022 0.009 111.062 0.000 1.022 0.701
Variances:
C 7.126 1.008 7.126 0.004
R-Square:
C 0.996
> mod.fit <- sem(mod, data = test, fixed.x = F)
> summary(mod.fit, standardized = T, rsq = T)
lavaan (0.5-16) converged normally after 53 iterations
Number of observations 100
Estimator ML
Minimum Function Test Statistic 0.000
Degrees of freedom 0
P-value (Chi-square) 0.000
Parameter estimates:
Information Expected
Standard Errors Standard
Estimate Std.err Z-value P(>|z|) Std.lv Std.all
Regressions:
C ~
A 1.011 0.010 100.961 0.000 1.011 0.637
B 1.022 0.009 111.062 0.000 1.022 0.701
Covariances:
A ~~
B 86.296 78.777 1.095 0.273 86.296 0.110
Variances:
C 7.126 1.008 7.126 0.004
A 719.041 101.688 719.041 1.000
B 852.701 120.590 852.701 1.000
R-Square:
C 0.996