• Descriptive
    • Moments
    • Concentration
    • Central Tendency
    • Variability
    • Stem-and-Leaf Plot
    • Histogram & Frequency Table
    • Data Quality Forensics
    • Conditional EDA
    • Quantiles
    • Kernel Density Estimation
    • Normal QQ Plot
    • Bootstrap Plot

    • Multivariate Descriptive Statistics
  • Distributions
    • Binomial Probabilities
    • Geometric Probabilities
    • Negative Binomial Probabilities
    • Hypergeometric Probabilities
    • Multinomial Probabilities
    • Poisson Probabilities

    • Exponential
    • Gamma
    • Erlang
    • Weibull
    • Rayleigh
    • Lognormal
    • Pareto
    • Inverse Gamma

    • Beta
    • Power
    • Beta Prime (Inv. Beta)
    • Triangular

    • Normal (area)
    • Logistic
    • Laplace
    • Cauchy (standard)
    • Cauchy (location-scale)
    • Gumbel

    • Normal RNG
    • ML Fitting
    • Tukey Lambda PPCC
    • Box-Cox Normality Plot
    • Sample Correlation r

    • Empirical Tests
  • Hypotheses
    • Theoretical Aspects of Hypothesis Testing
    • Bayesian Inference
    • Minimum Sample Size

    • Empirical Tests
    • Multivariate (pair-wise) Testing
  • Models
    • Manual Model Building
  • Time Series
    • Time Series Plot
    • Decomposition
    • Exponential Smoothing

    • Blocked Bootstrap Plot
    • Mean Plot
    • (P)ACF
    • VRM
    • Standard Deviation-Mean Plot
    • Spectral Analysis
    • ARIMA

    • Cross Correlation Function
    • Granger Causality
  1. Descriptive Statistics & Exploratory Data Analysis
  2. 65  Partial Pearson Correlation
  • Preface
  • Getting Started
    • 1  Introduction
    • 2  Why Do We Need Innovative Technology?
    • 3  Basic Definitions
    • 4  The Big Picture: Why We Analyze Data
  • Introduction to Probability
    • 5  Definitions of Probability
    • 6  Jeffreys’ axiom system
    • 7  Bayes’ Theorem
    • 8  Sensitivity and Specificity
    • 9  Naive Bayes Classifier
    • 10  Law of Large Numbers

    • 11  Problems
  • Probability Distributions
    • 12  Bernoulli Distribution
    • 13  Binomial Distribution
    • 14  Geometric Distribution
    • 15  Negative Binomial Distribution
    • 16  Hypergeometric Distribution
    • 17  Multinomial Distribution
    • 18  Poisson Distribution

    • 19  Uniform Distribution (Rectangular Distribution)
    • 20  Normal Distribution (Gaussian Distribution)
    • 21  Gaussian Naive Bayes Classifier
    • 22  Chi Distribution
    • 23  Chi-squared Distribution (1 parameter)
    • 24  Chi-squared Distribution (2 parameters)
    • 25  Student t-Distribution
    • 26  Fisher F-Distribution
    • 27  Exponential Distribution
    • 28  Lognormal Distribution
    • 29  Gamma Distribution
    • 30  Beta Distribution
    • 31  Weibull Distribution
    • 32  Pareto Distribution
    • 33  Inverse Gamma Distribution
    • 34  Rayleigh Distribution
    • 35  Erlang Distribution
    • 36  Logistic Distribution
    • 37  Laplace Distribution
    • 38  Gumbel Distribution
    • 39  Cauchy Distribution
    • 40  Triangular Distribution
    • 41  Power Distribution
    • 42  Beta Prime Distribution
    • 43  Sample Correlation Distribution

    • 44  Problems
  • Descriptive Statistics & Exploratory Data Analysis
    • 45  Types of Data
    • 46  Datasheets

    • 47  Frequency Plot (Bar Plot)
    • 48  Frequency Table
    • 49  Contingency Table
    • 50  Binomial Classification Metrics
    • 51  Confusion Matrix
    • 52  ROC Analysis

    • 53  Stem-and-Leaf Plot
    • 54  Histogram
    • 55  Data Quality Forensics
    • 56  Quantiles
    • 57  Central Tendency
    • 58  Variability
    • 59  Skewness & Kurtosis
    • 60  Concentration
    • 61  Notched Boxplot
    • 62  Scatterplot
    • 63  Pearson Correlation
    • 64  Rank Correlation
    • 65  Partial Pearson Correlation
    • 66  Simple Linear Regression
    • 67  Moments
    • 68  Quantile-Quantile Plot (QQ Plot)
    • 69  Normal Probability Plot
    • 70  Probability Plot Correlation Coefficient Plot (PPCC Plot)
    • 71  Box-Cox Normality Plot
    • 72  Kernel Density Estimation
    • 73  Bivariate Kernel Density Plot
    • 74  Conditional EDA: Panel Diagnostics
    • 75  Bootstrap Plot (Central Tendency)
    • 76  Survey Scores Rank Order Comparison
    • 77  Cronbach Alpha

    • 78  Equi-distant Time Series
    • 79  Time Series Plot (Run Sequence Plot)
    • 80  Mean Plot
    • 81  Blocked Bootstrap Plot (Central Tendency)
    • 82  Standard Deviation-Mean Plot
    • 83  Variance Reduction Matrix
    • 84  (Partial) Autocorrelation Function
    • 85  Periodogram & Cumulative Periodogram

    • 86  Problems
  • Hypothesis Testing
    • 87  Normal Distributions revisited
    • 88  The Population
    • 89  The Sample
    • 90  The One-Sided Hypothesis Test
    • 91  The Two-Sided Hypothesis Test
    • 92  When to use a one-sided or two-sided test?
    • 93  What if \(\sigma\) is unknown?
    • 94  The Central Limit Theorem (revisited)
    • 95  Statistical Test of the Population Mean with known Variance
    • 96  Statistical Test of the Population Mean with unknown Variance
    • 97  Statistical Test of the Variance
    • 98  Statistical Test of the Population Proportion
    • 99  Statistical Test of the Standard Deviation \(\sigma\)
    • 100  Statistical Test of the difference between Means -- Independent/Unpaired Samples
    • 101  Statistical Test of the difference between Means -- Dependent/Paired Samples
    • 102  Statistical Test of the difference between Variances -- Independent/Unpaired Samples

    • 103  Hypothesis Testing for Research Purposes
    • 104  Decision Thresholds, Alpha, and Confidence Levels
    • 105  Bayesian Inference for Decision-Making
    • 106  One Sample t-Test
    • 107  Skewness & Kurtosis Tests
    • 108  Paired Two Sample t-Test
    • 109  Wilcoxon Signed-Rank Test
    • 110  Unpaired Two Sample t-Test
    • 111  Unpaired Two Sample Welch Test
    • 112  Two One-Sided Tests (TOST) for Equivalence
    • 113  Mann-Whitney U test (Wilcoxon Rank-Sum Test)
    • 114  Bayesian Two Sample Test
    • 115  Median Test based on Notched Boxplots
    • 116  Chi-Squared Tests for Count Data
    • 117  Kolmogorov-Smirnov Test
    • 118  One Way Analysis of Variance (1-way ANOVA)
    • 119  Kruskal-Wallis Test
    • 120  Two Way Analysis of Variance (2-way ANOVA)
    • 121  Repeated Measures ANOVA
    • 122  Friedman Test
    • 123  Testing Correlations
    • 124  A Note on Causality

    • 125  Problems
  • Regression Models
    • 126  Simple Linear Regression Model (SLRM)
    • 127  Multiple Linear Regression Model (MLRM)
    • 128  Logistic Regression
    • 129  Generalized Linear Models
    • 130  Multinomial and Ordinal Logistic Regression
    • 131  Cox Proportional Hazards Regression
    • 132  Conditional Inference Trees
    • 133  Leaf Diagnostics for Conditional Inference Trees
    • 134  Hypothesis Testing with Linear Regression Models (from a Practical Point of View)

    • 135  Problems
  • Introduction to Time Series Analysis
    • 136  Case: the Market of Health and Personal Care Products
    • 137  Decomposition of Time Series
    • 138  Ad hoc Forecasting of Time Series
  • Box-Jenkins Analysis
    • 139  Introduction to Box-Jenkins Analysis
    • 140  Theoretical Concepts
    • 141  Stationarity
    • 142  Identifying ARMA parameters
    • 143  Estimating ARMA Parameters and Residual Diagnostics
    • 144  Forecasting with ARIMA models
    • 145  Intervention Analysis
    • 146  Cross-Correlation Function
    • 147  Transfer Function Noise Models
    • 148  General-to-Specific Modeling
  • References
  • Appendices
    • Appendices
    • A  Method Selection Guide
    • B  Presentations and Teaching Materials
    • C  R Language Concepts for Statistical Computing
    • D  Matrix Algebra
    • E  Standard Normal Table (Gaussian Table)
    • F  Critical values of Student’s \(t\) distribution with \(\nu\) degrees of freedom
    • G  Upper-tail critical values of the \(\chi^2\)-distribution with \(\nu\) degrees of freedom
    • H  Lower-tail critical values of the \(\chi^2\)-distribution with \(\nu\) degrees of freedom

Table of contents

  • 65.1 Definition
  • 65.2 R Module
    • 65.2.1 Public website
    • 65.2.2 RFC
  • 65.3 Purpose
  • 65.4 Pros & Cons
    • 65.4.1 Pros
    • 65.4.2 Cons
  • 65.5 Example
  • 65.6 Task
DRAFT This draft is under development — DO NOT CITE OR SHARE.
  1. Descriptive Statistics & Exploratory Data Analysis
  2. 65  Partial Pearson Correlation

65  Partial Pearson Correlation

65.1 Definition

The Pearson Product Moment Partial Correlation (Yule 1897) between variables \(x\) and \(y\), controlled for variable \(z\) is defined as

\[ r_{xy.z} = \frac{r_{xy} - \left( r_{xz} \times r_{yz} \right)}{\sqrt{\left(1 - r_{xz}^2\right) \left( 1 - r_{yz}^2 \right)}} \tag{65.1}\]

where \(-1 \leq r_{xy.z} \leq +1\)

and

\[ \begin{cases}r_{xy} = \frac{\text{C}(xy)}{\sqrt{\text{V}(x) \text{V}(y)}} = \frac{\text{C}(xy)}{s_x s_y} \\r_{xz} = \frac{\text{C}(xz)}{\sqrt{\text{V}(x) \text{V}(z)}} = \frac{\text{C}(xz)}{s_x s_z} \\r_{yz} = \frac{\text{C}(yz)}{\sqrt{\text{V}(y) \text{V}(z)}} = \frac{\text{C}(yz)}{s_y s_z}\end{cases} \]

It is, however, also possible to control for more than just one variable. In case there are \(K\) variables \(z_i\) for \(i= 1, 2, …,K\), the Partial Pearson Correlation is defined as \(r_{e_x e_y}\) where

\[ \begin{cases}x = \alpha_x + \sum_{i=1}^{K} \beta_i z_i + e_x \\y = \alpha_y + \sum_{i=1}^{K} \gamma_i z_i + e_y\end{cases} \]

This implies that the Partial Pearson Correlation is, in fact, directly linked to the Multiple Regression equations in which both variables \(x\) and \(y\) are explained by the control variables \(z_i\).

65.2 R Module

65.2.1 Public website

The Partial Pearson Correlation module is available on the public website:

  • https://compute.wessa.net/partcorr.wasp (trivariate)
  • https://compute.wessa.net/rwasp_partialcorrelationmatrix.wasp (multivariate)

65.2.2 RFC

The multivariate Partial Pearson Correlation module can be found in RFC under the “Descriptive / Multivariate Descriptive Statistics”.

To compute the trivariate Partial Pearson Correlation on your local machine, the following script can be used in the R console:

z <- c(80,20,50,20,30)
y <- c(80,60,10,20,30)
x <- c(70,30,90,80,10)
(rho12 <- cor(x, y))
(rho23 <- cor(y, z))
(rho13 <- cor(x, z))
#Partial Correlation r(xy.z)
(rhoxy_z <- (rho12-(rho13*rho23))/(sqrt(1-(rho13*rho13)) * sqrt(1-(rho23*rho23))))
#Partial Correlation r(xz.y)
(rhoxz_y <- (rho13-(rho12*rho23))/(sqrt(1-(rho12*rho12)) * sqrt(1-(rho23*rho23))))
#Partial Correlation r(yz.x)
(rhoyz_x <- (rho23-(rho12*rho13))/(sqrt(1-(rho12*rho12)) * sqrt(1-(rho13*rho13))))
[1] -0.2496258
[1] 0.470871
[1] 0.3996413
[1] -0.5413762
[1] 0.6054065
[1] 0.6428553

To compute the Partial Pearson Correlations, the R code uses the cor function and the formulas from Equation 65.1.

It is also possible to compute the multivariate Partial Pearson Correlation Matrix on your local machine with the following R script:

library(corpcor)
A <- runif(150)
B <- -2*A + runif(150)
C <- 3*B + runif(150)
x <- cbind(A, B, C)
(r1 <- pcor.shrink(x)) #partial correlation matrix
(r0 <- cor(x)) #ordinary correlation matrix
Estimating optimal shrinkage intensity lambda (correlation matrix): 0.0079 

            A          B           C
A  1.00000000 -0.2882541 -0.06950242
B -0.28825412  1.0000000  0.91824278
C -0.06950242  0.9182428  1.00000000
attr(,"lambda")
[1] 0.007908329
attr(,"lambda.estimated")
[1] TRUE
attr(,"class")
[1] "shrinkage"
attr(,"spv")
         A          B          C 
0.20478426 0.03227225 0.03502674 
           A          B          C
A  1.0000000 -0.8982952 -0.8883071
B -0.8982952  1.0000000  0.9900738
C -0.8883071  0.9900738  1.0000000

To compute the Partial Pearson Correlation Matrix, the R code uses the pcor.shrink function from the corpcor library.

65.3 Purpose

Partial Correlations are used to investigate whether the relationship between two variables (\(x\) and \(y\)) depends on other variables (\(z_i\) for \(i = 1, 2, …, K\)). This is especially useful when one wishes to examine whether the (ordinary) Pearson Correlation \(r_{xy}\) represents a spurious result (i.e. affected by some common cause) or whether the association weakens after controlling for potential confounders.

65.4 Pros & Cons

65.4.1 Pros

Partial Correlations have the following advantages:

  • They can be used to compute correlations while controlling for other variables (which may avoid the spurious correlation problem).
  • They are closely linked to Multiple Linear Regression and provide interesting information.

65.4.2 Cons

Partial Correlations have the following disadvantages:

  • Most readers are not familiar with the statistical concept of Partial Correlations.
  • Partial Correlations are not featured in many software packages.

65.5 Example

Download the happystudent.csv dataset and use the R module shown below to:

  • upload the csv file
  • click on the Correlations tab
  • select all the variables from the uploaded file
  • change the “Type of Correlations” setting to “Partial”
Interactive Shiny app (click to load).
Open in new tab

The R module computes the multivariate Pearson and Partial Correlation matrices. The dataset contains information that was gathered through a survey in one of our statistics courses to investigate learning confidence (i.e. self-confidence of students to learn statistical concepts). For each student we obtained the following scores:

  • Happiness: measure of general happiness
  • Sport1: to what degree are students engaged in team sports?
  • Learning: degree of learning confidence
  • Depression: measure of depression (based on WHO)
  • Software: degree of software competence

The (unconditional) Pearson Correlation between Learning and Depression is (approximately) equal to -0.23 which seems to imply a weak, negative relationship (i.e. highly depressed students tend to have a lower learning confidence. Does this relationship remain if we control for the effects of all other variables?

The answer is no. The output of the R module shows that the Partial Pearson Correlation is (approximately) -0.067 (i.e. much closer to zero) implying that little linear association remains once the control variables are taken into account. This does not establish full statistical independence. To identify which variable primarily drives this reduction, one can compare the pairwise Pearson correlations between Learning and each of the remaining variables in the dataset.

65.6 Task

Based on the analysis from the previous problem, which variable is most closely related with learning confidence? Do you think that all the variables can be assumed to have a continuous distribution?

Yule, George Udny. 1897. “On the Theory of Correlation.” Journal of the Royal Statistical Society 60 (4): 812–54. https://doi.org/10.2307/2979746.
64  Rank Correlation
66  Simple Linear Regression

© 2026 Patrick Wessa. Provided as-is, without warranty.

Feedback: e-mail | Anonymous contributions: click to copy (Sats) | click to copy (XMR)

Cookie Preferences