liferegr {trtswitch}R Documentation

Parametric Regression Models for Failure Time Data

Description

Obtains the parameter estimates from parametric regression models with uncensored, right censored, left censored, or interval censored data.

Usage

liferegr(
  data,
  rep = "",
  stratum = "",
  time = "time",
  time2 = "",
  event = "event",
  covariates = "",
  weight = "",
  offset = "",
  id = "",
  dist = "weibull",
  robust = FALSE,
  plci = FALSE,
  alpha = 0.05
)

Arguments

data

The input data frame that contains the following variables:

  • rep: The replication for by-group processing.

  • stratum: The stratum.

  • time: The follow-up time for right censored data, or the left end of each interval for interval censored data.

  • time2: The right end of each interval for interval censored data.

  • event: The event indicator, 1=event, 0=no event.

  • covariates: The values of baseline covariates.

  • weight: The weight for each observation.

  • offset: The offset for each observation.

  • id: The optional subject ID to group the score residuals in computing the robust sandwich variance.

rep

The name(s) of the replication variable(s) in the input data.

stratum

The name(s) of the stratum variable(s) in the input data.

time

The name of the time variable or the left end of each interval for interval censored data in the input data.

time2

The name of the right end of each interval for interval censored data in the input data.

event

The name of the event variable in the input data for right censored data.

covariates

The vector of names of baseline covariates in the input data.

weight

The name of the weight variable in the input data.

offset

The name of the offset variable in the input data.

id

The name of the id variable in the input data.

dist

The assumed distribution for time to event. Options include "exponential", "weibull", "lognormal", and "loglogistic" to be modeled on the log-scale, and "normal" and "logistic" to be modeled on the original scale.

robust

Whether a robust sandwich variance estimate should be computed. In the presence of the id variable, the score residuals will be aggregated for each id when computing the robust sandwich variance estimate.

plci

Whether to obtain profile likelihood confidence interval.

alpha

The two-sided significance level.

Details

There are two ways to specify the model, one for right censored data through the time and event variables, and the other for interval censored data through the time (lower) and time2 (upper) variables. For the second form, we follow the convention used in SAS PROC LIFEREG:

Value

A list with the following components:

Author(s)

Kaifeng Lu, kaifenglu@gmail.com

References

John D. Kalbfleisch and Ross L. Prentice. The Statistical Analysis of Failure Time Data. Wiley: New York, 1980.

Examples


library(dplyr)

# right censored data
(fit1 <- liferegr(
  data = rawdata %>% mutate(treat = 1*(treatmentGroup == 1)),
  rep = "iterationNumber", stratum = "stratum",
  time = "timeUnderObservation", event = "event",
  covariates = "treat", dist = "weibull"))

# tobit regression for left censored data
(fit2 <- liferegr(
  data = tobin %>% mutate(time = ifelse(durable>0, durable, NA)),
  time = "time", time2 = "durable",
  covariates = c("age", "quant"), dist = "normal"))


[Package trtswitch version 0.1.2 Index]