Re: [R] Log rank test power calculations

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Thu, 31 Jan 2008 13:00:47 -0700

Here is one approach using simulation:  

library(survival)
lrsim1 <- function(n, diff=0) {
 n1 <- round( .8 * n )
 n2 <- n - n1

 tmp.df <- data.frame( group=rep(c('a','b'), c(n1,n2) ) )
 tmp.time <- rexp( n, 1/rep(c(3,3+diff),c(n1,n2)) )
 tmp.cens <- rexp( n, 1/4 )
 tmp.df$time <- pmin(tmp.time,tmp.cens)
 tmp.df$status <- ifelse( tmp.time <= tmp.cens, 1, 0 )
 tmp.c <- survdiff( Surv(time,status) ~ group, data=tmp.df )$chisq
 pchisq( tmp.c, 1, lower.tail=FALSE )
}
out1 <- replicate(1000, lrsim1(1000,1) ) mean( out1 <= 0.05 )  

now just change what you want to change and rerun to estimate a new power (you may want to only do 100 replicates until you find the general area of interest).  

Hope this helps,


From: r-help-bounces_at_r-project.org on behalf of Daniel Brewer Sent: Thu 1/31/2008 8:53 AM
To: r-help_at_stat.math.ethz.ch
Subject: [R] Log rank test power calculations

Does anyone have any ideas how I could do a power calculation for a log rank test. I would like to know what the suggested sample sizes would be to pick a difference when the control to active are in a ratio of 80% to 20%.

Thanks

Dan

--

**************************************************************
Daniel Brewer, Ph.D. Institute of Cancer Research Email: daniel.brewer_at_icr.ac.uk
**************************************************************
The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:13}} ______________________________________________ R-help_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Received on Thu 31 Jan 2008 - 20:07:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 31 Jan 2008 - 21:30:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive