semTools (version 0.5-2)

calculate.D2: Calculate the "D2" statistic

Description

This is a utility function used to calculate the "D2" statistic for pooling test statistics across multiple imputations. This function is called by several functions used for '>lavaan.mi objects, such as lavTestLRT.mi, lavTestWald.mi, and lavTestScore.mi. But this function can be used for any general scenario because it only requires a vector of \(\chi^2\) statistics (one from each imputation) and the degrees of freedom for the test statistic. See Li, Meng, Raghunathan, & Rubin (1991) and Enders (2010, chapter 8) for details about how it is calculated.

Usage

calculate.D2(w, DF = 0L, asymptotic = FALSE)

Arguments

w

numeric vector of Wald \(\chi^2\) statistics. Can also be Wald z statistics, which will be internally squared to make \(\chi^2\) statistics with one df (must set DF = 0L).

DF

degrees of freedom (df) of the \(\chi^2\) statistics. If DF = 0L (default), w is assumed to contain z statistics, which will be internally squared.

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.

Value

A numeric vector containing the test statistic, df, its p value, and 2 missing-data diagnostics: the relative invrease in variance (RIV, or average for multiparameter tests: ARIV) and the fraction missing information (FMI = ARIV / (1 + ARIV)).

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

See Also

lavTestLRT.mi, lavTestWald.mi, lavTestScore.mi

Examples

Run this code
# NOT RUN {
## generate a vector of chi-squared values, just for example
DF <- 3 # degrees of freedom
M <- 20 # number of imputations
CHI <- rchisq(M, DF)

## pool the "results"
calculate.D2(CHI, DF) # by default, an F statistic is returned
calculate.D2(CHI, DF, asymptotic = TRUE) # asymptotically chi-squared

## generate standard-normal values, for an example of Wald z tests
Z <- rnorm(M)
calculate.D2(Z) # default DF = 0 will square Z to make chisq(DF = 1)
## F test is equivalent to a t test with the denominator DF


# }

Run the code above in your browser using DataLab