This function simplifies the call for repeated measures ANOVA (rm.anova) on a given data frame. Also allows calls for sphericity correction (correct), as well as a sphericity test table (sph).
rm.anova(
df,
id,
times,
scores = NULL,
correct = TRUE,
sph = FALSE,
phc = FALSE
)
data frame to read in.
the main grouping variable by which times
will be analyzed
dependent variable values at the time points measured. If data are in wide form (where time points are listed as separate variables for each observation), read in as a list of time point variables (e.g. c("t1", "t2", "t3", ..., "tn")
), where the values represent the scores at the various time points. Read in as list if data are in wide form. If data are in long form, the times
variable is one column (rather than multiple columns) in the data frame, and must be paired with the scores
variable for actual values (listed below).
if data are in long form (where each group has multiple observations), a scores
variable must be read in, which represents the values at the specific time points represented in the times
variable.
logical (default set to T
). Corrects the results in the repeated measures ANOVA table -- adjusts the degrees of freedom (\(df\)) by multiplying the sphericity assumed degrees of freedom (\(df\)) by the Greenhouse-Geisser Epsilon value. When set to correct = F
, will print results of repeated measures ANOVA with sphericity assumed.
logical (default set to F
). When set to sph = T
, will print a sphericity tests table with Mauchly's W, as well as two Epsilon values (Greenhouse-Geisser and Huynh-Feldt).
logical (default set to F
). When set to phc = T
, will print a post-hoc comparisons table with Bonferroni's adjusted alpha levels (and p-values).
data <- howell_aids_wide
rm.anova(data, student, c("t1","t2","t3"))
data2 <- howell_aids_long
rm.anova(data2, student, time, scores=knowledge)
Run the code above in your browser using DataLab