|
发表于 2015-8-11 08:09:59
|
显示全部楼层
- > ##试一试
- > library('survival')
- > fit <- survdiff(Surv(time,status)~x,data=aml)
- > fit
- Call:
- survdiff(formula = Surv(time, status) ~ x, data = aml)
- N Observed Expected (O-E)^2/E (O-E)^2/V
- x=Maintained 11 7 10.69 1.27 3.4
- x=Nonmaintained 12 11 7.31 1.86 3.4
- Chisq= 3.4 on 1 degrees of freedom, p= 0.0653
- > 1 - pchisq(fit$chisq, length(fit$n) - 1)
- [1] 0.06533932
- >
- > fit1 <- survdiff(Surv(tstart,status)~treat+sex,data=cgd)
- > fit1
- Call:
- survdiff(formula = Surv(tstart, status) ~ treat + sex, data = cgd)
- N Observed Expected (O-E)^2/E (O-E)^2/V
- treat=placebo, sex=male 100 48 42.1 0.829 2.202
- treat=placebo, sex=female 20 8 6.2 0.520 0.679
- treat=rIFN-g, sex=male 68 17 22.7 1.434 2.389
- treat=rIFN-g, sex=female 15 3 5.0 0.799 0.997
- Chisq= 4.2 on 3 degrees of freedom, p= 0.24
- > 1 - pchisq(fit1$chisq, length(fit1$n) - 1)
- [1] 0.2400191
复制代码 |
|