Skip to main content

Section 7.8 Partial Correlations

When we were looking at our R^2 values, we saw a decent percentage of the variation in exam scores was due to both anxiety scores and studying time. We also saw that half of the variation in anxiety scores was due to studying time. So, maybe, there is some overlap between anxiety+studying time and exam scores.
To account for this, we can utilize the ppcor library ([D.1.20]) and run a partial correlation using the pcor.test() command.

Hint:.

When running a partial correlation using pcor.test(), the last variable in the command is the one being controlled for.
library(ppcor)

# Partial correlation between Anxiety and Exam controlling for Studying
pcor.test(examData$anxiety_score, examData$exam_score, examData$studying_hours)

# Uno reverse: controlling for Anxiety instead of Studying
pcor.test(examData$studying_hours, examData$exam_score, examData$anxiety_score)
    estimate    p.value statistic   n gp  Method
1 -0.2585344 0.00977182 -2.635883 100  1 pearson

   estimate   p.value statistic   n gp  Method
1 0.1163946 0.2512544  1.154199 100  1 pearson
After controlling for studying time, we now see that:
  1. The correlation coefficient is still negative between anxiety scores and exam scores, but it is cut by nearly half!
  2. The correlation coefficient is still positive between studying time and exam scores, but now, not only is it not as strong, but it is not even statistically significant.
This confirms our suspicion that the relationship between anxiety and exam performance partly overlaps with study time. Once we control for study time, the unique relationship between anxiety and exam scores becomes weaker β€” showing that part of the correlation was actually due to study habits.
Logically, this makes sense: the more you study, the less anxiety you will have! So maybe, just maybe, you’ll consider studying for your next exam.