Calculates the MLE of the coefficients of the heteroscedastic linear model (HLM). See Details.

hlm_fit(y, X, Z, method = c("IRLS", "Fisher"), beta0, gamma0,
  maxit = 100, epsilon = 1e-05)

Arguments

y

Vector of observations of length n.

X

Mean covariate matrix of size n x p.

Z

Variance covariate matrix of size n x q.

method

Which method to use for fitting the conditional LVLM model. See lvlm_fit.

beta0

Optional initial mean parameter vector of length p.

gamma0

Optional initial variance parameter vector of length q.

maxit

Maximum number of iteration of the fitting algorithm (see Details).

epsilon

Tolerance threshold for termination of the algorithm (see Details).

Value

A list with elements:

beta

The MLE of the mean parameters as a vector of length p.

gamma

The MLE of the variance parameters as a vector of length q.

loglik

The loglikelihood at the final step of the algorithm.

iter

The number of iterations of the fitting algorithm.

tolerance

The loglikelihood relative error at the last step.

Details

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 low-level function hlm_fit assumes that the response vector is fully observed (uncensored). See chlm_fit for the corresponding function with censoring, or the higher-level interface hlm.

The tuning parameters of the LVLM fitting methods are tuned to their default values in lvlm_fit.

Warning: This R wrapper function provides a direct interface to the C++ source code. Incorrect argument specification may lead to abrupt termination of the R session.