Challenge: Covariance and Correlation
Assess your skills by completing a challenge.
We'll cover the following
Pearson’s correlation coefficient
As we saw earlier, Pearson’s correlation coefficient is the test statistics that measure the statistical relationship, or association, between two continuous variables. It’s known as the best method of measuring the association between variables of interest because it’s based on the method of covariance. It gives information about the magnitude of the association, or correlation, as well as the direction of the relationship.
Formula
- : Correlation coefficient
- : Values of the x-variable in a sample
- : Mean of the values of the x-variable
- : Values of the y-variable in a sample
- : Mean of the values of the y-variable
Problem statement
You’re given the formula for calculating the Pearson correlation coefficient for the pwt7g
dataset. The task is to compute the Pearson correlation coefficient.
Coding exercise
This problem has been designed for you to practice freely, so try to solve it on your own first. Take some time and think about the different concepts that have been explored in the course so far.
If you feel stuck, you can always check out the solution review provided in the next lesson.
Good luck!
Get hands-on with 1400+ tech skills courses.