1. Learn
  2. /
  3. Courses
  4. /
  5. Intro to Statistics with R: Analysis of Variance (ANOVA)

Exercise

Working memory experiment

Throughout this chapter, we'll use data from the working memory experiment, which investigates the relationship between the number of training days and a change in IQ. There are four independent groups, each of which trained for a different period of time: 8, 12, 17, or 19 days. The independent variable is the number of training days and the dependent variable is the IQ gain.

Have a look at the wm data, which are already loaded in your workspace. Typing head(wm) in the console will display the first 6 rows. You should see the following variables:

  • subject: a unique number identifying each subject
  • condition (or just cond for short): number of training days (i.e. grouping condition)
  • iq: change in IQ score

Instructions

100 XP
  • After loading and looking at the dataset, provide some summary statistics for every individual group using the describeBy() function from the psych R package. Provide the data frame wm as the first argument and "condition" as the second argument.
  • Use the boxplot() function to create a boxplot of iq as a function of cond. Title the boxplot "Boxplot", then label the x- and y-axes "Group (cond)" and "IQ", respectively. Here is an example of how to use the boxplot function:
boxplot(dependent_var ~ independent_var,
        main = "Title", xlab = "Label here", 
        ylab = "Another label here")