[Gsdesign-commits] r270 - pkg/gsDesign/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Oct 23 23:59:06 CEST 2010
Author: keaven
Date: 2010-10-23 23:59:06 +0200 (Sat, 23 Oct 2010)
New Revision: 270
Modified:
pkg/gsDesign/R/nEvents.R
Log:
nEvents: corrected se calc and reorganized table output option
Modified: pkg/gsDesign/R/nEvents.R
===================================================================
--- pkg/gsDesign/R/nEvents.R 2010-10-03 12:30:30 UTC (rev 269)
+++ pkg/gsDesign/R/nEvents.R 2010-10-23 21:59:06 UTC (rev 270)
@@ -3,14 +3,16 @@
delta <- -c * (log(hr) - log(hr0))
if (n[1] == 0)
{ n <- (qnorm(1-alpha)+qnorm(1-beta))^2/delta^2
- if (tbl) n <- cbind(hr, n = ceiling(n), alpha=alpha, beta=beta, Power=1-beta, delta=delta,
- ratio=ratio, se=sqrt(1/c/ceiling(n)))
+ if (tbl) n <- cbind(hr = hr, n = ceiling(n), alpha = alpha, beta = beta,
+ Power = 1-beta, delta = delta, ratio = ratio,
+ hr0 = hr0, se = 1/c/sqrt(ceiling(n)))
return(n)
}
else
{ pwr <- pnorm(-(qnorm(1-alpha)-sqrt(n) * delta))
- if (tbl) pwr <- cbind(hr, n=n, alpha=alpha, beta=1-pwr, Power=pwr, delta=delta,
- ratio=ratio, se=sqrt(1/(c*n)))
+ if (tbl) pwr <- cbind(hr = hr, n = n, alpha = alpha, beta = 1-pwr,
+ Power = pwr, delta = delta, ratio = ratio,
+ hr0 = hr0, se = sqrt(1/n)/c)
return(pwr)
}
}
More information about the Gsdesign-commits
mailing list