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: [EMAIL PROTECTED] on behalf of Daniel Brewer
Sent: Thu 1/31/2008 8:53 AM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
**************************************************************


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

Reply via email to