Likelihood ratio test for homogeneity across groups (Gaussian AD data)
Source:R/lrt_homogeneity_gau.R
test_homogeneity_gau.RdTests the null hypothesis that G groups have the same AD(p) covariance structure against the alternative that they have different AD(p) structures. This implements Theorem 6.6 of Zimmerman & Núñez-Antón (2009).
Arguments
- y
Numeric matrix with n_subjects rows and n_time columns.
- blocks
Integer vector of length n_subjects indicating group membership.
- p
Antedependence order. This is the same order parameter named
orderinfit_gau.- use_modified
Logical. If TRUE (default), use modified test statistic for better small-sample approximation.
Value
A list with class gau_homogeneity_test containing:
- method
Inference method used (
"lrt").- statistic
Test statistic value
- statistic_modified
Modified test statistic (if use_modified = TRUE)
- df
Degrees of freedom
- p_value
P-value from chi-square distribution
- p_value_modified
P-value from modified test
- G
Number of groups
- group_sizes
Sample sizes for each group
- order
Antedependence order
Details
The test compares:
H0: All G groups have the same AD(p) covariance matrix Sigma(theta)
H1: Groups have different AD(p) covariance matrices Sigma(theta_g)
The likelihood ratio test statistic (Theorem 6.6) involves comparing pooled and within-group RSS values. The degrees of freedom are (G-1)(2n - p)(p + 1)/2.
This test is useful for determining whether a common covariance structure can be assumed across treatment groups before performing mean comparisons.
References
Zimmerman, D.L. and Núñez-Antón, V. (2009). Antedependence Models for Longitudinal Data. Chapman & Hall/CRC. Section 6.4.
Kenward, M.G. (1987). A method for comparing profiles of repeated measurements. Applied Statistics, 36, 296-308.
Examples
if (FALSE) { # \dontrun{
# Simulate data from two groups with same covariance
n1 <- 30
n2 <- 35
y1 <- simulate_gau(n1, n_time = 6, order = 1, phi = 0.5, sigma = 1)
y2 <- simulate_gau(n2, n_time = 6, order = 1, phi = 0.5, sigma = 1)
y <- rbind(y1, y2)
blocks <- c(rep(1, n1), rep(2, n2))
# Test homogeneity
test <- test_homogeneity_gau(y, blocks, p = 1)
print(test)
} # }