Learn R Programming

AMCP (version 2.0.0)

chapter_4_table_1: The data used in Chapter 4, Table 1

Description

The data used in Chapter 4, Table 1

Usage

data(chapter_4_table_1)

Arguments

Format

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

Variables

bloodpr

systolic blood pressure (hypothetical data)

cond

identifies group membership (1=drug therapy; 2=biofeedback; 3=diet; 4=combination)

Synonym

C4T1

Author

Ken Kelley kkelley@nd.edu

Details

This is hypothetical data for four groups of participants, corresponding to treatments for hypertension. The context is 24 mild hypertensives that have been independently and randomly assigned to one of the four treatments. The scores are the systolic blood pressure values two-weeks after the termination of treatment.

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_4_table_1)

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

# View the structure
str(chapter_4_table_1)

# ---------------------------------------------------------------------
# Optional: a factor-coded copy for ANOVA / model-comparison analyses.
# Group membership 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. Build a *copy* (suffix "_factors") so the
# canonical data set is left unchanged. Labels are taken from the
# "Variables" section above.
C4T1_factors <- chapter_4_table_1
C4T1_factors$cond <- factor(C4T1_factors$cond, levels = 1:4,
  labels = c("Drug Therapy", "Biofeedback", "Diet", "Combination"))

# The coding matters: numeric code (1 df) versus factor (3 df).
anova(lm(bloodpr ~ cond, data = chapter_4_table_1))
anova(lm(bloodpr ~ cond, data = C4T1_factors))

Run the code above in your browser using DataLab