| test_one_sample_gau | R Documentation |
Tests the null hypothesis that the mean vector equals a specified value mu = mu_0 against the alternative mu != mu_0, under an AD(p) covariance structure. This implements Theorem 7.1 of Zimmerman & Núñez-Antón (2009).
test_one_sample_gau(y, mu0, p = 1L, order = NULL, use_modified = TRUE)
y |
Numeric matrix with n_subjects rows and n_time columns. |
mu0 |
Hypothesized mean vector under the null (length n_time). |
p |
Antedependence order of the covariance structure. This is the same
order parameter named |
order |
Optional alias for |
use_modified |
Logical. If TRUE (default), use the modified test statistic (formula 7.7) for better small-sample approximation. |
The test exploits the AD structure to gain power over tests that don't assume any covariance structure. The likelihood ratio test statistic (Theorem 7.1) is:
N \sum_{i=1}^{n} [\log RSS_i(\mu_0) - \log RSS_i(\hat{\mu})]
where RSS_i(mu) is the residual sum of squares from the regression of Y_i - mu_i on its p predecessors Y_(i-1) - mu_(i-1), ..., Y_(i-p) - mu_(i-p).
The test has n degrees of freedom (one for each component of mu).
A list with class gau_mean_test containing:
Inference method used ("lrt").
"one-sample"
Hypothesized mean under null
MLE of mean (sample mean)
Test statistic value
Modified test statistic (if use_modified = TRUE)
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.
test_two_sample_gau, test_order_gau
# Simulate data with known mean
mu_true <- c(10, 11, 12, 13, 14, 15)
y <- simulate_gau(n_subjects = 50, n_time = 6, order = 1, mu = mu_true)
# Test if mean is zero
test <- test_one_sample_gau(y, mu0 = rep(0, 6), p = 1)
print(test)
# Test if mean equals true value (should not reject)
test2 <- test_one_sample_gau(y, mu0 = mu_true, p = 1)
print(test2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.