Researchers want to evaluate the effect of a new "treatment" and "exercise" on the stress score reduction after adjusting for "age".
Two-way ANCOVA can be performed in order to determine whether there is interaction between exercise and treatment on the stress score.
It is the data set used in the Datanovia tutorial “ANCOVA in R: Compare Group Means Adjusted for a Covariate” (https://www.datanovia.com/learn/biostatistics/anova/ancova-in-r).
data("stress")A data frame with 60 rows and 5 columns (stored as a tibble).
participant identifier (1 to 60).
the stress score; a simulated measure on an arbitrary scale with no real-world units.
whether the participant received the treatment, "yes" or "no".
the exercise level, "low", "moderate" or "high".
the participant's age, in years.
A simulated dataset created for teaching two-way ANCOVA.
Datanovia tutorial: ANCOVA in R: Compare Group Means Adjusted for a Covariate.
data(stress)
head(stress)
#> # A tibble: 6 × 5
#> id score treatment exercise age
#> <dbl> <dbl> <fct> <fct> <dbl>
#> 1 1 95.6 yes low 59
#> 2 2 82.2 yes low 65
#> 3 3 97.2 yes low 70
#> 4 4 96.4 yes low 66
#> 5 5 81.4 yes low 61
#> 6 6 83.6 yes low 65
# Two-way ANCOVA of the stress score, adjusting for age
summary(aov(score ~ age + treatment * exercise, data = stress))
#> Df Sum Sq Mean Sq F value Pr(>F)
#> age 1 1093.8 1093.8 44.019 1.75e-08 ***
#> treatment 1 222.0 222.0 8.933 0.00424 **
#> exercise 2 1034.6 517.3 20.820 2.13e-07 ***
#> treatment:exercise 2 220.9 110.5 4.446 0.01641 *
#> Residuals 53 1316.9 24.8
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1