```
```

## Power Analysis

```
```
Power analysis is an important aspect of experimental design. It allows us to determine the sample size required to detect an effect of a given size with a given degree of confidence. Conversely, it allows us to determine the probability of detecting an effect of a given size with a given level of confidence, under sample size constraints. If the probability is unacceptably low, we would be wise to alter or abandon the experiment.

The following four quantities have an intimate relationship:

1. sample size
2. effect size
3. significance level = P(Type I error) = probability of finding an effect that is not there
4. power = 1 - P(Type II error) = probability of finding an effect that is there

Given any three, we can determine the fourth.

The methods given below use R's Power Analysis (Pwr) package; this implements power analysis as outlined by Cohen (1988). The R functions that are made available here are listed below. A more detailed description is given here.

 Function Power Calculations pwr.t.test t-tests (one sample, 2 sample, paired) pwr.t2n.test t-test (two samples with unequal n) pwr.anova.test balanced one way ANOVA pwr.r.test correlation pwr.f2.test general linear model pwr.2p.test two proportions (equal n) pwr.2p2n.test two proportions (unequal n) pwr.p.test proportion (one sample) pwr.chisq.test chi-square test

For each of these functions, you enter three of the four quantities (effect size, sample size, significance level, power) and the fourth is calculated.

The significance level defaults to 0.05, but you can remove it if this is the quantity you would like to calculate.

Specifying an effect size can be a daunting task. ES formulas and Cohen's suggestions (based on social science research) are provided here. Cohen's suggestions should only be seen as very rough guidelines. Your own subject matter experience should be brought to bear.

 t-tests For t-tests, use one of the following two methods (N.B. Cohen suggests that d values of 0.2, 0.5, and 0.8 represent small, medium, and large effect sizes respectively). pwr.t.test - for t-test n is the sample size, d is the effect size, and type indicates a two-sample t-test, one-sample t-test or paired t-test: n:  (N.B. must be >= 2) d: significance level:  (N.B. must be <= 1) power:  (N.B. must be < 1) type: two.sample one.sample paired alternative: two.sided less greater pwr.t2n.test - t-test if you have unequal sample sizes Enter n1 & n2 and 2 of the 3 other fields to calculate the remaining field, where n1 and n2 are the sample sizes: n1:  (N.B. must be >= 2) n2:  (N.B. must be >= 2) d: significance level:  (N.B. must be <= 1) power:  (N.B. must be < 1) alternative: two.sided less greater ``` ``` ANOVA pwr.anova.test - for a one-way analysis of variance k is the number of groups and n is the common sample size in each group (N.B. Cohen suggests that f values of 0.1, 0.25, and 0.4 represent small, medium, and large effect sizes respectively): k:  (N.B. must be >= 2) n: f: significance level:  (N.B. must be <= 1) power:  (N.B. must be < 1) ``` ``` Correlations pwr.r.test - for correlation coefficients Enter 3 of the 4 fields to calculate the 4th, where n is the sample size and r is the correlation. We use the population correlation coefficient as the effect size measure. Cohen suggests that r values of 0.1, 0.3, and 0.5 represent small, medium, and large effect sizes respectively. n:  (N.B. must be >= 4) r: significance level:  (N.B. must be <= 1) power:  (N.B. must be < 1) ``` ``` Linear Models pwr.f2.test - for linear models (e.g. multiple regression) u and v are the numerator and denominator degrees of freedom. We use f2 as the effect size measure (N.B. Cohen suggests f2 values of 0.02, 0.15, and 0.35 represent small, medium, and large effect sizes): u: v: f2: significance level:  (N.B. must be <= 1) power:  (N.B. must be < 1) ``` ``` Tests of Proportions pwr.2p.test - two proportions (equal n) Enter 3 of the 4 fields to calculate the 4th, where h is the effect size and n is the common sample size in each group (N.B. Cohen suggests that h values of 0.2, 0.5, and 0.8 represent small, medium, and large effect sizes respectively): h: n: significance level:  (N.B. must be <= 1) power:  (N.B. must be < 1) alternative: two.sided less greater pwr.2p2n.test - for unequal n's Enter n1 & n2 and 2 of the 3 other fields to calculate the remaining field, where h is the effect size and n's are the sample sizes in each group: h: n1:  (N.B. must be >= 2) n2: significance level:  (N.B. must be <= 1) power:  (N.B. must be < 1) alternative: two.sided less greater pwr.p.test - to test a single proportion Enter 3 of the 4 fields to calculate the 4th, for both two sample and one sample proportion tests, you can specify two.sided, less, or greater to indicate a two-tailed, or one-tailed test. A two tailed test is the default. h: n: significance level:  (N.B. must be <= 1) power:  (N.B. must be < 1) alternative: two.sided less greater ``` ``` Chi-square Tests pwr.chisq.test - for chi-square tests w is the effect size, N is the total sample size, and df is the degrees of freedom (N.B. Cohen suggests that w values of 0.1, 0.3, and 0.5 represent small, medium, and large effect sizes respectively): w: N: df: significance level:  (N.B. must be <= 1) power:  (N.B. must be < 1)
```

```
Contact: help@searchbreast.org