Some minor comments [Power / Sample Size]

posted by Ben – Germany, 2011-11-23 22:12 (5322 d 09:01 ago) – Posting: # 7704
Views: 10,262

Thank you very much for your effort and help!

❝ ... I strongly argue that the differences are more probably due to the different number of degrees of freedom, namely df=n-1 in the so-called 'paired' design. You (having access to nQuery) can test it with my code suggestions below.


You're absolutely right! I didn't check very thoroughly but so far it seems that exactly these df are being used (this indeed makes sense as the CI is for difference in "paired means")

❝ Here some minor code suggestions: ...


You put in some nice features (starting value of n and the step size), awesome. One suggestion/question from myself: should it be n <- step*ceiling(n/step) instead of n <- step*trunc(n/step)? Otherwise we will get an error using e.g. w=0.3, sigma=0.2, design="2x2".

Also, one could think of including n=NULL or something like that as input parameter and then return the precision if a sample size is given, that is,
if (is.null(n)) {
...
} else {
   df <- eval(dfe)
   if (df < 1) {
   stop("n is too small!", call. = FALSE)
   }
   w <- sigma*sqrt(qchisq(1-gamma,df)/df*bk/n*qf(1-alpha,1,df))
   return(w)
}

The values of w coincide with those of nQuery (using "paired").

Best regards

Complete thread:

UA Flag
Activity
 Admin contact
23,655 posts in 4,993 threads, 1,570 registered users;
162 visitors (0 registered, 162 guests [including 15 identified bots]).
Forum time: 08:13 CEST (Europe/Vienna)

I have finally come to the konklusion
that a good reliable set ov bowels
iz worth more to a man
than enny quantity of brains.    Josh Billings

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5