Lavaan Problem in R

I tried to run below scripts but failed to get the figures for

Model Test User Model:
Model Test Baseline Model:
User Model versus Baseline Model:
Loglikelihood and Information Criteria:
Root Mean Square Error of Approximation:
Standardized Root Mean Square Residual:
Parameter Estimates:

--------------------R Script------------------------------
library(lavaan)

HS.model <- ’ visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 ’

fit <- cfa(HS.model, data=HolzingerSwineford1939)

summary(fit, fit.measures=TRUE)
----------------------END---------------------------------

Anyone can give me some advises?

library(lavaan)
#> This is lavaan 0.6-5
#> lavaan is BETA software! Please report any bugs.
# next line has to have both open AND close quote plain ' marks (not curly)
HS.model <- 'visual =~ x1 + x2 + x3' 
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 # no quote mark here

fit <- cfa(HS.model, data=HolzingerSwineford1939)

summary(fit, fit.measures=TRUE)
#> lavaan 0.6-5 ended normally after 23 iterations
#> 
#>   Estimator                                         ML
#>   Optimization method                           NLMINB
#>   Number of free parameters                          6
#>                                                       
#>   Number of observations                           301
#>                                                       
#> Model Test User Model:
#>                                                       
#>   Test statistic                                 0.000
#>   Degrees of freedom                                 0
#> 
#> Model Test Baseline Model:
#> 
#>   Test statistic                               111.271
#>   Degrees of freedom                                 3
#>   P-value                                        0.000
#> 
#> User Model versus Baseline Model:
#> 
#>   Comparative Fit Index (CFI)                    1.000
#>   Tucker-Lewis Index (TLI)                       1.000
#> 
#> Loglikelihood and Information Criteria:
#> 
#>   Loglikelihood user model (H0)              -1356.977
#>   Loglikelihood unrestricted model (H1)      -1356.977
#>                                                       
#>   Akaike (AIC)                                2725.955
#>   Bayesian (BIC)                              2748.197
#>   Sample-size adjusted Bayesian (BIC)         2729.169
#> 
#> Root Mean Square Error of Approximation:
#> 
#>   RMSEA                                          0.000
#>   90 Percent confidence interval - lower         0.000
#>   90 Percent confidence interval - upper         0.000
#>   P-value RMSEA <= 0.05                             NA
#> 
#> Standardized Root Mean Square Residual:
#> 
#>   SRMR                                           0.000
#> 
#> Parameter Estimates:
#> 
#>   Information                                 Expected
#>   Information saturated (h1) model          Structured
#>   Standard errors                             Standard
#> 
#> Latent Variables:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>   visual =~                                           
#>     x1                1.000                           
#>     x2                0.778    0.141    5.532    0.000
#>     x3                1.107    0.214    5.173    0.000
#> 
#> Variances:
#>                    Estimate  Std.Err  z-value  P(>|z|)
#>    .x1                0.835    0.118    7.064    0.000
#>    .x2                1.065    0.105   10.177    0.000
#>    .x3                0.633    0.129    4.899    0.000
#>     visual            0.524    0.130    4.021    0.000

Created on 2020-04-09 by the reprex package (v0.3.0)

Thank you very much for your help!

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.