Cox回归之变量筛选的R实现 (Stepwise Variable Selection in R)

参考链接:http://finzi.psych.upenn.edu/R/library/My.stepwise/html/My.stepwise.coxph.html

package

install.packages("My.stepwise")

Usage

My.stepwise.coxph(Time = NULL, T1 = NULL, T2 = NULL, Status = NULL,
  variable.list, in.variable = "NULL", data, sle = 0.15, sls = 0.15,
  vif.threshold = 999)

Arguments

Time

The 'Time' (time to an event) for the sepcified Cox's proportional hazards model as in coxph().

T1

The 'T1' (Start) of the long-form data for the sepcified Cox's model as in coxph().

T2

The 'T2' (Stop) of the long-form data for the sepcified Cox's model as in coxph().

Status

The 'Status' (event indicator) for the sepcified Cox's proportional hazards model as in coxph().

variable.list

A list of covariates to be selected.

in.variable

A list of covariate(s) to be always included in the regression model.

data

The data to be analyzed.

sle

The chosen significance level for entry (SLE).

sls

The chosen significance level for stay (SLS).

vif.threshold

The 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)

 

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值