View source: R/lrt_homogeneity_gau.R
| test_homogeneity_gau | R Documentation |
Tests 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).
test_homogeneity_gau(y, blocks, p = 1L, use_modified = TRUE)
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
|
use_modified |
Logical. If TRUE (default), use modified test statistic for better small-sample approximation. |
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.
A list with class gau_homogeneity_test containing:
Inference method used ("lrt").
Test statistic value
Modified test statistic (if use_modified = TRUE)
Degrees of freedom
P-value from chi-square distribution
P-value from modified test
Number of groups
Sample sizes for each group
Antedependence order
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.
test_order_gau, test_two_sample_gau
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.