Learn R Programming

AMCP (version 2.0.0)

chapter_5_table_4: The data used in Chapter 5, Table 4

Description

The data used in Chapter 5, Table 4

Usage

data(chapter_5_table_4)

Arguments

Format

An object of class data.frame with 24 rows and 2 columns.

Variables

group

a numeric vector between 1 and 4; group number

sbp

systolic blood pressure of a patient within one of the four groups

Synonym

C5T4

Author

Ken Kelley kkelley@nd.edu

Details

The following data consists of blood pressure measurements for six individuals randomly assigned to one of four groups. Our purpose here is to perform four planed contrasts in order to discern if group differences exist for the selected contrasts of interests.

References

Maxwell, S. E., Delaney, H. D., & Kelley, K. (2027). Designing experiments and analyzing data: A model comparison perspective (4th ed.). New York, NY: Routledge.

Examples

Run this code
# Load the data
data(chapter_5_table_4)

# Or, alternatively load the data as
data(C5T4)

# View the structure
str(chapter_5_table_4)

# ---------------------------------------------------------------------
# Optional: a factor-coded copy for ANOVA / model-comparison analyses.
# group is stored as a numeric code so the book's contrast and
# model-comparison examples reproduce exactly. For a one-way ANOVA you
# generally want it as a factor; otherwise the code enters the model as a
# single linear (1 df) term. The "Variables" section does not give level
# labels, so the numeric codes are kept as the factor levels. Build a
# *copy* (suffix "_factors") so the canonical data set is left unchanged.
C5T4_factors <- chapter_5_table_4
C5T4_factors$group <- factor(C5T4_factors$group)

# The coding matters: numeric code (1 df) versus factor (3 df).
anova(lm(sbp ~ group, data = chapter_5_table_4))
anova(lm(sbp ~ group, data = C5T4_factors))
# (Chapter 5 analyzes these data with planned contrasts, which use numeric
#  contrast codes; the factor copy is for the omnibus test and plotting.)

Run the code above in your browser using DataLab