View source: R/lrt_homogeneity_inad.R
| test_homogeneity_inad | R Documentation |
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).
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,
...
)
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:
|
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 |
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.
A list with class "test_homogeneity_inad" containing:
Inference method used ("lrt").
Test statistic value
Likelihood ratio test statistic
Degrees of freedom
P-value from chi-square distribution
Type of test performed
Fitted model under H0
Fitted model under H1
BIC under H0
BIC under H1
Which model BIC prefers
Summary data frame
Li, C. and Zimmerman, D.L. (2026). Integer-valued antedependence models for longitudinal count data. Biostatistics. Section 3.7.
fit_inad, test_order_inad,
test_stationarity_inad
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.