therneau / survival

Survival package for R
390 stars 106 forks source link

add p.value in `survdiff` #201

Closed AlissonRP closed 2 years ago

AlissonRP commented 2 years ago

I added the p.value inside the list as commenting on https://github.com/therneau/survival/issues/198 and changed in cat p to p.value for consistency

df = leukemia
test = survdiff(Surv(df$time, df$status)~df$x, rho=0)
> test$p.value
[1] 0.065
> test 
Call:
survdiff(formula = Surv(df$time, df$status) ~ df$x, 
    rho = 0)

                    N Observed Expected (O-E)^2/E (O-E)^2/V
df$x=Maintained    11        7    10.69      1.27       3.4
df$x=Nonmaintained 12       11     7.31      1.86       3.4

 Chisq= 3.4  on 1 degrees of freedom, p.value= 0.07