Calculates the MLE of a heteroscedastic linear model (HLM) with possibly right-censored responses. See Details.

hlm(formula, data, subset, weights, na.action, control, model = TRUE,
  qr = TRUE, x = FALSE, y = FALSE, offset)

Arguments

formula

An object of class formula (or one that can be coerced to that class). See Details.

data

An optional data frame, list or environment containing the variables in the model. If not found in data, the variables are taken from environment(formula).

subset

An optional vector specifying a subset of observations to be used in the fitting process.

weights

Currently ignored.

na.action

A function which indicates what should happen when the data contain NAs. Same default behavior as in stats::lm.

control

List of parameters to control the fitting process. See Details.

model, x, y, qr

Logical values indicating which data elements should be returned in the output. These correspond to the response, the covariance matrices, the model.frame, and the QR decomposition of the hessian of the negative loglikelihood, respectively. See stats::lm.

offset

Currently ignored, as are offset terms in the formula.

Value

An object of class hlm with the following elements:

coefficients

A list with elements beta and gamma containing the coefficient MLEs.

loglik

The loglikelihood at the MLE.

df.residual

The residual degrees of freedom.

iter

The number of iterations used in the fitting algorithm.

call

The matched call.

terms

A list with elements X and Z giving the terms object for mean and variance models.

y

If requested, the response used.

x

If requested, a list with elements X and Z giving the mean and variance model matrices uses.

model

If requested, the model.frame used.

na.action

(Where relevant) information returned by model.frame on the special handling of NAs.

qr

If requested, the QR decomposition of the observed Fisher information matrix of size (p+q) x (p+q).

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 formula term is specified as e.g.,

y ~ x1 + x2 | z1 + z2

where the vertical bar separates mean and variance components. If no bar is provided, an intercept variance term of the form y ~ x1 + x2 | 1 is assumed, corresponding to the usual linear model (but with a different parametrization).

Right censoring of observations is supported by specifying the response as a two-column matrix, where the first column is the response and the second column is a censoring status indicator with 0: right-censored and 1: uncensored.

Fitting the hlm model is done by blockwise coordinate ascent, alternatively maximing the mean parameters by weighted least-squares, and the variance parameters either via Fisher scoring or Iteratively Reweighted Least Squares. When there is right-censoring, these maximization steps are embedded within an Expectation-Conditional-Maximization algorithm.

Note

Warning: At present hlm cannot handle pure LM or LVLM models. For datasets without censoring, please use the low-level functions lm_fit and lvlm_fit instead.

References

Wang, Y., You, T., and Lysy, M. "A heteroscedastic accelerated failure time model for survival analysis" (2019): https://arxiv.org/abs/1508.05137.

See also

Current methods for hlm objects are: print, nobs, vcov, and summary.

Examples

summary(colond) # colon cancer dataset
#> time status rx sex age #> Min. : 23.0 Mode :logical Obs :305 female:428 Min. :18.00 #> 1st Qu.: 809.8 FALSE:458 Lev :294 male :460 1st Qu.:53.00 #> Median :1983.0 TRUE :430 Lev+5FU:289 Median :61.00 #> Mean :1674.8 Mean :59.81 #> 3rd Qu.:2378.5 3rd Qu.:69.00 #> Max. :3329.0 Max. :85.00 #> obstruct perfor adhere nodes differ extent #> FALSE:717 FALSE:861 FALSE:760 Min. : 0.000 well : 90 submuc : 19 #> TRUE :171 TRUE : 27 TRUE :128 1st Qu.: 1.000 moder:653 muscle :102 #> Median : 2.000 poor :145 serosa :730 #> Mean : 3.663 cstruct: 37 #> 3rd Qu.: 5.000 #> Max. :33.000 #> surg node4 #> short:650 FALSE:653 #> long :238 TRUE :235 #> #> #> #>
# fit model without censoring (i.e., ignoring it) M <- hlm(log(time) ~ . | rx, data = colond) M # brief display
#> #> Call: #> hlm(formula = log(time) ~ . | rx, data = colond) #> #> Mean Coefficients: #> (Intercept) statusTRUE rxLev rxLev+5FU sexmale #> 8.094110 -1.088684 -0.060590 -0.038627 -0.015568 #> age obstructTRUE perforTRUE adhereTRUE nodes #> -0.003779 -0.166131 0.138035 0.037240 -0.004408 #> differmoder differpoor extentmuscle extentserosa extentcstruct #> 0.035946 -0.245295 0.106529 -0.008666 -0.175723 #> surglong node4TRUE #> -0.022991 -0.192685 #> #> Variance Coefficients: #> (Intercept) rxLev rxLev+5FU #> -1.3556 0.1286 0.2252 #>
summary(M) # full summary
#> #> Call: #> hlm(formula = log(time) ~ . | rx, data = colond) #> #> Mean Coefficients: #> Estimate Std. Error z value Pr(>|z|) #> (Intercept) 8.094110 0.161689 50.060 < 2e-16 *** #> statusTRUE -1.088684 0.038777 -28.076 < 2e-16 *** #> rxLev -0.060590 0.043158 -1.404 0.160344 #> rxLev+5FU -0.038627 0.044734 -0.863 0.387877 #> sexmale -0.015568 0.036382 -0.428 0.668729 #> age -0.003779 0.001540 -2.454 0.014133 * #> obstructTRUE -0.166131 0.046563 -3.568 0.000360 *** #> perforTRUE 0.138035 0.106750 1.293 0.195988 #> adhereTRUE 0.037240 0.053404 0.697 0.485598 #> nodes -0.004408 0.007998 -0.551 0.581559 #> differmoder 0.035946 0.061278 0.587 0.557474 #> differpoor -0.245295 0.074141 -3.309 0.000938 *** #> extentmuscle 0.106529 0.136155 0.782 0.433972 #> extentserosa -0.008666 0.127635 -0.068 0.945870 #> extentcstruct -0.175723 0.155631 -1.129 0.258856 #> surglong -0.022991 0.041165 -0.559 0.576497 #> node4TRUE -0.192685 0.064219 -3.000 0.002696 ** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> Variance Coefficients: #> Estimate Std. Error z value Pr(>|z|) #> (Intercept) -1.35562 0.08281 -16.369 <2e-16 *** #> rxLev 0.12858 0.11916 1.079 0.2806 #> rxLev+5FU 0.22519 0.11917 1.890 0.0588 . #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> AIC: 1523.1 #> Number of algorithm iterations: 3 #>
vcov(M) # variance estimate
#> X_(Intercept) X_statusTRUE X_rxLev X_rxLev+5FU #> X_(Intercept) 2.614343e-02 -1.236219e-04 -7.016475e-04 -9.930187e-04 #> X_statusTRUE -1.236219e-04 1.503654e-03 4.158904e-05 1.646970e-04 #> X_rxLev -7.016475e-04 4.158904e-05 1.862588e-03 8.539018e-04 #> X_rxLev+5FU -9.930187e-04 1.646970e-04 8.539018e-04 2.001132e-03 #> X_sexmale -3.902654e-04 -5.854324e-06 -4.277758e-05 7.981676e-05 #> X_age -1.359035e-04 -3.029764e-06 -1.240753e-06 -1.143409e-06 #> X_obstructTRUE -5.105193e-04 -8.094224e-05 1.895699e-05 5.228386e-05 #> X_perforTRUE -2.162797e-04 -3.920988e-05 -5.966730e-05 -2.353477e-05 #> X_adhereTRUE 3.884689e-04 -1.284340e-04 -3.724624e-05 1.795973e-05 #> X_nodes -9.465147e-05 -3.577784e-05 5.730984e-06 7.867816e-06 #> X_differmoder -2.834128e-03 8.348546e-05 1.300987e-04 -1.094200e-05 #> X_differpoor -2.870937e-03 2.958005e-05 1.807907e-04 -4.871304e-05 #> X_extentmuscle -1.431536e-02 -1.288739e-04 -2.137776e-04 1.013180e-04 #> X_extentserosa -1.428071e-02 -3.128462e-04 -2.374501e-04 3.055481e-05 #> X_extentcstruct -1.422080e-02 -5.106152e-04 -5.690122e-05 1.842411e-04 #> X_surglong -2.531197e-04 -1.127285e-04 6.644265e-05 7.051479e-05 #> X_node4TRUE 3.245213e-04 -2.418950e-04 -5.740609e-05 -3.192449e-05 #> Z_(Intercept) 5.202376e-04 -2.757366e-04 -2.178431e-05 -2.412023e-05 #> Z_rxLev -1.298183e-03 4.185820e-04 1.850457e-05 2.813008e-05 #> Z_rxLev+5FU -2.778045e-04 4.213863e-04 4.810837e-05 4.549348e-05 #> X_sexmale X_age X_obstructTRUE X_perforTRUE #> X_(Intercept) -3.902654e-04 -1.359035e-04 -5.105193e-04 -2.162797e-04 #> X_statusTRUE -5.854324e-06 -3.029764e-06 -8.094224e-05 -3.920988e-05 #> X_rxLev -4.277758e-05 -1.240753e-06 1.895699e-05 -5.966730e-05 #> X_rxLev+5FU 7.981676e-05 -1.143409e-06 5.228386e-05 -2.353477e-05 #> X_sexmale 1.323672e-03 -4.805577e-07 5.528224e-05 -2.451072e-05 #> X_age -4.805577e-07 2.371536e-06 7.368944e-06 4.214665e-06 #> X_obstructTRUE 5.528224e-05 7.368944e-06 2.168143e-03 -3.382309e-04 #> X_perforTRUE -2.451072e-05 4.214665e-06 -3.382309e-04 1.139560e-02 #> X_adhereTRUE 6.221910e-05 -5.096654e-06 -6.876429e-05 -7.775554e-04 #> X_nodes -8.525867e-06 6.353176e-08 2.061360e-06 -2.904181e-05 #> X_differmoder -9.868294e-05 2.005042e-06 6.362023e-05 1.130515e-04 #> X_differpoor -1.002048e-04 3.447152e-06 5.410667e-05 1.299652e-04 #> X_extentmuscle -2.412944e-04 -9.503254e-06 -3.179455e-04 -1.081152e-06 #> X_extentserosa -2.060822e-04 -8.247074e-06 -4.644602e-04 -1.967325e-04 #> X_extentcstruct -2.509378e-04 -5.128729e-06 -2.488893e-04 -5.355568e-04 #> X_surglong -6.928519e-06 -1.139398e-06 -1.119633e-06 -9.760759e-05 #> X_node4TRUE 1.325594e-04 7.054099e-06 9.660433e-05 2.508340e-04 #> Z_(Intercept) -2.537538e-05 -2.048667e-06 -2.550134e-04 5.276219e-05 #> Z_rxLev 1.393548e-04 9.534626e-06 3.258801e-04 -2.553656e-04 #> Z_rxLev+5FU -6.379916e-05 -3.404992e-06 4.520195e-04 9.767024e-05 #> X_adhereTRUE X_nodes X_differmoder X_differpoor #> X_(Intercept) 3.884689e-04 -9.465147e-05 -2.834128e-03 -2.870937e-03 #> X_statusTRUE -1.284340e-04 -3.577784e-05 8.348546e-05 2.958005e-05 #> X_rxLev -3.724624e-05 5.730984e-06 1.300987e-04 1.807907e-04 #> X_rxLev+5FU 1.795973e-05 7.867816e-06 -1.094200e-05 -4.871304e-05 #> X_sexmale 6.221910e-05 -8.525867e-06 -9.868294e-05 -1.002048e-04 #> X_age -5.096654e-06 6.353176e-08 2.005042e-06 3.447152e-06 #> X_obstructTRUE -6.876429e-05 2.061360e-06 6.362023e-05 5.410667e-05 #> X_perforTRUE -7.775554e-04 -2.904181e-05 1.130515e-04 1.299652e-04 #> X_adhereTRUE 2.851956e-03 1.860939e-05 -1.326077e-04 -3.113655e-04 #> X_nodes 1.860939e-05 6.396250e-05 -2.364810e-05 -3.245073e-05 #> X_differmoder -1.326077e-04 -2.364810e-05 3.755038e-03 3.371084e-03 #> X_differpoor -3.113655e-04 -3.245073e-05 3.371084e-03 5.496859e-03 #> X_extentmuscle -2.825091e-04 9.943178e-06 -4.928944e-04 -4.002767e-04 #> X_extentserosa -2.986773e-04 -9.469006e-06 -5.216127e-04 -4.974208e-04 #> X_extentcstruct -1.112823e-03 -3.428818e-05 -8.631957e-04 -8.665510e-04 #> X_surglong -1.110779e-05 8.451058e-06 -1.828495e-05 -3.591306e-05 #> X_node4TRUE -5.245026e-05 -3.774189e-04 -3.792445e-05 -2.576355e-04 #> Z_(Intercept) 2.319267e-04 7.360723e-05 -3.092939e-04 -5.327932e-04 #> Z_rxLev -5.844850e-04 -1.163334e-04 5.057801e-04 8.722203e-04 #> Z_rxLev+5FU -1.180054e-04 -1.078147e-04 4.357857e-04 7.497150e-04 #> X_extentmuscle X_extentserosa X_extentcstruct X_surglong #> X_(Intercept) -1.431536e-02 -1.428071e-02 -1.422080e-02 -2.531197e-04 #> X_statusTRUE -1.288739e-04 -3.128462e-04 -5.106152e-04 -1.127285e-04 #> X_rxLev -2.137776e-04 -2.374501e-04 -5.690122e-05 6.644265e-05 #> X_rxLev+5FU 1.013180e-04 3.055481e-05 1.842411e-04 7.051479e-05 #> X_sexmale -2.412944e-04 -2.060822e-04 -2.509378e-04 -6.928519e-06 #> X_age -9.503254e-06 -8.247074e-06 -5.128729e-06 -1.139398e-06 #> X_obstructTRUE -3.179455e-04 -4.644602e-04 -2.488893e-04 -1.119633e-06 #> X_perforTRUE -1.081152e-06 -1.967325e-04 -5.355568e-04 -9.760759e-05 #> X_adhereTRUE -2.825091e-04 -2.986773e-04 -1.112823e-03 -1.110779e-05 #> X_nodes 9.943178e-06 -9.469006e-06 -3.428818e-05 8.451058e-06 #> X_differmoder -4.928944e-04 -5.216127e-04 -8.631957e-04 -1.828495e-05 #> X_differpoor -4.002767e-04 -4.974208e-04 -8.665510e-04 -3.591306e-05 #> X_extentmuscle 1.853814e-02 1.577224e-02 1.584670e-02 -1.571652e-04 #> X_extentserosa 1.577224e-02 1.629062e-02 1.599654e-02 -1.470173e-04 #> X_extentcstruct 1.584670e-02 1.599654e-02 2.422107e-02 7.357173e-05 #> X_surglong -1.571652e-04 -1.470173e-04 7.357173e-05 1.694574e-03 #> X_node4TRUE -4.199103e-04 -3.476679e-04 -3.515506e-05 3.515357e-05 #> Z_(Intercept) 1.160999e-04 -6.989647e-05 2.097538e-04 -2.815588e-04 #> Z_rxLev -5.439295e-05 2.101769e-04 -5.446882e-04 3.651163e-04 #> Z_rxLev+5FU -3.013872e-04 9.459765e-07 -9.036372e-05 4.936661e-04 #> X_node4TRUE Z_(Intercept) Z_rxLev Z_rxLev+5FU #> X_(Intercept) 3.245213e-04 5.202376e-04 -1.298183e-03 -2.778045e-04 #> X_statusTRUE -2.418950e-04 -2.757366e-04 4.185820e-04 4.213863e-04 #> X_rxLev -5.740609e-05 -2.178431e-05 1.850457e-05 4.810837e-05 #> X_rxLev+5FU -3.192449e-05 -2.412023e-05 2.813008e-05 4.549348e-05 #> X_sexmale 1.325594e-04 -2.537538e-05 1.393548e-04 -6.379916e-05 #> X_age 7.054099e-06 -2.048667e-06 9.534626e-06 -3.404992e-06 #> X_obstructTRUE 9.660433e-05 -2.550134e-04 3.258801e-04 4.520195e-04 #> X_perforTRUE 2.508340e-04 5.276219e-05 -2.553656e-04 9.767024e-05 #> X_adhereTRUE -5.245026e-05 2.319267e-04 -5.844850e-04 -1.180054e-04 #> X_nodes -3.774189e-04 7.360723e-05 -1.163334e-04 -1.078147e-04 #> X_differmoder -3.792445e-05 -3.092939e-04 5.057801e-04 4.357857e-04 #> X_differpoor -2.576355e-04 -5.327932e-04 8.722203e-04 7.497150e-04 #> X_extentmuscle -4.199103e-04 1.160999e-04 -5.439295e-05 -3.013872e-04 #> X_extentserosa -3.476679e-04 -6.989647e-05 2.101769e-04 9.459765e-07 #> X_extentcstruct -3.515506e-05 2.097538e-04 -5.446882e-04 -9.036372e-05 #> X_surglong 3.515357e-05 -2.815588e-04 3.651163e-04 4.936661e-04 #> X_node4TRUE 4.124080e-03 -2.503804e-04 5.181461e-04 2.421917e-04 #> Z_(Intercept) -2.503804e-04 6.858312e-03 -7.034739e-03 -6.996389e-03 #> Z_rxLev 5.181461e-04 -7.034739e-03 1.419812e-02 7.171536e-03 #> Z_rxLev+5FU 2.421917e-04 -6.996389e-03 7.171536e-03 1.420178e-02
# fit same model but with censoring hlm(cbind(log(time), status) ~ . | rx, data = colond)
#> #> Call: #> hlm(formula = cbind(log(time), status) ~ . | rx, data = colond) #> #> Mean Coefficients: #> (Intercept) rxLev rxLev+5FU sexmale age #> 9.49981 0.07233 0.46443 -0.03225 -0.01051 #> obstructTRUE perforTRUE adhereTRUE nodes differmoder #> -0.35492 0.06564 -0.15956 -0.05284 0.21673 #> differpoor extentmuscle extentserosa extentcstruct surglong #> -0.23659 -0.34714 -0.90472 -1.36850 -0.25503 #> node4TRUE #> -0.64961 #> #> Variance Coefficients: #> (Intercept) rxLev rxLev+5FU #> 0.1716 0.3003 0.6502 #>