estRegSmoothCompRisks: Discrete Survival Additive Model Fitting For Competing Risks

View source: R/DiscSurvEstimationCR.R

estRegSmoothCompRisksR Documentation

Discrete Survival Additive Model Fitting For Competing Risks

Description

Wrapper for estimation of discrete survival generalized, additive models for cause-specific competing risk models. Several preprocessing options such as time-dependent covariates are available and linear as well as smooth effects can be specified.

Usage

estRegSmoothCompRisks(
  dataShort,
  dataTransform = "dataLongCompRisks",
  formulaVariable = ~timeInt,
  timeColumn,
  eventColumns,
  eventColumnsAsFactor = FALSE,
  timeAsFactor = FALSE,
  idColumn = NULL,
  family = VGAM::multinomial,
  storeAugData = TRUE,
  ...
)

Arguments

dataShort

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

dataTransform

Specification of the data transformation function from short to long format (class "character"). There are two available options: Without time dependent covariates ("dataLongCompRisks") and with time dependent covariates ("dataLongCompRisksTimeDep"). The default is set to the former.

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.

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").

idColumn

Name of column of identification number of persons (class "character"). Default is set to use function dataLong, that does not need this argument.

family

Specifies the assumption about the response distribution and the link function. Default value is the discrete survival cause-specific competing risks model with multinomial logistic function (function multinomial).

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 vgam.

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 "vgam".

Author(s)

Thomas Welchowski t.welchowski@psychologie.uzh.ch

References

\insertRef

tutzModelDiscdiscSurv

\insertRefschmidCompRisksdiscSurv

See Also

dataLongCompRisks, dataLongCompRisksTimeDep, vgam

Examples


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

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

# Estimate cause-specific hazard rates
estModel <- estRegSmoothCompRisks(dataShort = SubUnempDur, dataTransform = "dataLongCompRisks", 
formulaVariable =~ timeInt + age + ui + logwage * ui, 
eventColumns = c("censor1", "censor2", "censor3", "censor4"), timeColumn = "spell")
estModel


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