[R] query: sample size calculation
ManuelPerera-Chang at fmc-ag.com
ManuelPerera-Chang at fmc-ag.com
Fri May 26 14:57:02 CEST 2006
Dear all,
I am doing something wrong.
I am trying to apply a formula for sample size calculation as in the book
"Design and Analysis of Clinical Trials", from Chow et all.
There a suggested sample size strategy uses the formula
0.30/0.45=F(0.80,2n,2n)/F(0.025,2n,2n)
which gives n=96, as in the book.
(here F(alfa,k,n) is the upper (alfa)th quantile of an F distribution with
k,n degrees of freedom)
I have been trying to get n=96 using the following code in R.
val<-rep(NA,200)
for (n in 1:200) {
val[n]<- qf(0.8, 2*n, 2*n,lower.tail = TRUE, log.p = FALSE)/qf(0.025,
2*n, 2*n,lower.tail = TRUE, log.p = FALSE);
}
but val doesnot get any close to 0.30/0.45.
Thank you,
Manuel
More information about the R-help
mailing list