1

我想从中提取误差协方差矩阵,sem()但我不知道我是否正确。我使用inspect("cov.ov")"cov.ov"在文档中说“模型隐含的方差-协方差矩阵”。那么这与误差协方差矩阵相同吗?代码如下:

# convert vector of correlations into matrix
   wisc4.cor <- lav_matrix_lower2full(c(1,0.72,1,0.64,0.63,1,0.51,0.48,0.37,1,0.37,0.38,0.38,0.38,1))
# enter the SDs
   wisc4.sd <- c(3.01 , 3.03 , 2.99 , 2.89 , 2.98)
# name the variables
   colnames(wisc4.cor) <- rownames(wisc4.cor) <- c("Information", "Similarities", "Word.Reasoning", "Matrix.Reasoning", "Picture.Concepts")
   names(wisc4.sd) <-  c("Information", "Similarities", "Word.Reasoning", "Matrix.Reasoning", "Picture.Concepts")
# convert correlations and SDs to covarainces
   wisc4.cov <- cor2cov(wisc4.cor,wisc4.sd)
# specify single factor model
   wisc4.model<-'
   g =~ a*Information + b*Similarities + c*Word.Reasoning + d*Matrix.Reasoning + e*Picture.Concepts
'
# fit model
   wisc4.fit <- sem(model=wisc4.model, sample.cov=wisc4.cov, sample.nobs=550,  std.lv=FALSE)
#does this extract the error covariance matrix?
   inspect(wisc4.fit, "cov.ov")
4

1 回答 1

1

你想要残差的 cov 矩阵:

residuals(wisc4.fit)$cov
于 2021-02-19T00:07:08.110 回答