lavTestWald.mi | R Documentation |
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).
lavTestWald.mi(object, constraints = NULL, test = c("D1", "D2"), asymptotic = FALSE, scale.W = !asymptotic, omit.imps = c("no.conv", "no.se"), verbose = FALSE, warn = TRUE)
object |
An object of class |
constraints |
A |
test |
|
asymptotic |
|
scale.W |
|
omit.imps |
|
verbose |
|
warn |
|
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.
A vector containing the Wald test statistic (either an F
or
χ^2 statistic, depending on the asymptotic
argument),
the degrees of freedom (numerator and denominator, if
asymptotic = FALSE
), and a p value. If
asymptotic = FALSE
, the relative invrease in variance (RIV, or
average for multiparameter tests: ARIV) used to calculate the denominator
df is also returned as a missing-data diagnostic, along with the
fraction missing information (FMI = ARIV / (1 + ARIV)).
Terrence D. Jorgensen (University of Amsterdam; TJorgensen314@gmail.com)
Adapted from lavaan source code, written by Yves Rosseel (Ghent University; Yves.Rosseel@UGent.be)
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.
lavTestWald
## 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 ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.