Get startedGet started for free

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.

This exercise is part of the course

Intro to Statistics with R: Analysis of Variance (ANOVA)

View Course

Exercise instructions

  • 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Number of groups
a <- ___

# Number of subjects in each group
n <- ___

# Define degrees of freedom
df_a <- ___
df_sa <- ___

# Calculate mean squares using ss_a and ss_sa
ms_a <- ___ / ___
ms_sa <- ___ / ___

# Calculate the F-ratio
f_rat <- ___ / ___
Edit and Run Code