Session Ready
Exercise

The unsystematic within-groups variance

To calculate the error term of the repeated measures design, you need the unsystematic within-groups variance: the unsystematic variance or the error term of the between-groups design.

Recall the formula for the within-groups sum of squares is given by $$\begin{aligned} ss_{s/a} & = \sum(y_{ij} - y_j)^2 \end{aligned},$$ where \(y_{ij}\) are the individual scores and \(y_j\) are the group means with \(i\) the number of observations and \(j\) the number of groups.

The formula for the unsystematic variance of the between-groups design is the given by $$ \begin{aligned} ms_{s/a} & = \frac{ss_{s/a}}{df} \end{aligned},$$ where \(df\) stands for the degrees of freedom.

Instructions
100 XP
  • You need to subtract each individual score by its corresponding group mean. First you have to make four subsets of the four different groups, y_i1, ..., y_i4, each subset containing the IQ results of that particular group. Create the subsets using the subset() function, where you first enter the dependent variable and then the independent grouping variable with the condition of the subset.
  • Now you can then subtract every individual score by its corresponding group mean. Use mean().
  • Put everything together into one vector s_t, so that it will be easier to do the summation.
  • Calculate the within-groups sum of squares by squaring the previous result and summing up the elements of the vector.
  • Calculate the unsystematic within-groups variance ms_sa. You'll want to define the degrees of freedom first.