Learn R Programming

semTools (version 0.5-1)

lavTestWald.mi: Wald Test for Multiple Imputations

Description

Wald test for testing a linear hypothesis about the parameters of lavaan models fitted to multiple imputed data sets. Statistics for constraining one or more free parameters in a model can be calculated from the pooled point estimates and asymptotic covariance matrix of model parameters using Rubin's (1987) rules, or by pooling the Wald test statistics across imputed data sets (Li, Meng, Raghunathan, & Rubin, 1991).

Usage

lavTestWald.mi(object, constraints = NULL, test = c("D1", "D2"),
  asymptotic = FALSE, scale.W = FALSE, verbose = FALSE,
  warn = TRUE)

Arguments

object

An object of class '>lavaan.mi.

constraints

A character string (typically between single quotes) containing one or more equality constraints. See examples for more details

test

character indicating which pooling method to use. "D1" or "Rubin" (default) indicates Rubin's (1987) rules will be applied to the point estimates and the asymptotic covariance matrix of model parameters, and those pooled values will be used to calculate the Wald test in the usual manner. "D2", "LMRR", or "Li.et.al" indicate that the complete-data Wald test statistic should be calculated using each imputed data set, which will then be pooled across imputations, as described in Li, Meng, Raghunathan, & Rubin (1991) and Enders (2010, chapter 8).

asymptotic

logical. If FALSE (default), the pooled test will be returned as an F-distributed statistic with numerator (df1) and denominator (df2) degrees of freedom. If TRUE, the pooled F statistic will be multiplied by its df1 on the assumption that its df2 is sufficiently large enough that the statistic will be asymptotically \(\chi^2\) distributed with df1.

scale.W

logical. If FALSE (default), the pooled asymptotic covariance matrix of model parameters is calculated as the weighted sum of the within-imputation and between-imputation components. Otherwise, the pooled asymptotic covariance matrix of model parameters is calculated by scaling the within-imputation component by the average relative increase in variance (ARIV; see Enders, 2010, p. 235). Not recommended, and ignored (irrelevant) if test = "D2".

verbose

logical. If TRUE, print the restriction matrix and the estimated restricted values.

warn

logical. If TRUE, print warnings if they occur.

Value

A vector containing the Wald test statistic (either an F or \(\chi^2\) statistic, depending on the asymptotic argument), the degrees of freedom (numerator and denominator, if asymptotic = FALSE), and a p value.

Details

The constraints are specified using the "==" operator. Both the left-hand side and the right-hand side of the equality can contain a linear combination of model parameters, or a constant (like zero). The model parameters must be specified by their user-specified labels from the link[lavaan]{model.syntax}. Names of defined parameters (using the ":=" operator) can be included too.

References

Enders, C. K. (2010). Applied missing data analysis. New York, NY: Guilford.

Li, K.-H., Meng, X.-L., Raghunathan, T. E., & Rubin, D. B. (1991). Significance levels from repeated p-values with multiply-imputed data. Statistica Sinica, 1(1), 65--92. Retrieved from https://www.jstor.org/stable/24303994

Rubin, D. B. (1987). Multiple imputation for nonresponse in surveys. New York, NY: Wiley.

See Also

lavTestWald

Examples

Run this code
# NOT RUN {
 
# }
# NOT RUN {
## impose missing data for example
HSMiss <- HolzingerSwineford1939[ , c(paste("x", 1:9, sep = ""),
                                      "ageyr","agemo","school")]
set.seed(12345)
HSMiss$x5 <- ifelse(HSMiss$x5 <= quantile(HSMiss$x5, .3), NA, HSMiss$x5)
age <- HSMiss$ageyr + HSMiss$agemo/12
HSMiss$x9 <- ifelse(age <= quantile(age, .3), NA, HSMiss$x9)

## impute missing data
library(Amelia)
set.seed(12345)
HS.amelia <- amelia(HSMiss, m = 20, noms = "school", p2s = FALSE)
imps <- HS.amelia$imputations

## specify CFA model from lavaan's ?cfa help page
HS.model <- '
  visual  =~ x1 + b1*x2 + x3
  textual =~ x4 + b2*x5 + x6
  speed   =~ x7 + b3*x8 + x9
'

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

## Testing whether a single parameter equals zero yields the 'chi-square'
## version of the Wald z statistic from the summary() output, or the
## 'F' version of the t statistic from the summary() output, depending
## whether asymptotic = TRUE or FALSE
lavTestWald.mi(fit, constraints = "b1 == 0")      # default D1 statistic
lavTestWald.mi(fit, constraints = "b1 == 0", test = "D2") # D2 statistic

## The real advantage is simultaneously testing several equality
## constraints, or testing more complex constraints:
con <- '
   2*b1 == b3
   b2 - b3 == 0
'
lavTestWald.mi(fit, constraints = con) # default F statistic
lavTestWald.mi(fit, constraints = con, asymptotic = TRUE) # chi-squared

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab