Exercise

# Correlation and R-squared

The linear correlation of two variables, \(x\) and \(y\), measures the strength of the linear relationship between them. When \(x\) and \(y\) are respectively:

- the outcomes of a regression model that minimizes squared-error (like linear regression) and
- the true outcomes
*of the training data*,

then the square of the correlation is the same as \(R^2\). You will verify that in this exercise.

Instructions

**100 XP**

- Use
`cor()`

to get the correlation between the predictions and female unemployment. Assign it to the variable`rho`

and print it. Make sure you use Pearson correlation (the default). - Square
`rho`

and assign it to`rho2`

. Print it. - Compare
`rho2`

to \(R^2\) from the model (using`glance()`

). Is it the same?