Learn R Programming

AMCP (version 2.0.0)

chapter_7_table_5: The data used in Chapter 7, Table 5

Description

The data used in Chapter 7, Table 5

Usage

data(chapter_7_table_5)

Arguments

Format

An object of class data.frame with 30 rows and 3 columns.

Variables

Score

blood pressure

Feedback

biofeedback condition (1 = present, 2 = absent, that is, drug administered alone)

Drug

drug administered (1 = drug X, 2 = drug Y, 3 = drug Z)

Synonym

C7T5

Author

Ken Kelley kkelley@nd.edu

Details

This table represents hypothetical data from a study investigating the effects of biofeedback and drug therapy on hypertension. We (arbitrarily) refer to the presence or absence of biofeedback as factor A and to the type of drug as factor B.

The following data is a generalization of the blood pressure data given in Table 7.1 (as there are now three, rather than two, levels of the drug factor). In addition to assessing the likelihood of there being a biofeedback or a drug main effect, the interaction is explicitly taken into consideration.

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

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

# View the structure
str(chapter_7_table_5)

# ---------------------------------------------------------------------
# Optional: a factor-coded copy for factorial ANOVA / model comparison.
# Feedback and Drug are stored as numeric codes so the book's contrast and
# model-comparison examples reproduce exactly. For a factorial ANOVA you
# want them as factors; otherwise a 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.
C7T5_factors <- chapter_7_table_5
C7T5_factors$Feedback <- factor(C7T5_factors$Feedback)
C7T5_factors$Drug     <- factor(C7T5_factors$Drug)

# This design is balanced, so the factorial ANOVA is order-invariant.
anova(lm(Score ~ Feedback * Drug, data = C7T5_factors))

Run the code above in your browser using DataLab