Low-level fitting functions for the censored HLM model.
chlm_fit(y, delta, X, Z, beta0, gamma0, maxit = 100, epsilon = 1e-08, splitE = FALSE, nIRLS = 5) chlm_control(epsilon = 1e-05, maxit = 100, nIRLS = 5, splitE = TRUE)
y | Vector of observations of length |
---|---|
delta | Optional logical vector of length |
X | Mean covariate matrix of size |
Z | Variance covariate matrix of size |
beta0 | Optional initial mean parameter vector of length |
gamma0 | Optional initial variance parameter vector of length |
maxit | Maximum number of iteration of the fitting algorithm (see Details). |
epsilon | Tolerance threshold for termination of the algorithm (see Details). |
splitE | If |
nIRLS | Number of IRLS steps to take before switching to Fisher scoring. Can be 0 or greater than |
A list with the following elements:
beta
The MLE of the mean parameter vector.
gamma
The MLE of the variance parameter vector.
loglik
The value of the loglikelihood at the fitted parameter values.
iter
The number of steps taken by the algorithm.
error
The value of the loglikelihood relative error at the end of the algorithm.
The heteroscedastic linear model (HLM) is defined as $$ y_i \mid \boldsymbol{x}_i, \boldsymbol{z}_i \stackrel{\mathrm{ind}}{\sim} \mathcal N\big(\boldsymbol{x}_i'\boldsymbol{\beta}, \exp(\boldsymbol{z}_i'\boldsymbol{\gamma})\big), $$ where for each subject \(i\), \(y_i\) is the response, and \(\boldsymbol{x}_i \in \mathbb{R}^p\) and \(\boldsymbol{z}_i \in \mathbb{R}^q\) are mean and variance covariate vectors, respectively.
The fitting algorithm is an Expectation-Conditional-Maximization (ECM) algorithm extending the alternating weighted-LM/GLM updates of beta
and gamma
, proposed by Smyth (1989) for the uncensored setting. The ECM algorithm terminates when either maxit
iterations have been reached, or when
|ll_curr - ll_prev| / (0.1 + |ll_curr|) < epsilon,
where ll_curr
and ll_prev
are the loglikelihood values at the current and previous iterations.
TODO:
Input checking.
print
, summary
, vcov
methods.
residual
method. Perhaps use expected lifetime for the censored observations?
Separate into chlm
and hlm
classes?
Smyth, G.K. "Generalized Linear Models with Varying Dispersion." Journal of the Royal Statistical Society Series B 51:1 (1989): 47-60. https://www.jstor.org/stable/2345840.