top of page

Analysis of Variance


ds = dataset you are currently using.

DV = dependent variable of interest

IV = independent variable of interest


Subject = name of subject number column 

XYXY = dummy name for a variable, matrix, or data frame into which you are moving information.

Before performing ANOVA: Make your subjects and IVs into factors

Note that in ANOVA your independent variables and subject numbers (within-subjects data) need to be treated as discrete levels. R assumes that subject numbers are continuous. In order to tell it otherwise, use the factor function.


ds$Subject <- as.factor(ds$Subject)

ds$IV <- as.factor(ds$IV)


You can also use this command to add labels to your IVs if you desire


ds$IV <- factor(ds$IV,
                   levels = c(0,1),
                   labels = c("Label for 0", "Label for 1"))


I Want to Perform...

bottom of page