<%
GET <- req$GET()
p1 <- ifelse(is.null(GET$p1),.95,as.numeric(GET$p1))
p2 <- ifelse(is.null(GET$p2),.7,as.numeric(GET$p2))
mo <- ifelse(is.null(GET$mo),9,as.numeric(GET$mo))
options(hverbose=FALSE,verbose=FALSE)
t <- tempfile()
sink(t)
library(Hmisc)
sc <- Weibull2(c(1,3),c(p1,p2))
f <- Quantile2(sc,
	hratio=function(x) ifelse(x <= mo/12, 1, .75),
	dropin=function(x) ifelse(x <= .5, 0, .15 * (x-.5)/(5-.5)),
	dropout=function(x) .3*x/5
)
rcens <- function(n) 1 + (5-1) * (runif(n) ^ .5)
rcontrol <- function(n) f(n,'control')
rinterv <- function(n) f(n,'intervention')
set.seed(211)
x <- spower(rcontrol,rinterv,rcens, nc=350, ni=350, test=logrank, nsim=300)
sink()
unlink(t)
%>
<%=format(x,digits=5)%>
