Click here for a transcript.
Welcome back. In this short video, I'm going to talk about the optional one-liner for correlation. And so, when we went through all the hypothesis tests in lesson six, we then learned all of those one minor tests, this will be the one minor for correlation. And so, in particular, we're using this pearsonr function in sci-fi stats, which can be found here. And we need to provide the x value, the x data the y data and the alternative that we want to use. So, I'm just going to save this data as results, and say stats dot pearsonr.
And I'm going to use the original data, so here. We don't want to use our simulated data because we shuffled it so much. We don't have the original anymore. So we need to go back to our merge data frame, which is, you know, the reason why we make copies. So, I give it the first variable, and the second variable, and then the alternative is greater.
So, we can run this, don't get any results because I'm storing it somewhere, but then I can come in and say print the correlation coefficient. And this will be the zero with term of our results vector. And then we can print p-value.
And, this is the first term, so remember that python does counting from zero onward.
And so, we go zero and one. And so, here it's printing out that same correlation coefficient that we got above, but it's giving us a p-value that is much more specific than our p-value here, like we've seen before, and tells us that it is. We reject the null hypothesis in favor of the alternative, that this correlation coefficient is statistically significantly greater than zero.