* =======================================================================
* File: power analysis.SPS .
* Date: 09-Oct-2003 .
* Author: Bruce Weaver, weaverb@mcmaster.ca .
* Notes: Power analysis examples.
* ======================================================================= .
* The following examples are from a paper by D'Amico, Neilands, and
* Zambarano in Behavior Research Methods, Instruments, & Computers,
* 2001, 33(4), 479-484.
* These examples use the MATRIX DATA command to input the data.
* For a brief explanation of how this works, go to
* http://www.utexas.edu/cc/faqs/stat/spss/spss33.html .
* -------------------------------------------------- .
* Example 1: ANCOVA with 3 groups and 2 covariates .
* -------------------------------------------------- .
* The data for this example are as follows.
* Patient # of Parent .
* Anxiety Siblings Anxiety .
* AGE GROUP M SD M SD M SD .
* 6-12 7.5 1.9 3 1 4 2.3 .
* 13-19 6.8 2.5 2 2 5 1.4 .
* 20-45 7.1 2.1 4 1 6 1.8 .
* Patient Anxiety is the dependent variable.
* Age Group is the independent variable.
* # of siblings and Parent Anxiety are covariates.
* The following syntax reads in these data in matrix format.
matrix data
variables = agegroup rowtype_ pat_anx sibnumbr prnt_anx
/factor = agegroup
/format = lower nodiagonal.
begin data.
1 mean 7.5 3.0 4.0
1 n 50 50 50
2 mean 6.8 2.0 5.0
2 n 50 50 50
3 mean 7.1 4.0 6.0
3 n 50 50 50
. sd 2.17 1.33 1.83
. corr 0.3
. corr 0.3 0.3
end data.
* NOTE: Only 3 SDs are read in, one for the DV, and one for each covariate.
* These are MEAN standard deviations, i.e., mean of the SDs for the
* 3 age groups. For Patient Anxiety, for example, the mean SD is
* (1.9 + 2.5 + 2.1)/3 = 2.17. Using the mean SD makes sense if
* the assumption of homogeneous variances is tenable. You can enter
* the SDs for each group (like you do the means), but you have to
* also enter the mean SDs as we did in order for the procedure to
* work properly. (I tried it with only the individual group SDs,
* and got an error message indicating that needed SDs were missing.)
manova
pat_anx by agegroup(1,3) with prnt_anx sibnumbr
/method = unique
/error = within+residual
/matrix = in(*)
/power t (.05) F (.05)
/print signif (mult averf)
/noprint param(estim).
* For the main effect of Age Group, power = 0.742.
* This is a bit lower than the usual figure one shoots for, 0.80.
* So let's repeat the exercise, but with increased sample sizes.
* The following sets each group size = 60 instead of 50.
matrix data
variables = agegroup rowtype_ pat_anx sibnumbr prnt_anx
/factor = agegroup
/format = lower nodiagonal.
begin data.
1 mean 7.5 3.0 4.0
1 n 60 60 60
2 mean 6.8 2.0 5.0
2 n 60 60 60
3 mean 7.1 4.0 6.0
3 n 60 60 60
. sd 2.17 1.33 1.83
. corr 0.3
. corr 0.3 0.3
end data.
manova
pat_anx by agegroup(1,3) with prnt_anx sibnumbr
/method = unique
/error = within+residual
/matrix = in(*)
/power t (.05) F (.05)
/print signif (mult averf)
/noprint param(estim).
* With n=60 per group, Power for the main effect of Age Group = 0.823 .
* ---------------------------------------- .
* Power for One-way ANOVA on the same data .
* ---------------------------------------- .
* Suppose you dropped the two covariates from the analysis,
* and used one-way ANOVA to analyze these data. Power would
* be calculated as shown below (for n=60 per group).
matrix data
variables = agegroup rowtype_ pat_anx
/factor = agegroup .
begin data.
1 mean 7.5
1 n 60
2 mean 6.8
2 n 60
3 mean 7.1
3 n 60
. sd 2.17
. corr 1
end data.
* NOTE THE FOLLOWING CHANGES TO THE MATRIX DATA COMMAND (compared to previous example).
* [1] The "/format = lower nodiagonal" line has been removed;
* [2] The correlation matrix consists of a single line "corr 1".
* We only need one line to represent the correlation matrix, because
* the correlation is of the DV with itself.
manova
pat_anx by agegroup(1,3)
/method = unique
/error = within+residual
/matrix = in(*)
/power t (.05) F (.05)
/print signif (mult averf)
/noprint param(estim).
* Without the 2 covariates, power drops from .823 to .329.
* ---------------------------------------------------------- .
* Example 2: MANOVA with 3 groups and 2 dependent variables .
* ---------------------------------------------------------- .
* Research Question: Are there differences among 3 ethnic groups
* on ratings of risks and benefits of alcohol consumption?
* Independent variable: ethnic group (3 levels).
* Dependent variables: 1) ratings of risks of alcohol consumption
* 2) ratings of benefits of alcohol consumption.
* Read in data in matrix format.
matrix data
variables = group rowtype_ risk benefit
/factor = group
/format = lower nodiagonal.
begin data.
1 mean 4.8 3.9
1 n 20 20
2 mean 5.3 4.0
2 n 20 20
3 mean 5.8 3.5
3 n 20 20
. sd 1.27 1.4
. corr .3
end data.
manova
risk benefit by group(1,3)
/method = unique
/error = within+residual
/matrix = in(*)
/power t (.05) F (.05)
/print signif (mult averf)
/noprint param(estim).
* There are 3 Power estimates to examine here:
* 1) Power = 0.57 for the univariate test for RISK
* 2) Power = 0.17 for the univariate test for BENEFIT
* 3) Power = 0.65 to 0.67 for the various multivariate tests .
* You would probably want to add more subjects here, no matter what.
* But how many more would depend on which of the DVs you were
* primarily interested in. If RISK is of primary concern, and
* you were not too bothered about BENEFIT, you would not need to
* add as many subjects to get the Power for RISK up to acceptable
* levels. But if you wanted to have 80% power for BENEFIT, you'd
* have to add a lot more.
* Let's try again with n = 30 per group instead of 20.
matrix data
variables = group rowtype_ risk benefit
/factor = group
/format = lower nodiagonal.
begin data.
1 mean 4.8 3.9
1 n 30 30
2 mean 5.3 4.0
2 n 30 30
3 mean 5.8 3.5
3 n 30 30
. sd 1.27 1.4
. corr .3
end data.
manova
risk benefit by group(1,3)
/method = unique
/error = within+residual
/matrix = in(*)
/power t (.05) F (.05)
/print signif (mult averf)
/noprint param(estim).
* We now have roughly 85% power for the multivariate test,
* power = 0.77 for RISK, and power = 0.23 for BENEFIT .
* ---------------------------------------------------------- .
* Example 3: Mixed design (between-within) ANOVA .
* ---------------------------------------------------------- .
* Dependent variable: Ratings of depression .
* Between-subjects factor: Group (3 levels).
* Within-subjects factor: Time (DV measured on 3 occasions).
* The effect of most interest is the Group x Time interaction.
* How many subjects do we need to have 80% power for this term?.
* Read in data in matrix format .
matrix data
variables = group rowtype_ depress1 depress2 depress3
/factor = group
/format = lower nodiagonal.
begin data.
1 mean 11 10 9
1 n 33 33 33
2 mean 11 10 10
2 n 33 33 33
3 mean 11 11 10
3 n 34 34 34
. sd 2.3 2.0 1.8
. corr 0.3
. corr 0.3 0.3
end data.
manova
depress1 depress2 depress3 by group(1,3)
/wsfactors depress(3)
/method = unique
/error = within+residual
/matrix = in(*)
/power t (.05) F (.05)
/print signif (mult averf)
/noprint param(estim).
* Power = 0.56 for the interaction term, so we need to increase n.
* Try again with n = 55 per group .
matrix data
variables = group rowtype_ depress1 depress2 depress3
/factor = group
/format = lower nodiagonal.
begin data.
1 mean 11 10 9
1 n 55 55 55
2 mean 11 10 10
2 n 55 55 55
3 mean 11 11 10
3 n 55 55 55
. sd 2.3 2.0 1.8
. corr 0.3
. corr 0.3 0.3
end data.
manova
depress1 depress2 depress3 by group(1,3)
/wsfactors depress(3)
/method = unique
/error = within+residual
/matrix = in(*)
/power t (.05) F (.05)
/print signif (mult averf)
/noprint param(estim).
* With n=55 per group, power = .813 for the interaction term.
* ======================================================================= .