test_homogeneity_inad: Likelihood ratio test for homogeneity across groups (INAD...

View source: R/lrt_homogeneity_inad.R

test_homogeneity_inadR Documentation

Likelihood ratio test for homogeneity across groups (INAD data)

Description

Tests hypotheses about parameter equality across treatment or grouping factors in integer-valued antedependence models. Implements the homogeneity testing framework from Section 3.7 of Li & Zimmerman (2026).

Usage

test_homogeneity_inad(
  y,
  blocks,
  order = 1,
  thinning = "binom",
  innovation = "pois",
  test = c("all", "mean", "dependence"),
  fit_pooled = NULL,
  fit_inadfe = NULL,
  fit_hetero = NULL,
  ...
)

Arguments

y

Integer matrix with n_subjects rows and n_time columns.

blocks

Integer vector of length n_subjects specifying group membership.

order

Antedependence order (0, 1, or 2).

thinning

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

innovation

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

test

Type of homogeneity test:

  • "all": Tests M1 (pooled) vs M3 (fully heterogeneous)

  • "mean": Tests M1 (pooled) vs M2 (shared dependence, different means)

  • "dependence": Tests M2 (INADFE) vs M3 (fully heterogeneous)

fit_pooled

Optional pre-computed pooled fit (M1).

fit_inadfe

Optional pre-computed INADFE fit (M2).

fit_hetero

Optional pre-computed heterogeneous fit (M3).

...

Additional arguments passed to fit_inad.

Details

The function supports three nested model comparisons as described in the paper:

M1 (Pooled): All parameters are common across groups. This corresponds to fitting fit_inad(y, blocks = NULL).

M2 (INADFE): The thinning parameters \alpha are shared across groups, but innovation means differ via block effects \tau. This is the standard INADFE model fitted via fit_inad(y, blocks = blocks).

M3 (Fully Heterogeneous): Both \alpha and \theta parameters can differ across groups. This is fitted by running separate fit_inad calls for each group.

The three test types correspond to:

  • "all": H0: M1 vs H1: M3 (complete homogeneity vs complete heterogeneity)

  • "mean": H0: M1 vs H1: M2 (test for group differences in means only)

  • "dependence": H0: M2 vs H1: M3 (test for group differences in dependence)

Degrees of freedom are computed as the difference in free parameters between the null and alternative models.

Value

A list with class "test_homogeneity_inad" containing:

method

Inference method used ("lrt").

statistic

Test statistic value

lrt_stat

Likelihood ratio test statistic

df

Degrees of freedom

p_value

P-value from chi-square distribution

test

Type of test performed

fit_null

Fitted model under H0

fit_alt

Fitted model under H1

bic_null

BIC under H0

bic_alt

BIC under H1

bic_selected

Which model BIC prefers

table

Summary data frame

References

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

See Also

fit_inad, test_order_inad, test_stationarity_inad

Examples


data("bolus_inad")
y <- bolus_inad$y
blocks <- bolus_inad$blocks

# Test for any group differences (M1 vs M3)
test_all <- test_homogeneity_inad(y, blocks, order = 1,
                                  thinning = "nbinom", innovation = "bell",
                                  test = "all")
print(test_all)

# Test only for mean differences (M1 vs M2)
test_mean <- test_homogeneity_inad(y, blocks, order = 1,
                                   thinning = "nbinom", innovation = "bell",
                                   test = "mean")
print(test_mean)

# Test for dependence differences given different means (M2 vs M3)
test_dep <- test_homogeneity_inad(y, blocks, order = 1,
                                  thinning = "nbinom", innovation = "bell",
                                  test = "dependence")
print(test_dep)



antedep documentation built on April 25, 2026, 1:06 a.m.