Learn R Programming

datarium (version 0.2.0)

selfesteem2: Self Esteem Score Data for Two-way Repeated Measures ANOVA

Description

Data are the self esteem score of 12 individuals enrolled in 2 successive short-term trials (4 weeks) - control (placebo) and special diet trials.

The self esteem score was recorded at three time points: at the beginning (t1), midway (t2) and at the end (t3) of the trials.

The same 12 participants are enrolled in the two different trials with enough time between trials.

Two-way repeated measures ANOVA can be performed in order to determine whether there is interaction between time and treatment on the self esteem 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("selfesteem2")

Arguments

Format

A data frame with 24 rows and 5 columns (stored as a tibble).

id

participant identifier (1 to 12); each participant takes part in both trials.

treatment

the trial, "ctr" (control/placebo) or "Diet".

t1

the self esteem score at the beginning of the trial.

t2

the self esteem score midway through the trial.

t3

the self esteem score at the end of the trial.

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

See Also

selfesteem, the one-way companion data set. Datanovia tutorial: Repeated Measures ANOVA in R: Compare Means Across Time.

Examples

Run this code
data(selfesteem2)
head(selfesteem2)

# Two-way repeated measures ANOVA (treatment x time), both within-subjects
selfesteem2_long <- reshape(selfesteem2, varying = c("t1", "t2", "t3"),
                            v.names = "score", timevar = "time",
                            idvar = c("id", "treatment"), direction = "long")
summary(aov(score ~ treatment * factor(time) +
              Error(factor(id)/(treatment * factor(time))),
            data = selfesteem2_long))

Run the code above in your browser using DataLab