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

Exercise

Calculating the F-ratio

In this exercise, you'll calculate the F-ratio. No need to worry! You already did a lot of preparation in the previous exercises. The F-ratio is calculated as follows:

$$ \begin{aligned} F & = \frac{ms_a}{ms_{s/a}} \end{aligned} $$

where

$$ \begin{aligned} ms_a & = \frac{ss_a}{df_a}, \\ ms_{s/a} & = \frac{ss_{s/a}}{df_{s/a}} \end{aligned} $$

and \(df\) stands for the degrees of freedom. In this case, we have

$$ \begin{align} df_a &= a - 1 \\ df_{s/a} &= a (n - 1). \end{align} $$

The values \(a\) and \(n\) represent the number of groups and the number of subjects in each group, respectively.

You will find all relevant variables from the previous exercises loaded in your workspace, such as ss_a and ss_sa. You can always type ls() in the console to see what's there. Calculate the F-ratio by implementing the above formulas step-by-step.

Instructions

100 XP
  • Assign to a the number of different groups in the experiment.
  • Assign to n the number of subjects in each group.
  • Assign to df_a and df_sa the respective degrees of freedom. Remember to use the * sign when performing multiplication. For example, 10 * 5 multiplies 10 and 5.
  • Assign to ms_a and ms_da the between and within groups mean squares, respectively.
  • Calculate the F-ratio and assign the result to f_rat.