Next: precedence Up: MacAnova Help File Previous: power()   Contents

# power2()

Usage:
 ```power2(noncent2,numDF,denomDF,alpha), noncent2 >= 0, 0 < alpha < 1, numDF >0, denomDF > 0; some or all arguments may be vectors ```

Keywords: probabilities, glm, anova, regression
```power2(noncen2,numDF,denomDF,alpha) computes the power for an F test
with numDF numerator degrees of freedom, denomDF denominator degrees of
freedom, a significance level of alpha, and noncentrality parameter
noncen2.

The noncentrality parameter noncen2 = sum(n_i*(effect_i)^2)/sigma^2,
where n_i and effect_i = mu_i - mu_all are the sample size and treatment
effect for group i, with mu_i = treatment i mean and mu_all =
sum(n_i*mu_i)/sum(n_i).

An more mathematical definition is
noncen2 = numDF*(E[Numerator MS]/E[denominator MS] - 1);

Note that this differs from the n=1 non-centrality parameter expected by
power() which does not include a sample size.  For example, you will get
Cmd> power2(nrep*noncen,ngrp-1,(nrep-1)*ngrp,alpha)
and
Cmd> power(noncen,ngrp,nrep,alpha)

power2(n*mu_a^2/sigma^2,1,n-1,alpha) computes the power against the
alternative hypothesis H_a: mu = mu_a of a single-sample two-tail t-test
of H_0: mu = 0 based on a sample of size n.  To compute the power of a
one-tail t-test, see cumstu:"non_central_t".

Some or all of the arguments of power2() may be vectors, in which case
all non-scalars must be the same length, which will also be the length
of the result.  For example, you can compute a power as a function of
noncen2 by, say
Cmd> power2(run(0,100)*1.2,10,20,.05)

If nrep was computed as samplesize(noncen,ngrp,alpha,pwr), the value of
power2(nrep*noncen,ngrp-1,(nrep-1)*ngrp,alpha) should be approximately
equal to pwr, but no smaller.

power2() is useful for computing the power of a test for a contrast, or
for interaction and related effects where the error degrees of freedom
are complicated functions of n.