Two-sample test for equality of mean profiles under antedependence
Source:R/lrt_mean_gau.R
test_two_sample_gau.RdTests the null hypothesis that two groups have equal mean profiles mu_1 = mu_2 against the alternative mu_1 != mu_2, assuming a common AD(p) covariance structure. This implements Theorem 7.3 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 (must contain exactly two unique values, typically 1 and 2).
- p
Antedependence order of the common covariance structure. This is the same order parameter named
orderinfit_gau.- order
Optional alias for
p. Supply only one ofpororder.- use_modified
Logical. If TRUE (default), use modified test statistic.
Value
A list with class gau_mean_test containing:
- method
Inference method used (
"lrt").- test_type
"two-sample"
- mu1_hat
Estimated mean for group 1
- mu2_hat
Estimated mean for group 2
- mu_pooled
Pooled mean estimate under H0
- statistic
Test statistic value
- statistic_modified
Modified test statistic
- df
Degrees of freedom (n_time)
- p_value
P-value from chi-square distribution
- p_value_modified
P-value from modified test
- order
Antedependence order used
Details
This test is also known as a "profile comparison" test. The likelihood ratio test statistic (Theorem 7.3) compares the pooled RSS (under H0: common mean) to the sum of within-group RSS (under H1: separate means):
$$N \sum_{i=1}^{n} [\log RSS_i(\mu) - \log RSS_i(\mu_1, \mu_2)]$$
where RSS_i(mu) uses a common mean and RSS_i(mu_1, mu_2) uses group-specific means.
References
Zimmerman, D.L. and Núñez-Antón, V. (2009). Antedependence Models for Longitudinal Data. Chapman & Hall/CRC. Chapter 7.
Examples
if (FALSE) { # \dontrun{
# Simulate data from two groups with different means
n1 <- 30
n2 <- 35
y1 <- simulate_gau(n1, n_time = 6, order = 1, mu = rep(10, 6))
y2 <- simulate_gau(n2, n_time = 6, order = 1, mu = rep(12, 6))
y <- rbind(y1, y2)
blocks <- c(rep(1, n1), rep(2, n2))
# Test equality of profiles
test <- test_two_sample_gau(y, blocks, p = 1)
print(test)
} # }