Dear all, Does anyone knows how I could extract the p-value in:> survdiff(Surv(tempo,status) ~ grupo,data=dados1,rho=1)Call: survdiff(formula = Surv(tempo, status) ~ grupo, data = dados1, rho = 1) N Observed Expected (O-E)^2/E (O-E)^2/V grupo=1 21 5.12 12.00 3.94 14.5 grupo=2 21 14.55 7.68 6.16 14.5 Chisq= 14.5 on 1 degrees of freedom, p= 0.000143 Since with the commands below I cannot.> fit<-survdiff(Surv(tempo,status) ~ grupo,data=dados1,rho=1) > attributes(fit)$names [1] "n" "obs" "exp" "var" "chisq" "call" $class [1] "survdiff" I would appreciate any suggestion. RAL PS: Please send any to raleandr at carpa.ciagri.usp.br -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I didn't see an obvious way (but there probably is one). Anyways, getPval <- function(x) { if( is.matrix(x$obs)) etmp <- apply(x$exp, 1, sum) else etmp <- x$exp df<- (sum(1 * (etmp > 0))) - 1 pv <- 1 - pchisq(x$chisq, df) pv } mimics what is done in print.survdiff so it should be correct when print.survdiff is. -- +---------------------------------------------------------------------------+ | Robert Gentleman phone : (617) 632-5250 | | Associate Professor fax: (617) 632-2444 | | Department of Biostatistics office: M1B28 | Harvard School of Public Health email: rgentlem at jimmy.dfci.harvard.edu | +---------------------------------------------------------------------------+ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._