View source: R/lrt_order_gau.R
| test_order_gau | R Documentation |
Tests the null hypothesis that the data follow an AD(p) model against the alternative that they follow an AD(p+q) model, using the likelihood ratio test described in Theorem 6.4 and 6.5 of Zimmerman & Núñez-Antón (2009).
test_order_gau(
y,
p = 0L,
q = 1L,
mu = NULL,
use_modified = TRUE,
order_null = NULL,
order_alt = NULL
)
y |
Numeric matrix with n_subjects rows and n_time columns. |
p |
Order under the null hypothesis (default 0). This is the same
antedependence order parameter named |
q |
Order increment under the alternative (default 1, so alternative is AD(p+q)). |
mu |
Optional mean vector. If NULL, the saturated mean (sample means) is used. |
use_modified |
Logical. If TRUE (default), use the modified test statistic (formula 6.9) which has better small-sample properties. |
order_null |
Optional alias for |
order_alt |
Optional absolute order under the alternative. When supplied,
|
The test is based on the intervenor-adjusted sample partial correlations. Under the null hypothesis AD(p), the partial correlations r_(i,i-k|(i-k+1:i-1)) should be zero for k > p.
The likelihood ratio test statistic (Theorem 6.4) is:
-N \sum_{j=1}^{q} \sum_{i=p+j+1}^{n} \log(1 - r^2_{i,i-p-j\cdot(i-p-j+1:i-1)})
which is asymptotically chi-square with (2n - 2p - q - 1)(q/2) degrees of freedom.
The modified test (formula 6.9) adjusts for small-sample bias using Kenward's (1987) correction.
A list with class gau_order_test containing:
Inference method used ("lrt").
Order under null hypothesis
Order increment
Test statistic value
Modified test statistic (if use_modified = TRUE)
Degrees of freedom
P-value from chi-square distribution
P-value from modified test (if use_modified = TRUE)
Number of subjects
Number of time points
Zimmerman, D.L. and Núñez-Antón, V. (2009). Antedependence Models for Longitudinal Data. Chapman & Hall/CRC. Chapter 6.
Kenward, M.G. (1987). A method for comparing profiles of repeated measurements. Applied Statistics, 36, 296-308.
test_one_sample_gau, test_homogeneity_gau
# Simulate AD(1) data
y <- simulate_gau(n_subjects = 50, n_time = 6, order = 1, phi = 0.5)
# Test AD(0) vs AD(1)
test01 <- test_order_gau(y, p = 0, q = 1)
print(test01)
# Test AD(1) vs AD(2)
test12 <- test_order_gau(y, p = 1, q = 1)
print(test12)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.