Learn R Programming

datarium (version 0.2.0)

weightloss: Weight Loss Score Data for Three-way Repeated Measures ANOVA

Description

A researcher wanted to assess the effects of Diet and Exercises on weight loss in 12 sedentary males.

The participants were enrolled in four trials: (1) no diet and no exercises; (2) diet only; (3) exercises only; and (4) diet and exercises combined.

Each participant performed all four trials. The order of the trials was counterbalanced and sufficient time was allowed between trials to allow any effects of previous trials to have dissipated (i.e., a "wash out" period).

Each trial lasted nine weeks and the weight loss score was measured at the beginning of each trial (t1), at the midpoint of each trial (t2) and at the end of each trial (t3).

Three-way repeated measures ANOVA can be performed in order to determine whether there is interaction between diet, exercises and time on the weight loss score.

For a worked tutorial on this analysis, see the Datanovia lesson “Repeated Measures ANOVA in R: Compare Means Across Time” (https://www.datanovia.com/learn/biostatistics/anova/repeated-measures-anova-in-r).

Usage

data("weightloss")

Arguments

Format

A data frame with 48 rows and 6 columns (stored as a tibble).

id

participant identifier (1 to 12); each participant performs all four diet/exercises trials.

diet

whether the trial included a diet, "no" or "yes".

exercises

whether the trial included exercises, "no" or "yes".

t1

the weight loss score at the beginning of the trial.

t2

the weight loss score at the midpoint of the trial.

t3

the weight loss score at the end of the trial.

The weight loss score is a simulated measure on an arbitrary scale with no real-world units.

See Also

Examples

Run this code
data(weightloss)
head(weightloss)

# Three-way repeated measures ANOVA (diet x exercises x time), all within
weightloss_long <- reshape(weightloss, varying = c("t1", "t2", "t3"),
                           v.names = "score", timevar = "time",
                           idvar = c("id", "diet", "exercises"),
                           direction = "long")
summary(aov(score ~ diet * exercises * factor(time) +
              Error(factor(id)/(diet * exercises * factor(time))),
            data = weightloss_long))

Run the code above in your browser using DataLab