Re: sample size specification in pwr2::pwr.2way

peter dalgaard <[email protected]>
Newsgroups gmane.comp.lang.r.general
Message-ID <[email protected]>
As for the logic, I dunno, but the source code has

pwr.fA<-function(a=a, b=b, alpha=alpha, size.A=size.A, f.A = NULL, delta.A=NULL, sigma.A=NULL){
N=size.A*a*b
if (is.null(f.A)) {f.A<-sqrt(((1/a)*(delta.A/2)^2*2)/sigma.A^2)
lambda<-N*f.A^2
...
pwr.fB<-function(a=a, b=b, alpha=alpha, size.B=size.B, f.B=NULL, delta.B=NULL, sigma.B=NULL){
N=size.B*a*b
if (is.null(f.B)) {f.B<-sqrt(((1/b)*(delta.B/2)^2*2)/sigma.B^2)
lambda<-N*f.B^2
 

I.e., the N differs between the two power calculations in pwrA and pwrB. You may want to check with the reference they cite...

-pd
   



> On 14 Oct 2025, at 18:39 , Floris van Vugt <[email protected]> wrote:
> 
> Dear R Help list,
> 
> My question is how sample size is specified in 2-way ANOVA power calculation in the pwr2 package.
> 
> In the function pwr2::pwr.2way documentation it gives an example use (source https://rdrr.io/cran/pwr2/man/pwr.2way.html) :
> ```
> ## Example 1
> pwr.2way(a=3, b=3, alpha=0.05, size.A=4, size.B=5, f.A=0.8, f.B=0.4)
> ```
> 
> I have trouble understanding what the total sample size is in this case. The documentation says `a` refers to the number of groups in Factor A, and `size.A` is the sample size per group in Factor A. Similarly for Factor B.
> 
> Based on that, I inferred that Factor A is supposed to have 3 groups with 4 individuals per group, meaning a total of 12 individuals in the experiment as a whole. However, in Factor B there are 3 groups with 5 individuals per group, which would lead to a total of 15 individuals. So my conclusions are contradictory: are there 12 or 15 individuals in this experimental design? Or yet a different number?
> 
> Any help appreciated.
> 
> Best wishes
> Floris
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> [email protected] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: [email protected]  Priv: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.