estReg: Discrete Survival Basic Regression Model Fitting

View source: R/DiscSurvEstimation.R

estRegR Documentation

Discrete Survival Basic Regression Model Fitting

Description

Wrapper for estimation of discrete survival general linear model. Several preprocessing options such as time-dependent covariates are available.

Usage

estReg(
  dataShort,
  dataTransform = "dataLong",
  formulaVariable = ~timeInt,
  timeColumn,
  eventColumn,
  idColumn = NULL,
  timeAsFactor = TRUE,
  family = stats::binomial,
  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 ("dataLong") and with time dependent covariates ("dataLongTimeDep"). 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").

eventColumn

Column name of the event indicator (class "character"). It is required that this is a binary variable with 1=="event" and 0=="censored".

idColumn

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

timeAsFactor

Should the time intervals be coded as factor (class "logical")? Default is FALSE. In the default settings the column is treated as quantitative variable (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").

Note

Model is rescaled to exclude intercepts.

Author(s)

Thomas Welchowski t.welchowski@psychologie.uzh.ch

References

\insertRef

tutzModelDiscdiscSurv

See Also

dataLong, dataLongTimeDep, glm

Examples


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

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

# Estimate discrete survival continuation ratio model
estRegModel <- estReg(dataShort = SubUnempDur, dataTransform = "dataLong", 
formulaVariable =~ timeInt + age + ui + logwage * ui, 
eventColumn = "censor1", timeColumn = "spell")
summary(estRegModel)

# Predictions
SubUnempDurLong <- dataLong(dataShort = SubUnempDur, 
eventColumn = "censor1", timeColumn = "spell", timeAsFactor=TRUE)
preds <- predict(estRegModel, newdata = SubUnempDurLong)
head(preds)


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