# Load the data
data(chapter_7_table_9)
# Or, alternatively load the data as
data(C7T9)
# View the structure
str(chapter_7_table_9)
# ---------------------------------------------------------------------
# Table 7.9 supplies one additional observation for each of the six cells
# of the 2 (Feedback) x 3 (Drug) design in Table 7.5 (chapter_7_table_5).
# Stacking it onto Table 7.5 gives six observations per cell; the cell and
# marginal means of the combined data are those reported in Table 7.10.
data(chapter_7_table_5)
combined <- rbind(chapter_7_table_5, chapter_7_table_9)
# Cell means: a 2 (Feedback) x 3 (Drug) table -- Table 7.10
# Feedback 1 = biofeedback present, 2 = absent; Drug 1 = X, 2 = Y, 3 = Z
tapply(combined$Score,
list(Feedback = combined$Feedback, Drug = combined$Drug), mean)
# Marginal means and grand mean (also given in Table 7.10)
tapply(combined$Score, combined$Feedback, mean) # 187 (present), 199 (absent)
tapply(combined$Score, combined$Drug, mean) # 178 (X), 202 (Y), 199 (Z)
mean(combined$Score) # 193 (grand mean)
Run the code above in your browser using DataLab