| test_two_sample_gau | R Documentation |
Tests 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).
test_two_sample_gau(y, blocks, p = 1L, order = NULL, use_modified = TRUE)
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 |
order |
Optional alias for |
use_modified |
Logical. If TRUE (default), use modified test statistic. |
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.
A list with class gau_mean_test containing:
Inference method used ("lrt").
"two-sample"
Estimated mean for group 1
Estimated mean for group 2
Pooled mean estimate under H0
Test statistic value
Modified test statistic
Degrees of freedom (n_time)
P-value from chi-square distribution
P-value from modified test
Antedependence order used
Zimmerman, D.L. and Núñez-Antón, V. (2009). Antedependence Models for Longitudinal Data. Chapman & Hall/CRC. Chapter 7.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.