# D2: Compare two nested models using D2-statistic

## Description

Compare two nested models using D2-statistic

## Usage

D2(fit1, fit0 = NULL, df.com = NULL, use = "wald", ...)

## 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.

df.com

A single number or a numeric vector denoting the
complete-data degrees of freedom for the hypothesis test. If not specified,
it is set equal to `df.residual`

of model `fit1`

. Not used
for method `D2()`

.

use

A character string denoting Wald- or likelihood-based based tests. Can be either `"wald"`

or `"likelihood"`

. Only used if `method="D2"`

.

## Details

The `D2`

method does not use the `df.com`

parameter, so
it does not pass it down to `testModels`

.
This prevents the following warning thrown by `testModels`

:
```
Complete-data degrees of freedom are not available
for use with 'D2', and thus were ignored.
```