Test of exact fit
lavTest.RdCompute a variety of test statistics evaluating the global fit of the model.
Usage
lavTest(lavobject, test = "standard", scaled_test = "standard",
output = "list", drop_list_single = TRUE, ...)Arguments
- lavobject
An object of class
lavaan.- test
Character vector. Multiple names of test statistics can be provided. If
"standard"is included, a conventional chi-square test is computed. If"Browne.residual.adf"is included, Browne's residual-based test statistic using ADF theory is computed. If"Browne.residual.nt"is included, Browne's residual-based test statistic using normal theory is computed. If"Satorra.Bentler"is included, a Satorra-Bentler scaled test statistic is computed. If"Yuan.Bentler"is included, a Yuan-Bentler scaled test statistic is computed. If"Yuan.Bentler.Mplus"is included, a test statistic is computed that is asymptotically equivalent to the Yuan-Bentler scaled test statistic. If"mean.var.adjusted"or"Satterthwaite"is included, a mean and variance adjusted test statistic is computed. If"scaled.shifted"is included, an alternative mean and variance adjusted test statistic is computed (as in Mplus version 6 or higher). If"mean.var.adjusted.corrected"(aliases:"mvc","hayakawa") or"scaled.shifted.corrected"(alias:"ssc") is included, the corresponding test statistic is computed with the corrected (unbiased) estimator of the trace of the squared UGamma matrix (Hayakawa, 2018), which remains accurate when the number of observed variables is large relative to the sample size (where the naive estimator is severely biased, and the uncorrected adjusted tests underreject). These corrected tests are only available for single-group, single-level, complete, continuous data andestimator = "ML". Following Hayakawa (2018), they are best combined withscaled_test = "RLS". If"boot"or"bootstrap"or"Bollen.Stine"is included, the Bollen-Stine bootstrap is used to compute the bootstrap probability value of the (regular) test statistic. FMG p-value tests can be requested using names such as"peba4","pols3","pall", or"all". The convenience value"fmg"resolves to"peba4_rls"for one-model tests. Suffixless FMG names use the standard ML chi-square statistic by default; setscaled_test = "Browne.residual.nt.model"orscaled_test = "RLS"to use the Browne residual normal-theory model-based statistic. Suffixes such as"_ml","_rls", and"_ug"can be used for explicit control, for example"peba4_ug_rls"or"pols3_ml".- scaled_test
Character. Choose the test statistic that will be scaled (if a scaled test statistic is requested). The default is
"standard", but it could also be (for example)"Browne.residual.nt".- output
Character. If
"list"(the default), return a list with all test statistics. If"text", display the output as text with verbose descriptions (as in the summary output). If any scaled test statistics are included, they are printed first in a two-column format, followed by the remaining test statistics in a one-column format.- drop_list_single
Logical. Only used when
output = "list". IfTRUEand the list is of length one (i.e. only a single test statistic), drop the outer list. IfFALSE, return a nested list with one element per test statistic.- ...
To support old argument names.
Value
If output = "list": a nested list with test statistics, or if
only a single test statistic is requested (and
drop_list_single = TRUE), a list with details for this test
statistic. If output = "text": the text is printed, and a
nested list of test statistics (including an info attribute) is
returned.
References
Hayakawa, K. (2019). Corrected goodness-of-fit test in covariance structure analysis. Psychological Methods, 24(3), 371–389. doi:10.1037/met0000180
Himeno, T., & Yamada, T. (2014). Estimations for some functions of covariance matrix in high dimension under non-normality and its applications. Journal of Multivariate Analysis, 130, 27–44.
Srivastava, M. S. (2005). Some tests concerning the covariance matrix in high dimensional data. Journal of the Japan Statistical Society, 35(2), 251–272.
Examples
HS.model <- '
visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9
'
fit <- cfa(HS.model, data = HolzingerSwineford1939)
lavTest(fit, test = "browne.residual.adf")
#> $standard
#> $standard$test
#> [1] "standard"
#>
#> $standard$stat
#> [1] 85.30552
#>
#> $standard$stat.group
#> [1] 85.30552
#>
#> $standard$df
#> [1] 24
#>
#> $standard$refdistr
#> [1] "chisq"
#>
#> $standard$pvalue
#> [1] 8.502553e-09
#>
#>
#> $browne.residual.adf
#> $browne.residual.adf$test
#> [1] "browne.residual.adf"
#>
#> $browne.residual.adf$stat
#> [1] 82.40815
#>
#> $browne.residual.adf$stat.group
#> [1] 82.40815
#>
#> $browne.residual.adf$df
#> [1] 24
#>
#> $browne.residual.adf$refdistr
#> [1] "chisq"
#>
#> $browne.residual.adf$pvalue
#> [1] 2.503571e-08
#>
#> $browne.residual.adf$label
#> [1] "Browne's residual-based (ADF) test"
#>
#>
lavTest(fit, test = "peba4", output = "text")
#> Model Test User Model:
#>
#> Test statistic 85.306
#> Degrees of freedom 24
#> P-value (Chi-square) 0.000
#>
#> pEBA-4 p-value test (base: ML, gamma: biased)
#> Test statistic 77.276
#> Degrees of freedom 24
#> P-value (Chi-square) 0.000
lavTest(fit, test = "pols3", scaled_test = "RLS", output = "text")
#> Model Test User Model:
#>
#> Test statistic 85.306
#> Degrees of freedom 24
#> P-value (Chi-square) 0.000
#>
#> Browne's residual (NT model-based) test
#> Test statistic 81.368
#> Degrees of freedom 24
#> P-value (Chi-square) 0.000
#>
#> pOLS-3 p-value test (base: RLS, gamma: biased)
#> Test statistic 75.530
#> Degrees of freedom 24
#> P-value (Chi-square) 0.000
# corrected adjusted test (Hayakawa, 2018), based on the RLS statistic
lavTest(fit, test = "mean.var.adjusted.corrected", scaled_test = "RLS",
output = "text")
#> Model Test User Model:
#> Standard Scaled
#> Browne's residual (NT model-based) test
#> Test Statistic 81.368 76.251
#> Degrees of freedom 24 23.803
#> P-value (Chi-square) 0.000 0.000
#> Scaling correction factor 1.067
#> mean and variance adjusted correction (corrected trace)
#>
#> Test statistic 85.306
#> Degrees of freedom 24
#> P-value (Chi-square) 0.000