View source: R/lrt_stationarity_inad.R
| test_stationarity_inad | R Documentation |
Tests whether time-varying INAD parameters can be constrained to be constant over time.
test_stationarity_inad(
y,
order = 1,
thinning = "binom",
innovation = "pois",
blocks = NULL,
constrain = "both",
fit_unconstrained = NULL,
verbose = FALSE,
...
)
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. |
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".
A list with class "test_stationarity_inad" containing:
Inference method used ("lrt").
Unconstrained INAD fit
Constrained INAD fit
Human-readable null constraint description
Test statistic value
Likelihood ratio test statistic
Degrees of freedom
Chi-square p-value
BIC of unconstrained model
BIC of constrained model
Model selected by BIC
Two-row model summary table
Li, C. and Zimmerman, D.L. (2026). Integer-valued antedependence models for longitudinal count data. Biostatistics.
run_stationarity_tests_inad,
test_order_inad, fit_inad
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.