# Load the data
data(chapter_13_table_10)
# Or, alternatively load the data as
data(C13T10)
# View the structure
str(chapter_13_table_10)
# The Linear and Quadratic D variables are formed from the raw three-level
# data of Table 13.2 (chapter_13_table_2) using the orthogonal-polynomial
# coefficients for three equally spaced levels given in Appendix Table A.10:
# Linear, coefficients (-1, 0, 1): Time3 - Time1
# Quadratic, coefficients (1, -2, 1): Time1 - 2 * Time2 + Time3
# Because a contrast is unchanged by its sign, Table 13.10 reports the
# quadratic with the equally valid coefficients (-1, 2, -1), that is,
# 2 * Time2 - Time1 - Time3, so that is what is used here.
data(chapter_13_table_2)
derived <- data.frame(
Linear = chapter_13_table_2$Time3 - chapter_13_table_2$Time1,
Quadratic = 2 * chapter_13_table_2$Time2 -
chapter_13_table_2$Time1 - chapter_13_table_2$Time3
)
# The derived variables reproduce Table 13.10 exactly
all.equal(derived, chapter_13_table_10)
Run the code above in your browser using DataLab