SOURCEBOOK

R Articles

Data Analysis | Post Hoc Comparisons

Prior to the steps below, enter the data as appropriate for the analyses (described elsewhere). As always, the following commands should be typed directly in the R console window.

Obtaining Descriptive Statistics

Get the grand mean for the variable and the mean and standard deviation for the dependent variable for each of the levels.

Results <- aov(Outcome ~ Factor)
model.tables(Results, "means")

tapply(Outcome, Factor, function(x) c(length(x), mean(x), sd(x)))

Obtaining Inferential Statistics

Test each pairwise comparison for statistical significance.

TukeyHSD(Results)