R中有幸存的东西吗?

时间:2015-04-06 16:09:47

标签: r survival-analysis

在尝试将Weibull比例风险模型拟合到R中的gehan数据时,我注意到更改gehan数据的顺序会改变输出。

library(MASS)
library(survival)
attach(gehan)

survreg(Surv(time, cens) ~ treat, gehan, dist = "weibull")

产生以下输出:

Call:
survreg(formula = Surv(time, cens) ~ treat, data = gehan, dist = "weibull")

Coefficients:
 (Intercept) treatcontrol 
 3.515687    -1.267335 

Scale= 0.7321944 

Loglik(model)= -106.6   Loglik(intercept only)= -116.4
Chisq= 19.65 on 1 degrees of freedom, p= 9.3e-06 
n= 42 

但是,当我手动将数据输入R时,

control <- c(1,1,2,2,3,4,4,5,5,8,8,8,8,11,11,12,12,15,17,22,23)
control.status <- c(rep(1,21))
treatment <- c(6,6,6,6,7,9,10,10,11,13,16,17,19,20,22,23,25,32,32,34,35)
treatment.status <- c(1,1,1,0,1,0,1,0,0,1,1,0,0,0,1,1,0,0,0,0,0)

new.time <- c(control,treatment)
new.status <- c(control.status,treatment.status)
group <- as.factor(c(rep("control",21),rep("treatment",21)))
parametrik.surv <- Surv(new.time, new.status)
parametrik.fit <- survreg( parametrik.surv  ~ group, dist="w")

这是一个略有不同的输出:

 Call:
survreg(formula = parametrik.surv ~ group, dist = "w")

Coefficients:
(Intercept) grouptreatment 
  2.248352       1.267335 

Scale= 0.7321944 

Loglik(model)= -106.6   Loglik(intercept only)= -116.4
Chisq= 19.65 on 1 degrees of freedom, p= 9.3e-06 
n= 42 

此外,在一本书beta_0中,beta_1和比例分别为0.98,1.27和1.37。知道是什么原因引起的吗?

1 个答案:

答案 0 :(得分:2)

您重命名了治疗方法,因此在一个模型中使用“control”作为参考组,在另一个模型中使用“6-MP”作为参考组。