estRegSubDist: Discrete Survival Subdistribution Fitting

View source: R/DiscSurvEstimationCR.R

estRegSubDistR Documentation

Discrete Survival Subdistribution Fitting

Description

Wrapper for estimation of discrete survival regression subdistribution hazard models that includes data preprocessing.

Usage

estRegSubDist(
  dataShort,
  formulaVariable = ~timeInt,
  timeColumn,
  eventColumns,
  eventColumnsAsFactor = FALSE,
  eventFocus,
  timeAsFactor = FALSE,
  family = stats::binomial,
  storeAugData = TRUE,
  ...
)

Arguments

dataShort

Original data set in short format with each row corresponding to one independent observation (class "data.frame").

formulaVariable

Specifies the right hand side of the regression formula (class "formula"). The default is to use the discrete time variable, which corresponds to a covariate free hazard. It is recommended to always include the discrete time variable "timeInt".

timeColumn

Character giving the column name of the observed times. It is required that the observed times are discrete (class "integer").

eventColumns

Character vector giving the column names of the event indicators without censoring column (class "character"). It is required that all events are binary encoded. If the sum of all event indicators is zero, then this is interpreted as a censored observation. Alternatively a column name of a factor representing competing events can be given. In this case the argument eventColumnsAsFactor has to be set TRUE and the first level is assumed to represent censoring.

eventColumnsAsFactor

Should the argument eventColumns be intepreted as column name of a factor variable (class "logical")? Default is FALSE.

eventFocus

Column name of the event of interest or type 1 event (class "character").

timeAsFactor

Specifies if the computed discrete time intervals should be converted to a categorical variable (class "logical"). Default is FALSE. In the default settings the discret time intervals are treated as quantitative (class "numeric").

family

Specifies the assumption about the response distribution and the link function. Default value is the discrete survival continuation ratio model with logit-link (for comparison see family).

storeAugData

Should the augmented data set be saved (class "logical")? Defaults is TRUE. The data set is available as attribute "augData".

...

Specification of additional arguments in function glm.

Details

Variables in argument formulaVariable need to be separated by "+ ". For example if the two variables timeInt and X1 should be included the formula would be "~ timeInt + X1". The variable timeInt is constructed before estimation of the model.

Value

Returns an object of class c("glm", "lm"). The attribute "subDistWeights" saves the subdistribution weights used in the estimation.

Author(s)

Thomas Welchowski t.welchowski@psychologie.uzh.ch

References

\insertRef

bergerSubdistdiscSurv

See Also

dataLongCompRisks, estCompRisksGEE, estRegSmoothCompRisks, glm

Examples


# Example with unemployment data
library(Ecdat)
data(UnempDur)

# Select subsample
SubUnempDur <- UnempDur[1:100, ]

# Estimate GEE models for all events
estModel <- estRegSubDist(dataShort = SubUnempDur,
formulaVariable =~ timeInt + age + ui + logwage * ui, 
eventColumns = c("censor1", "censor2", "censor3", "censor4"), timeColumn = "spell",
eventFocus="censor1")
summary(estModel)


discSurv documentation built on April 29, 2026, 9:07 a.m.