|
ANOVA
ANOVA provides a statistical test of whether or not the means of several groups are equal, and therefore generalizes the t-test to more than two groups. For this reason, ANOVAs are useful in comparing three or more means for statistical significance. One Way ANOVA (Randomized Design)
A one way ANOVA can be executed via the aov function. The results can then be displayed using the summary function. fit = aov (Response ~ GroupingVariable, data = ElementName) summary (fit) Example: > fit = aov (count ~ spray, data = InsectSprays) > summary (fit) Randomized Block Design
An ANOVA for randomized block design data can be executed via the aov function. The results can then be displayed using the summary function. fit = aov (Response ~ GroupingVariable1 + GroupingVariable2, data = ElementName) summary (fit) Example: > fit = aov (breaks ~ tension + wool, data = warpbreaks) > summary (fit) Two Way Factorial Design
An ANOVA for two-way factorial data can be executed via the aov function. The results can then be displayed using the summary function. fit = aov (Response ~ GroupingVariable1*GroupingVariable2, data = ElementName) summary (fit) Example: > fit = aov (breaks ~ wool*tension , data = warpbreaks) > summary (fit) One Way within Subjects (Factors) ANOVA
A one way within subjects ANOVA can be executed via the aov function. The results can then be displayed using the summary function. fit = aov (Response ~ GroupingVariable + Error ( Subject / GroupingVariable ) , data = ElementName) summary (fit) Two Way withing Subjects (Factors) ANOVA
A two way within subjects ANOVA can be executed via the aov function. The results can then be displayed using the summary function. fit = aov (Response ~ GroupingVariable1*GroupingVariable2 + Error ( Subject / (GroupingVariable1*GroupingVariable2) ) , data = ElementName) summary (fit) Post-hoc Testing
Post-hoc testing allows a user to evaluate which of the treatments are significantly different from the controls and from other treatments. R provides a simple function to carry out the Tukey HSD test. TukeyHSD (fit) Example: > fit = aov (breaks ~ tension + wool, data = warpbreaks) > TukeyHSD (fit) |