phregr {lrstat}R Documentation

Proportional hazards regression model

Description

Obtains the hazard ratio estimates from the proportional hazards regression model with right censored or counting process data.

Usage

phregr(
  data,
  rep = "rep",
  stratum = "stratum",
  time = "time",
  time2 = "time2",
  event = "event",
  covariates = "treat",
  weight = "weight",
  id = "id",
  ties = "efron",
  robust = 0L
)

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 counting process data.

  • time2: The right end of each interval for counting process data only. Intervals are assumed to be open on the left and closed on the right, and event indicates whether an event occurred at the right end of each interval.

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

  • covariates: The values of baseline covariates (and time-dependent covariates in each interval for counting process data). This is the full-rank design matrix for the Cox model, assuming that factor variables have already been expanded into dummy variables.

  • weight: The weight for each observation.

  • id: The optional subject ID for counting process data with time-dependent covariates.

rep

The name of the replication variable in the input data.

stratum

The name of the stratum variable in the input data.

time

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

time2

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

event

The name of the event variable in the input data.

covariates

The vector of names of baseline and time-dependent covariates in the input data.

weight

The name of the weighting variable in the input data.

id

The name of the id variable in the input data.

ties

The method for handling ties with options including "breslow" and "efron" (default).

robust

Whether a robust sandwich variance estimate should be computed. The default is TRUE if there are fractional weights or there is at least 1 id with >1 event. In the presence of the id variable, the score residual will be aggregated for each id when computing the robust sandwich variance estimate.

Value

A list with the following components:

Author(s)

Kaifeng Lu, kaifenglu@gmail.com

Examples


library(dplyr)

# Example 1 with right-censored data
phregr(data = rawdata %>% mutate(treat = 1*(treatmentGroup == 1)),
       rep = "iterationNumber", stratum = "stratum",
       time = "timeUnderObservation", event = "event",
       covariates = "treat")

# Example 2 with counting process data and robust variance estimate
phregr(data = heart %>% mutate(rx = as.numeric(transplant) - 1),
       time = "start", time2 = "stop", event = "event",
       covariates = c("rx", "age"), id = "id", robust = 1)


[Package lrstat version 0.2.9 Index]