Learn R Programming

pec (version 2.0.8)

selectCox: Backward variable selection in the Cox regression model

Description

This is a wrapper function which first selects variables in the Cox regression model using fastbw from the rms package and then returns a fitted Cox regression model with the selected variables.

Usage

selectCox(formula,data,rule="aic")

Arguments

formula
A formula object with a Surv object on the left-hand side and all the variables on the right-hand side.
data
Name of an data frame containing all needed variables.
rule
The method for selecting variables. See fastbw for details.

Details

This function first calls cph then fastbw and finally cph again.

References

Mogensen, UB and Ishwaran, H and Gerds, TA (2010) Evaluating random forests for survival analysis using prediction error curves Research report 10/8. Department of Biostatistics, University of Copenhagen

Examples

Run this code
data(GBSG2)
f <- selectCox(Surv(time,cens)~horTh + age + menostat + tsize + tgrade + pnodes + progrec + estrec ,data=GBSG2)

Run the code above in your browser using DataLab