I am trying to figure out the correct expression for the noncentrality parameter $\lambda_{ws}$ for the within-subjects effect in a one-way Repeated-Measures ANOVA with $k$ trials/groups. Comparing the calculation of $\lambda_{ws}$ from G*Power with my own attempts (based on the literature) I noticed an inconsistency. I'm not sure where things are going wrong, so I was hoping someone here could shed some light.
I started from a paper by Potvin and Schutz (2000, p. 348), who provided the following formula:
$$\lambda_{ws} = n\frac{\sum_{j = 1}^k (\mu_j-\mu)^2}{\sigma_{wg}^2(1-\bar{\rho})},$$
where $\mu_j$ is the mean for trial/group $j$, $\bar{\rho}$ is the average correlation between scores in the trials/groups, and $\sigma_{wg}^2$ is the within-trial (within-group) variance (assumed to be constant across trials/groups). Thus, $\lambda_{ws}$ is comparable to $\lambda$ from a 'regular' (between-subjects) one-way ANOVA, but it is just multiplied by a factor $c = \frac{1}{1-\bar{\rho}}$:
$$\lambda = nf^² = n\frac{\eta^2}{1-\eta^2} = n\frac{\sum_{j = 1}^k (\mu_j-\mu)^2}{\sigma_{wg}^2}= \frac{1}{c}\lambda_{ws} = (1-\bar{\rho})\lambda_{ws} \Rightarrow \lambda_{ws}=\frac{\lambda}{(1-\bar{\rho})}.$$
However, when I tried to calculate $\lambda_{ws}$ using G*Power, it seemed to be using a different formula. I couldn't find that formula anywhere in the official manual, but I came across this tutorial document. On page 34, it notes that:
$$\lambda_{gpower} = \frac{knf^2}{(1-\bar{\rho})} = k\lambda_{ws},$$
so the two are off by a factor $k$. My question therefore is: which one is correct? My hunch is that the G*Power formula is off: it appears to 'double-count' the 'treatment' sums of squares in the numerator (first it sums over the groups, and then it multiplies the result by $k$ again). This would have made sense to me if there were a within-between-interaction, and if $k$ represented the number of levels of the between-subjects factor, but that's not the case here.
I'm just not sure, though.
EDIT
Thanks to @dipetkov's answer below I was able to see for myself that the G*Power and Potvin & Schutz formulas are identical (I will maintain $k$ to denote the number of trials; @dipetkov used $q$):
$$\lambda_{gpower}= \frac{Nkf^2}{1-\bar{\rho}}= \frac{npkf^2}{(1-\bar{\rho})} = \frac{nkf^2}{(1-\bar{\rho})}$$ $$=\frac{nk}{(1-\bar{\rho})}\frac{\eta^2}{(1-\eta^2)}$$ $$= \frac{nk}{(1-\bar{\rho})}\frac{\sum_{j = 1}^k n_j(\mu_j-\mu)^2}{\sum_{j = 1}^k \sum_{i=1}^n (y_{ij}-\mu_j)^2}$$ $$= \frac{nk}{(1-\bar{\rho})}\frac{\sum_{j = 1}^k n_j(\mu_j-\mu)^2}{\sum_{j = 1}^k n_j\sigma_{wg(j)}^2}$$ $$= \frac{nk}{(1-\bar{\rho})}\frac{n\sum_{j = 1}^k (\mu_j-\mu)^2}{kn\sigma_{wg}^2}$$ $$= \frac{n}{(1-\bar{\rho})}\frac{\sum_{j = 1}^k (\mu_j-\mu)^2}{\sigma_{wg}^2}$$ $$= \lambda_{ws}$$