lavTestScore.RdScore test (or Lagrange Multiplier test) for releasing one or more fixed or constrained parameters in model.
lavTestScore(object, add = NULL, release = NULL,
univariate = TRUE, cumulative = FALSE,
epc = FALSE, standardized = epc, cov.std = epc,
verbose = FALSE, warn = TRUE, information = "expected")An object of class lavaan.
Either a character string (typically between single quotes) or a parameter table containing additional (currently fixed-to-zero) parameters for which the score test must be computed.
Vector of Integers. The indices of the constraints that should be released. The indices correspond to the order of the equality constraints as they appear in the parameter table.
Logical. If TRUE, compute the univariate score
statistics, one for each constraints.
Logical. If TRUE, order the univariate score
statistics from large to small, and compute a series of
multivariate score statistics, each time adding an additional constraint.
Logical. If TRUE, and we are releasing existing constraints,
compute the expected parameter changes for the existing (free) parameters,
for each released constraint.
If TRUE, two extra columns (sepc.lv and sepc.all)
in the $epc table
will contain standardized values for the EPCs. In the first column (sepc.lv),
standardization is based on the variances of the (continuous) latent
variables. In the second column (sepc.all), standardization is based
on both the variances of both (continuous) observed and latent variables.
(Residual) covariances are standardized using (residual) variances.
Logical. See standardizedSolution.
Logical. Not used for now.
Logical. If TRUE, print out warnings if they occur.
character indicating the type of information matrix
to use (check lavInspect for available options). "expected"
information is the default, which provides better control of Type I errors.
This function can be used to compute both multivariate and univariate
score tests. There are two modes: 1) releasing fixed-to-zero parameters
(using the add argument), and 2) releasing existing equality
constraints (using the release argument). The two modes can not
be used simultaneously.
When adding new parameters, they should not already be part of the model (i.e. not listed in the parameter table). If you want to test for a parameter that was explicitly fixed to a constant (say to zero), it is better to label the parameter, and use an explicit equality constraint.
A list containing at least one data.frame:
$test: The total score test, with columns for the score
test statistic (X2), the degrees of freedom (df), and
a p value under the \(\chi^2\) distribution (p.value).
$uni: Optional (if univariate=TRUE).
Each 1-df score test, equivalent to modification indices.
If epc=TRUE when adding parameters (not when releasing
constraints), an unstandardized EPC is provided for each added parameter,
as would be returned by modificationIndices.
$cumulative: Optional (if cumulative=TRUE).
Cumulative score tests.
$epc: Optional (if epc=TRUE). Parameter estimates,
expected parameter changes, and expected parameter values if all
the tested constraints were freed.
Bentler, P. M., & Chou, C. P. (1993). Some new covariance structure model improvement statistics. Sage Focus Editions, 154, 235-255.
HS.model <- '
visual =~ x1 + b1*x2 + x3
textual =~ x4 + b2*x5 + x6
speed =~ x7 + b3*x8 + x9
b1 == b2
b2 == b3
'
fit <- cfa(HS.model, data=HolzingerSwineford1939)
# test 1: release both two equality constraints
lavTestScore(fit, cumulative = TRUE)
#> $test
#>
#> total score test:
#>
#> test X2 df p.value
#> 1 score 12.306 2 0.002
#>
#> $uni
#>
#> univariate score tests:
#>
#> lhs op rhs X2 df p.value
#> 1 b1 == b2 12.060 1 0.001
#> 2 b2 == b3 0.947 1 0.330
#>
#> $cumulative
#>
#> cumulative score tests:
#>
#> lhs op rhs X2 df p.value
#> 1 b1 == b2 12.060 1 0.001
#> 2 b2 == b3 12.306 2 0.002
#>
# test 2: the score test for adding two (currently fixed
# to zero) cross-loadings
newpar = '
visual =~ x9
textual =~ x3
'
lavTestScore(fit, add = newpar)
#> $test
#>
#> total score test:
#>
#> test X2 df p.value
#> 1 score 46.061 2 0
#>
#> $uni
#>
#> univariate score tests:
#>
#> lhs op rhs X2 df p.value
#> 1 visual=~x9 == 0 35.117 1 0.000
#> 2 textual=~x3 == 0 10.938 1 0.001
#>
# equivalently, "add" can be a parameter table specifying parameters to free,
# but must include some additional information:
PT.add <- data.frame(lhs = c("visual","textual"),
op = c("=~","=~"),
rhs = c("x9","x3"),
user = 10L, # needed to identify new parameters
free = 1, # arbitrary numbers > 0
start = 0) # null-hypothesized value
PT.add
#> lhs op rhs user free start
#> 1 visual =~ x9 10 1 0
#> 2 textual =~ x3 10 1 0
lavTestScore(fit, add = PT.add) # same result as above
#> $test
#>
#> total score test:
#>
#> test X2 df p.value
#> 1 score 46.061 2 0
#>
#> $uni
#>
#> univariate score tests:
#>
#> lhs op rhs X2 df p.value
#> 1 visual=~x9 == 0 35.117 1 0.000
#> 2 textual=~x3 == 0 10.938 1 0.001
#>