# NOT RUN {
# A fixed-effects design without repeated measurement is created as easily as this:
design1 <-
fixed.factor("Age", levels=c("young", "old")) +
fixed.factor("Material", levels=c("word", "image"))
design1
# As can be seen, this experimental design requires 4 observations.
# Adding random factors
# Assume we want to test different groups of subjects. Each subject will only be `old` or `young`
# but be tested with stimuli of both categories `word` and `image`. In a typical behavioral
# experiment, `Age` would now be a between-subject/within-item factor and `Material` a
# within-subject/between-item factor. In other words, `Material` is now nested within the
# instances of `Subject`, whereas `Subject` is grouped by `Age`.
design2 <-
fixed.factor("Age", levels=c("young", "old")) +
fixed.factor("Material", levels=c("word", "image")) +
random.factor("Subject", groups = "Age")
design.codes(design2)
# The minimal experimental design will still require 4 observations, assigning one subject to each
# level of the between-subject factor `Age`.
# }
Run the code above in your browser using DataLab