crrstep: Stepwise regression for competing risks regression

crrstepR Documentation

Stepwise regression for competing risks regression

Description

Performs forward and backward stepwise regression for the Fine & Gray regression model in competing risks. Procedure uses AIC, BIC and BICcr as selection criteria. BICcr has a penalty of k = log(n*), where n* is the number of Type I events.

Usage

crrstep(formula, scope.min = ~1, etype, ..., subset, 
data, direction = c("backward", "forward"), 
criterion = c("AIC", "BICcr", "BIC"), crr.object = FALSE, 
trace = TRUE, steps = 100)

Arguments

formula

formula object where LHS is failure time and RHS is linear predictors; intercept ‘1’ should always be included.

scope.min

formula object denoting final model for backward selection and starting model for forward selection.

etype

integer variable that denotes type of failure for each person.

...

variables passed to ‘crr’ function; two key variables are failcode and cencode; see below in Description.

subset

subset of data to be used for model selection.

data

data-frame containing all the variables. Only complete cases are used in the analysis, i.e. rows of dataframe with missing values in any of the predictors are deleted.

direction

forward or backward direction for model selection.

criterion

selection criterion; default is AIC. BIC uses log(n) as penalty, where ‘n’ is total sample size, and BICcr uses log(n*) as the penalty where n* is the number of primary events.

crr.object

logical variable indicating whether to return final ‘crr’ object.

trace

logical indicating whether to display stepwise model selection process.

steps

maximum number of steps in stepwise selection.

Details

Based on the existing code of stepAIC in the MASS package. Variables passed to 'crr' function include two key variables: failcode and cencode. failcode is an integer value that denotes primary failure, and cencode is an integer denoting censoring event.

Value

variables

Variables in the final model

coefficients

The estimated coefficients of the variables

std.errors

Standard errors of the estimated coefficients

log.lik

The partial log-likelihood of the model

Author(s)

Ravi Varadhan & Deborah Kuk.

References

Fine, J. P. and Gray, R. J. (1999). A proportional hazards model for the subdistribution of a competing risk. Journal of the American Statistical Association.

Volinsky, C. T. and Raftery, A. E. (2000). Bayesian information criterion for censored survival models. Biometrics.

Kuk, D. and Varadhan, R. (2013). Model selection in competing risks regression. Statistics in Medicine.

See Also

crr

Examples

set.seed(123)
n <- 500
ftime <- rexp(n)
fstatus <- sample(0:2,n,replace=TRUE)
cov1 <- matrix(runif(5*n),nrow=n)
x61 <- as.factor(sample(3, size=n, rep=TRUE))
x71 <- as.factor(sample(5, size=n, rep = TRUE))
cov1 <- cbind(cov1, x61, x71)
dimnames(cov1)[[2]] <- c('x1','x2','x3','x4','x5', 'x6', 'x7')
formula1 <- ftime ~ x1 + x2 + x3 + x4 + x5 + as.factor(x6) + as.factor(x7) 

crrstep(formula1, , fstatus, data = as.data.frame(cov1), direction = "backward", criterion = "BIC")

ans2 <- crrstep(formula1, , fstatus, data = as.data.frame(cov1), direction = "forward", 
		failcode=2, criterion = "AIC")
ans2


crrstep documentation built on Aug. 23, 2023, 1:09 a.m.