Exercise

# Cramér’s V

Now we have a Chi-square value (and a p-value) for our advertising investigation. These tell us that there is an association between the type of person, and their ad preference.

We can find out the strength of the association by calculating Cramér’s V. The formula for Cramér’s V is $$\sqrt \frac{\chi^2}{n * m}$$ where \(n\) is the number of observations and \(m\) is the number of rows OR number of columns - 1, where rows or columns are selected based on which is smaller. Let's find Cramér’s V for our data.

Our contingency table is saved as `data`

. You can find the square root in R using the function `sqrt()`

, for example `sqrt(9)`

would return `3`

. Your Chi-square value is 14.682.

A quick way to find the total number of observations is to simply enter `sum(data)`

into your console.

Instructions

**100 XP**

- In your script, assign the value of m to
`m`

. You can check your table by entering`data`

into your console. - In your console, find the number of observations and number of rows/columns in
`data`

. - In your script, use
`m`

, the number of observations and your Chi-square value to calculate Cramér’s V.