[R] Power Analysis

Marc Schwartz marc_schwartz at me.com
Tue Apr 19 16:48:34 CEST 2011


On Apr 19, 2011, at 8:43 AM, Schatzi wrote:

> "Inter ocular data"
> Quite amusing :)
> Thank you for the help. For some reason I was thinking that I could get the
> n values for the combined test, but that doesn't make sense as there could
> be an infinite number of combinations of n values.
> Thanks again for the replies.


Just a quick follow up comment, specifically pertaining to the description of function arguments in R's help files. If a function argument can take more than one value, the argument description in the help file will typically (albeit, not absolutely always) include the word 'vector'. For example:

 x    a numeric vector ...

and frequently, the examples in the help files would include such use. The Details section of the help file will also typically elaborate on this, where appropriate, perhaps based upon context.

What you were observing, is an unintended consequence of the vector cycling of your 'n' and 'sd' arguments internally in the function, enabling the result to include two values in the output, where in fact, only one is intended. This is, as was noted by Albyn, the result of two independent power analyses.

Also, there was a post some time ago with a proposal from Claus Ekstrøm, describing a modification of power.t.test() to handle different sample sizes and variances:

  http://tolstoy.newcastle.edu.au/R/devel/03b/0492.html

which might be worth a look. I don't see a reply and needless to say, the modification has not been made to the core R function.

HTH,

Marc Schwartz



More information about the R-help mailing list