Skip to contents

Tests whether time-varying INAD parameters can be constrained to be constant over time.

Usage

test_stationarity_inad(
  y,
  order = 1,
  thinning = "binom",
  innovation = "pois",
  blocks = NULL,
  constrain = "both",
  fit_unconstrained = NULL,
  verbose = FALSE,
  ...
)

Arguments

y

Integer matrix with n_subjects rows and n_time columns.

order

Model order (1 or 2).

thinning

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

innovation

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

blocks

Optional integer vector for block effects.

constrain

Which parameters to constrain: "alpha", "theta", "both" for order 1; "alpha1", "alpha2", "alpha", "theta", "all" for order 2.

fit_unconstrained

Optional pre-computed unconstrained fit.

verbose

Logical; if TRUE, print progress.

...

Additional arguments.

Value

A list with class "test_stationarity_inad" containing:

method

Inference method used ("lrt").

fit_unconstrained

Unconstrained INAD fit

fit_constrained

Constrained INAD fit

constraint

Human-readable null constraint description

statistic

Test statistic value

lrt_stat

Likelihood ratio test statistic

df

Degrees of freedom

p_value

Chi-square p-value

bic_unconstrained

BIC of unconstrained model

bic_constrained

BIC of constrained model

bic_selected

Model selected by BIC

table

Two-row model summary table

Details

For order 1, the test can constrain alpha, theta, or both. For order 2, it can constrain alpha1, alpha2, alpha (both), theta, or all supported time-varying parameters.

Degrees of freedom are computed from the number of equality constraints imposed under the null model relative to the unconstrained model.

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 = 30,
  n_time = 5,
  order = 1,
  thinning = "binom",
  innovation = "pois",
  alpha = 0.3,
  theta = 2
)
out <- test_stationarity_inad(
  y,
  order = 1,
  thinning = "binom",
  innovation = "pois",
  constrain = "both",
  max_iter = 20
)
out$p_value
#> [1] 0.7131881