[R] p-value using survdiff

Robert Gentleman rgentlem at jimmy.harvard.edu
Thu Nov 22 18:09:15 CET 2001


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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list