View source: R/lrt_stationarity_gau.R
| test_stationarity_gau | R Documentation |
Tests whether time-varying Gaussian AD covariance parameters can be constrained to be constant over time.
test_stationarity_gau(
y,
order = 1L,
blocks = NULL,
constrain = "both",
fit_unconstrained = NULL,
verbose = FALSE,
max_iter = 2000L,
rel_tol = 1e-08,
...
)
y |
Numeric matrix with n_subjects rows and n_time columns. |
order |
Antedependence order (0, 1, or 2). |
blocks |
Optional vector of block memberships (length n_subjects). |
constrain |
Constraint to test: for order 0: "sigma" (or "all"); for order 1: "phi", "sigma", or "both"/"all"; for order 2: "phi1", "phi2", "phi", "sigma", or "all"/"both". |
fit_unconstrained |
Optional pre-computed unconstrained fit from
|
verbose |
Logical; if TRUE, prints fitting progress. |
max_iter |
Maximum number of optimization iterations for constrained fit. |
rel_tol |
Relative tolerance for constrained optimization. |
... |
Additional arguments passed to |
The mean structure is kept unrestricted in both models (time-specific means plus optional block shifts), and the test constrains covariance parameters: innovation standard deviations and/or antedependence coefficients.
The likelihood-ratio statistic is:
\lambda = 2(\ell_{alt} - \ell_{null})
where \ell_{null} and \ell_{alt} are maximized log-likelihoods
under the constrained and unconstrained models, respectively.
Degrees of freedom are computed from the number of constraints implied by
constrain.
A list with class "test_stationarity_gau" containing:
Inference method used ("lrt").
Unconstrained Gaussian AD fit
Constrained Gaussian AD fit
Human-readable null constraint description
Likelihood-ratio statistic
Degrees of freedom
Chi-square p-value
BIC of unconstrained model
BIC of constrained model
Model selected by BIC
Two-row model summary table
Zimmerman, D.L. and Nunez-Anton, V. (2009). Antedependence Models for Longitudinal Data. Chapman & Hall/CRC. Chapter 6.
run_stationarity_tests_gau, test_order_gau,
fit_gau
set.seed(1)
y <- simulate_gau(n_subjects = 80, n_time = 6, order = 1, phi = 0.4, sigma = 1)
# Test jointly constant phi and sigma (order 1)
out <- test_stationarity_gau(y, order = 1, constrain = "both")
out$p_value
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.