x<-read.csv("C:/Users/Quanying LU/Desktop/5.csv")
> co2model<-'
+ # measurement model
+ co2=~y1
+ total=~y2+y3+y4+y5+y6
+ struct=~y7+y8+y9+y10
+ # regressions
+ co2~total+struct
+ total~struct
+ # residual covariances
+ y2~~y3+y4+y5+y6+y7+y8+y9+y10
+ y3 ~~ y4+y7+y9
+ y5 ~~ y4+y7+y8+y9
+ y6 ~~ y4+y7+y8+y9
+ y7~~y4
+ '
> fit <- sem(co2model, data = x,meanstructure = "default",
+ conditional.x = "default", fixed.x = "default",
+ orthogonal = FALSE,
std.lv = FALSE,
+ parameterization = "default", std.ov = FALSE,
+ missing = "default", ordered = NULL,
+ sample.cov = NULL, sample.cov.rescale = "default",
+ sample.mean = NULL, sample.nobs = NULL,
+ ridge = 1e-05, group = NULL,
+ group.label = NULL, group.equal = "", group.partial = "",
+ group.w.free = FALSE, cluster = NULL, constraints = '',
+ estimator = "default", likelihood = "default", link = "default",
+ information = "default", se = "default", test = "default",
+ bootstrap = 1000L, mimic = "default", representation = "default",
+ do.fit = TRUE, control = list(), WLS.V = NULL, NACOV = NULL,
+ zero.add = "default", zero.keep.margins = "default",zero.cell.warn = TRUE,
+ start = "default", verbose = FALSE, warn = TRUE, debug = FALSE)
Warning messages:
1: In lav_object_post_check(lavobject) :
lavaan WARNING: some estimated variances are negative
2: In lav_object_post_check(lavobject) :
lavaan WARNING: covariance matrix of latent variables is not positive definite; use inspect(fit,"
cov.lv") to investigate.
3: In lav_object_post_check(lavobject) :
lavaan WARNING: observed variable error term matrix (theta) is not positive definite; use inspect(fit,"theta") to investigate.
> summary(fit, standardized = TRUE)
lavaan (0.5-20) converged normally after 444 iterations
Number of observations 27
Estimator ML
Minimum Function Test Statistic 71.870
Degrees of freedom 13
P-value (Chi-square) 0.000
Parameter Estimates:
Information Expected
Standard Errors Standard
Latent Variables:
Estimate Std.Err Z-value P(>|z|) Std.lv Std.all
co2 =~
y1 1.000 0.863 1.000
total =~
y2 1.000 0.744 0.974
y3 0.093 0.003 28.033 0.000 0.069 0.966
y4 1.544 0.040 38.915 0.000 1.149 0.974
y5 1.064 0.085 12.521 0.000 0.792 0.914
y6 0.655 0.041 16.166 0.000 0.487 0.952
struct =~
y7 1.000 0.244 0.998
y8 0.195 0.059 3.327 0.001 0.047 0.521
y9 2.784 0.079 35.086 0.000 0.679 0.991
y10 -1.060 0.058 -18.176 0.000 -0.259 -0.962
Regressions:
Estimate Std.Err Z-value P(>|z|) Std.lv Std.all
co2 ~
total 0.630 0.146 4.319 0.000 0.544 0.544
struct 1.571 0.449 3.497 0.000 0.444 0.444
total ~
struct 3.118 0.144 21.684 0.000 1.022 1.022
Covariances:
Estimate Std.Err Z-value P(>|z|) Std.lv Std.all
y2 ~~
y3 0.002 0.001 3.680 0.000 0.002 0.729
y4 0.038 0.009 4.221 0.000 0.038 0.832
y5 0.021 0.006 3.798 0.000 0.021 0.352
y6 0.009 0.002 3.519 0.000 0.009 0.318
y7 -0.004 0.001 -4.050 0.000 -0.004 -1.692
y8 -0.001 0.001 -1.265 0.206 -0.001 -0.072
y9 -0.004 0.001 -2.996 0.003 -0.004 -0.255
y10 -0.005 0.001 -3.929 0.000 -0.005 -0.366
y3 ~~
y4 0.004 0.001 3.921 0.000 0.004 0.855
y7 -0.000 0.000 -4.410 0.000 -0.000 -1.620
y9 0.000 0.000 2.653 0.008 0.000 0.282
y4 ~~
y5 0.028 0.009 3.162 0.002 0.028 0.299
y5 ~~
y7 -0.002 0.002 -1.547 0.122 -0.002 -0.485
y8 0.010 0.003 3.037 0.002 0.010 0.384
y9 -0.016 0.004 -3.668 0.000 -0.016 -0.503
y4 ~~
y6 0.007 0.003 2.539 0.011 0.007 0.172
y6 ~~
y7 -0.003 0.001 -3.317 0.001 -0.003 -1.159
y8 -0.009 0.002 -3.677 0.000 -0.009 -0.756
y9 -0.008 0.002 -3.574 0.000 -0.008 -0.583
y4 ~~
y7 -0.006 0.002 -4.079 0.000 -0.006 -1.731
Variances:
Estimate Std.Err Z-value P(>|z|) Std.lv Std.all
y1 0.000 0.000 0.000
y2 0.030 0.007 4.443 0.000 0.030 0.051
y3 0.000 0.000 3.899 0.000 0.000 0.066
y4 0.070 0.015 4.562 0.000 0.070 0.051
y5 0.123 0.030 4.082 0.000 0.123 0.164
y6 0.024 0.007 3.660 0.000 0.024 0.093
y7 0.000 0.000 1.878 0.060 0.000 0.003
y8 0.006 0.001 4.063 0.000 0.006 0.729
y9 0.009 0.002 4.547 0.000 0.009 0.019
y10 0.005 0.001 4.521 0.000 0.005 0.074
co2 0.011 0.004 2.870 0.004 0.014 0.014
total -0.024 0.007 -3.360 0.001 -0.044 -0.044
struct 0.059 0.016 3.662 0.000 1.000 1.000