0

我是 R 新手,当我在“sem”模型上使用摘要时,我有以下输出。然而,在网上关于 R 的大多数论述中,我在第一行下方发现了一个 RMSEA 指数和其他拟合优度指数。为什么我没有看到他们?我需要启用一些库或下载一些包吗?

Sem 的 R 输出

4

1 回答 1

4

像这样使用 opt 。

opt <- options(fit.indices = c("GFI", "AGFI", "RMSEA", "NFI", "NNFI", "CFI", "RNI", "IFI", "SRMR", "AIC", "AICc", "BIC", "CAIC"))

例子

library(sem)
# The following examples use file input and may be executed via example():

etc <- file.path(.path.package(package="sem")[1], "etc") # path to data and model files

#   to get all fit indices (not recommended, but for illustration):

opt <- options(fit.indices = c("GFI", "AGFI", "RMSEA", "NFI", "NNFI", "CFI", "RNI", "IFI", "SRMR", "AIC", "AICc", "BIC", "CAIC"))

# ------------- Duncan, Haller and Portes peer-influences model ----------------------
# A nonrecursive SEM with unobserved endogenous variables and fixed exogenous variables

(R.DHP <- readMoments(file=file.path(etc, "R-DHP.txt"),
                diag=FALSE, names=c("ROccAsp", "REdAsp", "FOccAsp", 
                "FEdAsp", "RParAsp", "RIQ", "RSES", "FSES", "FIQ", "FParAsp")))
(model.dhp <- specifyModel(file=file.path(etc, "model-DHP.txt")))
sem.dhp.1 <- sem(model.dhp, R.DHP, 329,
    fixed.x=c('RParAsp', 'RIQ', 'RSES', 'FSES', 'FIQ', 'FParAsp'))
summary(sem.dhp.1)

输出

 Model Chisquare =  26.69722   Df =  15 Pr(>Chisq) = 0.03130238
 Goodness-of-fit index =  0.984387
 Adjusted goodness-of-fit index =  0.9427525
 RMSEA index =  0.04875944   90% CI: (0.01451664, 0.07830923)
 Bentler-Bonett NFI =  0.969384
 Tucker-Lewis NNFI =  0.9575676
 Bentler CFI =  0.9858559
 Bentler RNI =  0.9858559
 Bollen IFI =  0.986351
 SRMR =  0.02020441
 AIC =  64.69722
 AICc =  29.15676
 BIC =  -60.24365
 CAIC =  -75.24365

 Normalized Residuals
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
-0.79950 -0.11780  0.00000 -0.01201  0.03974  1.56500 

 R-square for Endogenous Variables
RGenAsp FGenAsp ROccAsp  REdAsp FOccAsp  FEdAsp 
 0.5220  0.6170  0.5879  0.6639  0.6888  0.5954 

 Parameter Estimates
           Estimate    Std Error  z value    Pr(>|z|)                         
gam11       0.16122243 0.03879229  4.1560429 3.238070e-05 RGenAsp <--- RParAsp
gam12       0.24964929 0.04398092  5.6763087 1.376323e-08 RGenAsp <--- RIQ    
gam13       0.21840307 0.04419737  4.9415399 7.750795e-07 RGenAsp <--- RSES   
gam14       0.07183948 0.04970692  1.4452610 1.483846e-01 RGenAsp <--- FSES   
gam23       0.06188722 0.05171967  1.1965895 2.314666e-01 FGenAsp <--- RSES   
gam24       0.22886655 0.04416219  5.1824090 2.190383e-07 FGenAsp <--- FSES   
gam25       0.34903584 0.04528981  7.7067195 1.290931e-14 FGenAsp <--- FIQ    
gam26       0.15953378 0.03882594  4.1089486 3.974645e-05 FGenAsp <--- FParAsp
beta12      0.18423260 0.09488782  1.9415832 5.218758e-02 RGenAsp <--- FGenAsp
beta21      0.23547774 0.11938936  1.9723511 4.856954e-02 FGenAsp <--- RGenAsp
lam21       1.06267796 0.09013868 11.7893663 4.428606e-32 REdAsp <--- RGenAsp 
lam42       0.92972549 0.07028107 13.2286762 5.993366e-40 FEdAsp <--- FGenAsp 
ps12       -0.02260953 0.05119394 -0.4416447 6.587463e-01 FGenAsp <--> RGenAsp
V[RGenAsp]  0.28098701 0.04623153  6.0778220 1.218259e-09 RGenAsp <--> RGenAsp
V[FGenAsp]  0.26383553 0.04466689  5.9067359 3.489525e-09 FGenAsp <--> FGenAsp
V[ROccAsp]  0.41214545 0.05122465  8.0458422 8.565431e-16 ROccAsp <--> ROccAsp
V[REdAsp]   0.33614511 0.05209992  6.4519310 1.104339e-10 REdAsp <--> REdAsp  
V[FOccAsp]  0.31119482 0.04592713  6.7758385 1.236867e-11 FOccAsp <--> FOccAsp
V[FEdAsp]   0.40460363 0.04618437  8.7606177 1.941833e-18 FEdAsp <--> FEdAsp  

 Iterations =  32 
于 2013-02-16T12:38:10.583 回答