[R] query: sample size calculation
P Ehlers
ehlers at math.ucalgary.ca
Fri May 26 15:24:15 CEST 2006
ManuelPerera-Chang at fmc-ag.com wrote:
> 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);
> }
Don't you want 'lower.tail = FALSE'?
Peter Ehlers
>
> but val doesnot get any close to 0.30/0.45.
>
> Thank you,
>
> Manuel
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list