Package 'crrstep'

Title: Stepwise Covariate Selection for the Fine & Gray Competing Risks Regression Model
Description: Performs forward and backwards stepwise regression for the Proportional subdistribution hazards model in competing risks (Fine & Gray 1999). Procedure uses AIC, BIC and BICcr as selection criteria. BICcr has a penalty of k = log(n*), where n* is the number of primary events.
Authors: Ravi Varadhan [aut, cre], Deborah Kuk [aut], Leon Wang [ctb]
Maintainer: Ravi Varadhan <[email protected]>
License: GPL (>= 2)
Version: 2024.1.1
Built: 2024-10-29 03:34:14 UTC
Source: https://github.com/cran/crrstep

Help Index


Stepwise regression procedure for the Fine & Gray regression model in competing risks

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.

Details

Package: crrstep
Type: Package
Version: 2023.1.1
Date: 2023-08.21
License: GPL (version 2)
LazyLoad: yes

The package contains a singe function crrstep, which implements backward and forward stepwise regression for the Fine & Gray regression model. The Fine & Gray model (Fine & Gray, 1999) estimates the hazard that corresponds to the cumulative incidence function of a certain event type. Selection criteria that are can be used are: AIC, BIC and BICcr. BICcr is a selection criteria based on the work by Volinksy and Raftery in which the penalty is k = log(n*), where n* is the total number of Type I events.

Author(s)

Ravi Varadhan & Deborah Kuk.

Maintainers: Ravi Varadhan <[email protected]>

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.

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 ~ 1 + x1 + x2 + x3 + x4 + x5 + as.factor(x6) + as.factor(x7) 

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

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

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

formula.int <- ftime ~ x1 + x2 + x3 + x4 + x4*as.factor(x6) + x5*as.factor(x7) 
ans3 <- crrstep(formula.int, , fstatus, data = as.data.frame(cov1), 
  direction = "backward", criterion = "AIC")

print(ans3)