The D3-statistic is a likelihood-ratio test statistic.

## Arguments

- fit1
An object of class

`mira`

, produced by`with()`

.- fit0
An object of class

`mira`

, produced by`with()`

. The model in`fit0`

is a nested within`fit1`

. The default null model`fit0 = NULL`

compares`fit1`

to the intercept-only model.- dfcom
A single number denoting the complete-data degrees of freedom of model

`fit1`

. If not specified, it is set equal to`df.residual`

of model`fit1`

. If that cannot be done, the procedure assumes (perhaps incorrectly) a large sample.- df.com
Deprecated

## Details

The `D3()`

function implement the LR-method by
Meng and Rubin (1992). The implementation of the method relies
on the `broom`

package, the standard `update`

mechanism
for statistical models in `R`

and the `offset`

function.

The function calculates `m`

repetitions of the full
(or null) models, calculates the mean of the estimates of the
(fixed) parameter coefficients \(\beta\). For each imputed
imputed dataset, it calculates the likelihood for the model with
the parameters constrained to \(\beta\).

The `mitml::testModels()`

function offers similar functionality
for a subset of statistical models. Results of `mice::D3()`

and
`mitml::testModels()`

differ in multilevel models because the
`testModels()`

also constrains the variance components parameters.
For more details on

## References

Meng, X. L., and D. B. Rubin. 1992.
Performing Likelihood Ratio Tests with Multiply-Imputed Data Sets.
*Biometrika*, 79 (1): 103–11.

https://stefvanbuuren.name/fimd/sec-multiparameter.html#sec:likelihoodratio

## Examples

```
# Compare two linear models:
imp <- mice(nhanes2, seed = 51009, print = FALSE)
mi1 <- with(data = imp, expr = lm(bmi ~ age + hyp + chl))
mi0 <- with(data = imp, expr = lm(bmi ~ age + hyp))
D3(mi1, mi0)
#> test statistic df1 df2 dfcom p.value riv
#> 1 ~~ 2 2.917381 1 8.764849 20 0.122711 2.082143
# \donttest{
# Compare two logistic regression models
imp <- mice(boys, maxit = 2, print = FALSE)
fit1 <- with(imp, glm(gen > levels(gen)[1] ~ hgt + hc + reg, family = binomial))
fit0 <- with(imp, glm(gen > levels(gen)[1] ~ hgt + hc, family = binomial))
D3(fit1, fit0)
#> test statistic df1 df2 dfcom p.value riv
#> 1 ~~ 2 1.204757 4 35.80578 741 0.3257661 1.393246
# }
```