参考链接:http://finzi.psych.upenn.edu/R/library/My.stepwise/html/My.stepwise.coxph.html
packageinstall.packages("My.stepwise")
Usage My.stepwise.coxph(Time = NULL, tzdgk, fdgq, Status = NULL, variable.list, in.variable = "NULL", data, sle = 0.15, sls = 0.15, vif.threshold = 999) Arguments TimeThe 'Time' (time to an event) for the sepcified Cox's proportional hazards model as in coxph().
T1The 'T1' (Start) of the long-form data for the sepcified Cox's model as in coxph().
T2The 'T2' (Stop) of the long-form data for the sepcified Cox's model as in coxph().
StatusThe 'Status' (event indicator) for the sepcified Cox's proportional hazards model as in coxph().
variable.listA list of covariates to be selected.
in.variableA list of covariate(s) to be always included in the regression model.
dataThe data to be analyzed.
sleThe chosen significance level for entry (SLE).
slsThe chosen significance level for stay (SLS).
vif.thresholdThe chosen threshold value of variance inflating factor (VIF).
Examples ## Not run: The data 'lung' is available in the 'survival' package.## End(Not run)if (requireNamespace("survival", quietly = TRUE)) { lung <- survival::lung}names(lung)dim(lung)my.data <- na.omit(lung)dim(my.data)head(my.data)my.data$status1 <- ifelse(my.data$status==2,1,0)my.variable.list <- c("inst", "age", "sex", "ph.ecog", "ph.karno", "pat.karno")My.stepwise.coxph(Time = "time", Status = "status1", variable.list = my.variable.list, in.variable = c("meal.cal", "wt.loss"), data = my.data)my.variable.list <- c("inst", "age", "sex", "ph.ecog", "ph.karno", "pat.karno", "meal.cal", "wt.loss")My.stepwise.coxph(Time = "time", Status = "status1", variable.list = my.variable.list, data = my.data, sle = 0.25, sls = 0.25)