| logL_gau | R Documentation |
Computes the log-likelihood for Gaussian antedependence models of order 0, 1, or 2. Supports missing data under MAR assumption via na_action parameter.
logL_gau(
y,
order,
mu = NULL,
phi = NULL,
sigma = NULL,
blocks = NULL,
tau = 0,
na_action = c("fail", "complete", "marginalize")
)
y |
Numeric matrix with n_subjects rows and n_time columns. May contain NA. |
order |
Antedependence order, one of 0, 1, or 2. |
mu |
Mean vector (length n_time). |
phi |
Dependence coefficient(s). For order 1: vector of length n_time-1. For order 2: matrix with 2 columns or vector of length 2*(n_time-2). |
sigma |
Innovation standard deviations (length n_time). |
blocks |
Integer vector of block membership (length n_subjects), or NULL. |
tau |
Block effects, first element constrained to zero |
na_action |
How to handle missing values:
|
For complete data (no NA), all three na_action options give the same result.
For missing data:
marginalize: Uses MVN marginalization to compute P(Y_obs). This is the correct observed-data likelihood for MAR missing data.
complete: Removes subjects with any missing values. May lose information.
fail: Stops with error. Useful to ensure no missing data present.
Scalar log-likelihood value.
set.seed(1)
y <- simulate_gau(n_subjects = 30, n_time = 5, order = 1, phi = 0.3)
fit <- fit_gau(y, order = 1)
logL_gau(y, order = 1, mu = fit$mu, phi = fit$phi, sigma = fit$sigma)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.