GraphPad Prism 5 Two-Way ANOVA
GraphPad Prism 5 Two-Way ANOVA
Page 1 of 28
Two-way ANOVA
11/18/2009
Two-way ANOVA
Page 2 of 28
11/18/2009
Two-way ANOVA
Page 3 of 28
Of course, the ANOVA results will be identical no matter which way you enter the data. But the
choice does matter, as it influences how the graph will appear and how Prism can do multiple
comparison post tests.
11/18/2009
Two-way ANOVA
Page 4 of 28
Repeated measures
Choose a repeated-measures analysis when the experiment used paired or matched subjects.
Prism can calculate repeated-measures two-way ANOVA with matching by either row or column,
but not both. Details. This is sometimes called a mixed model.
11/18/2009
Two-way ANOVA
Page 5 of 28
You can only choose repeated measures when you have entered two or more side-by-side values
into subcolumns for each row and dataset.
Post tests
Following two-way ANOVA, there are many possible multiple comparison tests that can help you
focus in on what is really going on. However, Prism performs only the post tests biologists use
most frequently. At each row, Prism will compare each column with every column, or compare
every column with a control column.
Variable names
If you enter names for the factors that define the rows and columns, the results will be easier to
follow.
11/18/2009
Two-way ANOVA
Page 6 of 28
an effect bigger than some threshold you set based on physiology. For example, find the minimum
dose that raises the pulse rate by more than 10 beats per minute.
If you look at all the post tests (and not just ask which is the lowest dose or time point that gives a
'significant' effect), you can get results that make no sense. You might find that the difference is
significant at time points 3, 5, 6 and 9 but not at time points 1, 2, 4, 7, 8 and 10. How do you
interpret that? Knowing at which doses or time points the treatment had a statistically significant
rarely helps you understand the biology of the system and rarely helps you design new
experiments.
I only know the group means, and don't have the raw data and don't know their SD or SEM. Can I
run ANOVA?
No. ANOVA compares the difference among group means with the scatter within the groups, taking
into account sample size. If you only know the means, there is no possible way to do any statistical
comparison.
I want to compare three groups. The outcome has two possibilities, and I know the fraction of
each possible outcome in each group. How can I compare the groups?
Not with ANOVA. Enter your data into a contingency table and analyze with a chi-square test.
What does 'repeated measures' mean? How is it different than 'randomized block'?
The term repeated-measures strictly applies only when you give treatments repeatedly to each
subject, and the term randomized block is used when you randomly assign treatments within each
11/18/2009
Two-way ANOVA
Page 7 of 28
group (block) of matched subjects. The analyses are identical for repeated-measures and
randomized block experiments, and Prism always uses the term repeated-measures.
11/18/2009
Two-way ANOVA
Page 8 of 28
2. Enter data
Here are the sample data:
Note that one value is blank. It is fine to have some missing values, but you must have at least
one value in each row for each data set. The following table cannot be analyzed by two-way
ANOVA because there are no data for treated women. But it doesn't matter much that there are
only two (not three) replicates for control men and treated men.
If you are entering mean, SD (or SEM) and N, You must enter N (number of replicates) but it is ok
if N is not always the same.
on the toolbar.
11/18/2009
Two-way ANOVA
Page 9 of 28
ANOVA table
The ANOVA table breaks down the overall variability between measurements (expressed as the
sum of squares) into four components:
Interactions between row and column. These are differences between rows that are not the
same at each column, equivalent to variation between columns that is not the same at each
row.
Variability among columns.
Variability among rows.
Residual or error. Variation among replicates not related to systematic differences between
rows and columns.
11/18/2009
Two-way ANOVA
Page 10 of 28
The ANOVA table shows how the sum of squares is partitioned into the four components. Most
scientists will skip these results, which are not especially informative unless you have studied
statistics in depth. For each component, the table shows sum-of-squares, degrees of freedom,
mean square, and the F ratio. Each F ratio is the ratio of the mean-square value for that source of
variation to the residual mean square (with repeated-measures ANOVA, the denominator of one F
ratio is the mean square for matching rather than residual mean square). If the null hypothesis is
true, the F ratio is likely to be close to 1.0. If the null hypothesis is not true, the F ratio is likely to
be greater than 1.0. The F ratios are not very informative by themselves, but are used to
determine P values.
P values
Two-way ANOVA partitions the overall variance of the outcome variable into three components,
plus a residual (or error) term. Therefore it computes P values that test three null hypotheses
(repeated measures two-way ANOVA adds yet another P value).
Interaction P value
The null hypothesis is that there is no interaction between columns (data sets) and rows. More
precisely, the null hypothesis states that any systematic differences between columns are the
same for each row and that any systematic differences between rows are the same for each
column. Often the test of interaction is the most important of the three tests. If columns represent
drugs and rows represent gender, then the null hypothesis is that the differences between the
drugs are consistent for men and women.
The P value answers this question:
If the null hypothesis is true, what is the chance of randomly sampling subjects and ending up
with as much (or more) interaction than you have observed?
The graph on the left below shows no interaction. The treatment has about the same effect in
males and females. The graph on the right, in contrast, shows a huge interaction. the effect of the
treatment is completely different in males (treatment increases the concentration) and females
(where the treatment decreases the concentration). In this example, the treatment effect goes in
the opposite direction for males and females. But the test for interaction does not test whether the
effect goes in different directions. It tests whether the average treatment effect is the same for
each row (each gender, for this example).
Testing for interaction requires that you enter replicate values or mean and SD (or SEM) and N. If
you entered only a single value for each row/column pair, Prism assumes that there is no
interaction, and continues with the other calculations. Depending on your experimental design, this
assumption may or may not make sense.
Tip: If the interaction is statistically significant, you
won't learn much from the other two P values. Instead
focus on the multiple comparison post tests.
11/18/2009
Two-way ANOVA
Page 11 of 28
The null hypothesis is that the mean of each column (totally ignoring the rows) is the same in the
overall population, and that all differences we see between column means are due to chance. In
the example graphed above, results for control and treated were entered in different columns (with
males and females being entered in different rows). The null hypothesis is that the treatment was
ineffective so control and treated values differ only due to chance. The P value answers this
question: If the null hypothesis is true, what is the chance of randomly obtaining column means as
different (or more so) than you have observed?
In the example shown in the left graph above, the P value for the column factor (treatment) is
0.0002. The treatment has an effect that is statistically significant.
In the example shown in the right graph above, the P value for the column factor (treatment) is
very high (0.54). On average, the treatment effect is indistinguishable from random variation. But
this P value is not meaningful in this example. Since the interaction P value is low, you know that
the effect of the treatment is not the same at each row (each gender, for this example). In fact,
for this example, the treatment has opposite effects in males and females. Accordingly, asking
about the overall, average, treatment effect doesn't make any sense.
Post tests
Prism can compare columns at each row using multiple comparison post tests.
The graph above shows three ways to plot the sample data for two-way ANOVA.
The graphs on the left and middle interleave the data sets. This is set on the second tab of the
Format Graphs dialog. In this case, the data sets are defined by the figure legend, and the groups
(rows) are defined by the labels on the X axis.
The graph on the right has the data sets grouped. In this graph, the labels on the X axis show the
row title -- one per bar. You can use the "number format" choice in the Format Axes dialog to
change this to Column titles -- one per set of bars. With this choice, there wouldn't be much point
11/18/2009
Two-way ANOVA
Page 12 of 28
in also having the legend shown in the box, and you would need to define the side by side bars
("serum starved" vs "normal culture" for this example) in the figure legend.
The graph on the left has the appearance set as a column dot plot. The other two graphs have the
appearance set as bars with error bars plotted from the mean and SD. I prefer the column dot plot
as it shows all the data, without taking up more space and without being harder to interpret.
Don't forget to include in the figure legend whether the error bars are SD or SEM or something
different.
Missing values
If some values are missing, two-way ANOVA calculations are challenging. Prism uses the method
detailed in SA Glantz and BK Slinker, Primer of Applied Regression and Analysis of Variance,
McGraw-Hill, 1990. This method converts the ANOVA problem to a multiple regression problem and
then displays the results as ANOVA. Prism performs multiple regression three times each time
presenting columns, rows, and interaction to the multiple regression procedure in a different order.
Although it calculates each sum-of-squares three times, Prism only displays the sum-of-squares for
the factor entered last into the multiple regression equation. These are called Type III sum-ofsquares.
Prism cannot perform repeated-measures two-way ANOVA if any values are missing. It is OK to
have different numbers of numbers of subjects in each group, so long as you have complete data
(at each time point or dose) for each subject.
11/18/2009
Two-way ANOVA
Page 13 of 28
assumption is not valid, then the P values for row and column effects won't be meaningful.
11/18/2009
Two-way ANOVA
Page 14 of 28
ANOVA, also called three-factor ANOVA. Prism does not perform three-way ANOVA.
11/18/2009
Two-way ANOVA
Page 15 of 28
The table above shows example data testing the effects of three doses of drugs in control and
treated animals. The decision to use repeated measures depends on the experimental design.
11/18/2009
Two-way ANOVA
Page 16 of 28
Randomized block data are analyzed identically to repeated-measures data. Prism always uses the
term repeated measures, so you should choose repeated measures analyses when your
experiment follows a randomized block design.
11/18/2009
Two-way ANOVA
Page 17 of 28
Enter the data putting matched values in the same row, in corresponding columns. In the sample
data shown below, the two circled values represent repeated measurements in one animal.
on the toolbar.
11/18/2009
Two-way ANOVA
Page 18 of 28
11/18/2009
Two-way ANOVA
Page 19 of 28
Arrange your data so the data sets (columns) represent different levels of one factor, and different
rows represent different levels of the other factor. The sample data set compares five time points
in two subjects under control conditions and two after treatment.
Each subcolumn (one is marked with a red arrow above) represents repeated measurements on a
single subject.
Missing values
It is OK if some treatments have more subjects than others. In this case, some subcolumns will be
entirely blank. But you must enter a measurement for each row for each subject. Prism cannot
handle missing measurements with repeated measures ANOVA.
on the toolbar.
Also, choose post tests if they will help you interpret your results, and enter the name of the
factors that define columns and rows.
11/18/2009
Two-way ANOVA
Page 20 of 28
11/18/2009
Two-way ANOVA
Page 21 of 28
11/18/2009
Two-way ANOVA
Page 22 of 28
11/18/2009
Two-way ANOVA
Page 23 of 28
Some experiments involve more than two factors. For example, you might compare three
different drugs in men and women at four time points. There are three factors in that
experiment: drug treatment, gender and time. These data need to be analyzed by three-way
ANOVA, also called three-factor ANOVA. Prism does not perform three-way ANOVA.
After two-way ANOVA, you may wish to perform post tests to narrow
down where differences are significant. Prism can perform some of
these analyses.
11/18/2009
Two-way ANOVA
Page 24 of 28
11/18/2009
Two-way ANOVA
Page 25 of 28
The numerator is the difference between the mean response in the two data sets (usually control
and treated) at a particular row (usually dose or time point). The denominator combines the
number of replicates in the two groups at that dose with the mean square of the residuals
(sometimes called the mean square of the error), which is a pooled measure of variability at all
doses.
Statistical significance is determined by comparing the t ratio with the t distribution for the number
of df shown in the ANOVA table for MSresidual, applying the Bonferroni correction for multiple
comparisons. The Bonferroni correction lowers the P value that you consider to be significant to
0.05 divided by the number of comparisons. This means that if you have five rows of data with two
columns, the P value has to be less than 0.05/5, or 0.01, for any particular row in order to be
considered significant with P<0.05. This correction ensures that the 5% probability applies to the
entire family of comparisons, and not separately to each individual comparison.
Post tests following repeated-measures two-way ANOVA use exactly the same equation if the
repeated measures are by row. If the repeated measures are by column, the term (SSsubject +
SSresidual)/(DFsubject + DFresidual) is used instead of MSresidual in the equation above, and the
number of degrees of freedom equals the sum of DFsubject and DFresidual.
Prism will compare the two columns at each row. For this example, Prism's built-in post tests
compare the two columns at each row, thus asking:
Do the control responses differ between men and women?
Do the agonist-stimulated responses differ between men and women?
Do the response in the presence of both agonist and antagonist differ between men and
women?
If these questions match your experimental aims, Prism's built-in post tests will suffice. Many
biological experiments compare two responses at several time points or doses, and Prism built-in
post tests are just what you need for these experiments. But you may wish to perform different
post tests. In this example, based on the experimental design above, you might want to ask these
questions:
For men, is the agonist-stimulated response different than control? (Did the agonist work?)
For women, is the agonist-stimulated response different than control?
For men, is the agonist response different than the response in the presence of agonist plus
antagonist? (Did the antagonist work?)
For women, is the agonist response different than the response in the presence of agonist plus
antagonist?
For men, is the response in the presence of agonist plus antagonist different than control?
11/18/2009
Two-way ANOVA
Page 26 of 28
In this equation, mean1 and mean 1 are the means of the two groups you are comparing, and N1
and N2 are their sample size. MSresidual is reported in the ANOVA results, and is the same for all
post tests.
The variable t* is the critical value from the student t distribution, using the Bonferroni correction
for multiple corrections. When making a single confidence interval, t* is the value of the t ratio
that corresponds to a two-tail P value of 0.05 (or whatever significance level you chose). If you are
making six comparisons, t* is the t ratio that corresponds to a P value of 0.05/6, or 0.00833. Find
the value using this Excel formula =TINV(0.00833,6), which equals 3.863. The first parameter is
the significance level corrected for multiple comparisons; the second is the number of degrees of
freedom for the ANOVA (residuals for regular two-way ANOVA, subject' for repeated measures).
The value of t* will be the same for each comparison. Its value depends on the degree of
confidence you desire, the number of degrees of freedom in the ANOVA, and the number of
comparisons you made.
To determine significance levels, calculate for each comparison:
The variables are the same as those used in the confidence interval calculations, but notice the key
difference. Here, you calculate a t ratio for each comparison, and then use it to determine the
significance level (as explained in the next paragraph). When computing a confidence interval, you
choose a confidence level (95% is standard) and use that to determine a fixed value from the t
distribution, which we call t*. Note that the numerator is the absolute value of the difference
between means, so the t ratio will always be positive.
To determine the significance level, compare the values of the t ratio computed for each
comparison against the standard values, which we abbreviate t*. For example, to determine
whether the comparison is significant at the 5% level (P<0.05), compare the t ratios computed for
each comparison to the t* value calculated for a confidence interval of 95% (equivalent to a
significance level of 5%, or a P value of 0.05) corrected for the number of comparisons and taking
11/18/2009
Two-way ANOVA
Page 27 of 28
into account the number of degrees of freedom. As shown above, this value is 3.863. If a t ratio is
greater than t*, then that comparison is significant at the 5% significance level. To determine
whether a comparison is significant at the stricter 1% level, calculate the t ratio corresponding to a
confidence interval of 99% (P value of 0.01) with six comparisons and six degrees of freedom. First
divide 0.01 by 6 (number of comparisons), which is 0.001667. Then use the Excel formula =TINV
(0.001667,6) to find the critical t ratio of 5.398. Each comparison that has a t ratio greater than
5.398 is significant at the 1% level.
Tip: All these calculations can be performed using a free
QuickCalcs web calculator.
Example
For this example, here are the values you need to do the calculations (or enter into the web
calculator).
Comparison
1: Men. Agonist vs.
control
2: Women. Agonist vs.
control
3: Men. Agonist vs.
Ag+Ant
4: Women. Agonist vs.
Ag+Ant
5: Men Control vs.
Ag+Ant
6: Women. Control vs.
Ag+Ant
Mean1
176.0
Mean2
98.5
N1
2
N2
2
206.5
100.0
176.0
116.0
206.5
121.0
98.5
116.0
100.0
121.0
Comparison
1: Men. Agonist vs. control
2: Women. Agonist vs. control
3: Men. Agonist vs. Ag+Ant
4: Women. Agonist vs. Ag+Ant
5: Men Control vs. Ag+Ant
6: Women Control vs. Ag+Ant
Significant? (P <
0.05?)
Yes
Yes
Yes
Yes
No
No
Mean1 - Mean2
+ 77.5
+ 106.5
+ 60.0
+ 85.5
-17.5
-21.0
t
8.747
12.020
6.772
9.650
1.975
2.370
95% CI of difference
+ 43.3 to + 111.7
+ 72.3 to + 140.7
+ 25.8 to + 94.2
+ 51.3 to + 119.7
-51.7 to + 16.7
-55.2 to + 13.2
The calculations account for multiple comparisons. This means that the 95% confidence level
applies to all the confidence intervals. You can be 95% sure that all the intervals include the true
value. The 95% probability applies to the entire family of confidence intervals, not to each
individual interval. Similarly, if the null hypothesis were true (that all groups really have the same
mean, and all observed differences are due to chance) there will be a 95% chance that all
comparisons will be not significant, and a 5% chance that any one or more of the comparisons will
be deemed statistically significant with P< 0.05.
For the sample data, we conclude that the agonist increases the response in both men and women.
The combination of antagonist plus agonist decreases the response down to a level that is
indistinguishable from the control response.
11/18/2009
Two-way ANOVA
Page 28 of 28
11/18/2009