Skip to contents

Performs a likelihood ratio test comparing INAD models of different orders.

Usage

test_order_inad(
  y,
  order_null = 0,
  order_alt = 1,
  thinning = "binom",
  innovation = "pois",
  blocks = NULL,
  use_chibar = TRUE,
  weights = NULL,
  fit_null = NULL,
  fit_alt = NULL,
  ...
)

Arguments

y

Integer matrix with n_subjects rows and n_time columns.

order_null

Order under null hypothesis (0 or 1).

order_alt

Order under alternative hypothesis (1 or 2). Must be order_null + 1.

thinning

Thinning operator: "binom", "pois", or "nbinom".

innovation

Innovation distribution: "pois", "bell", or "nbinom".

blocks

Optional integer vector for block effects.

use_chibar

Logical; if TRUE, use chi-bar-square for boundary test.

weights

Optional weights for chi-bar-square mixture.

fit_null

Optional pre-computed null fit.

fit_alt

Optional pre-computed alternative fit.

...

Additional arguments passed to fit_inad.

Value

A list with class "test_order_inad" containing:

method

Inference method used ("lrt").

fit_null

Fitted model under H0

fit_alt

Fitted model under H1

statistic

Test statistic value

lrt_stat

Likelihood ratio test statistic

df

Degrees of freedom

p_value

Chi-square p-value

p_value_chibar

Chi-bar-square p-value (if use_chibar = TRUE)

bic_null

BIC under H0

bic_alt

BIC under H1

bic_selected

Which model BIC prefers

table

Two-row model comparison table

settings

Input and derived settings for the test

Details

The test compares nested INAD models of orders order_null and order_alt = order_null + 1 using: $$\lambda = 2(\ell_{alt} - \ell_{null})$$ where \(\ell_{null}\) and \(\ell_{alt}\) are maximized log-likelihoods under the null and alternative models.

The default p-value uses the chi-square approximation with degrees of freedom matching the number of additional dependence parameters introduced under the higher-order model. When use_chibar = TRUE, a chi-bar-square mixture p-value is also reported for boundary-aware inference.

Missing-data inputs are supported through the same na_action options available in fit_inad. If y has missing values and na_action is not supplied via ..., this function defaults to na_action = "marginalize".

References

Li, C. and Zimmerman, D.L. (2026). Integer-valued antedependence models for longitudinal count data. Biostatistics.

Examples

set.seed(1)
y <- simulate_inad(
  n_subjects = 40,
  n_time = 5,
  order = 1,
  thinning = "binom",
  innovation = "pois",
  alpha = 0.3,
  theta = 2
)
out <- test_order_inad(
  y,
  order_null = 0,
  order_alt = 1,
  thinning = "binom",
  innovation = "pois",
  max_iter = 20
)
out$statistic
#> [1] 18.99281