Partial Correlation Calculator
Statistics
- Numerator: 0.60 - 0.50 x 0.40 = 0.40.
- Denominator: sqrt((1 - 0.50^2) x (1 - 0.40^2)) = 0.794.
- Partial correlation: 0.40 / 0.794 = 0.504.
- Controlling for Z, X and Y still share 25.4 % of their variance.
Two variables can look related only because both dance to a third variable's tune - ice-cream sales and drowning both follow the summer. The partial correlation is the statistician's way of holding the third variable still: it correlates X and Y after the part of each that Z can predict has been removed. What survives is the relationship that is actually between X and Y, at least as far as linear statistics can tell.
Remarkably, the first-order partial correlation needs nothing but the three ordinary correlations among the variables: r(xy), r(xz) and r(yz). This calculator applies the classic formula, shows the numerator and denominator separately so the arithmetic can be audited, and reports the shared variance (the squared partial) that usually matters for interpretation.
Worked examples
Shrinkage, 0.504
(0.6 · 0.5 · 0.4)
| Partial correlation | 0.504 |
| Numerator | 0.40 |
| Denominator | 0.794 |
| Shared variance (r squared) | 25.4 % |
Erasure, 0.000
(0.35 · 0.7 · 0.5)
| Partial correlation | 0.000 |
| Numerator | 0.00 |
| Denominator | 0.618 |
| Shared variance (r squared) | 0.0 % |
Suppression, 0.826
(0.45 · -0.3 · 0.6)
| Partial correlation | 0.826 |
| Numerator | 0.63 |
| Denominator | 0.763 |
| Shared variance (r squared) | 68.1 % |
Controlling for a third variable
The mental model is residualisation. Regress X on Z and keep the residuals - the part of X that Z cannot explain. Regress Y on Z and keep those residuals. Correlate the two sets of residuals and you have the partial correlation. It is the relationship between the leftovers, which is exactly what 'holding Z constant' means in a linear world: within any narrow band of Z, this is the correlation you would see.
The formula compresses that two-regression procedure into one line: (rxy - rxz ryz) / sqrt((1 - rxz^2)(1 - ryz^2)). The numerator subtracts the correlation X and Y would have merely by both following Z; the denominator rescales for the variance Z removed from each. In the first worked example, rxy of 0.6 with rxz 0.5 and ryz 0.4 gives numerator 0.40 and denominator 0.794, hence a partial of 0.504 - a real relationship, diminished but alive after control.
Where does partialling sit among the ways researchers 'control for' things? Analysis of covariance adjusts group means for a covariate - the same residual logic pointed at means instead of correlations. Matching and stratification control by design rather than by algebra. Multiple regression controls for many variables at once and reports partial relationships as its coefficients. The first-order partial correlation is the smallest complete example of the whole family: one control, one formula, and - in the erasure example, where 0.35 dissolves to 0.000 - the clearest possible demonstration of what control can do and why it must be argued, not assumed.
- Partial r = (rxy - rxz x ryz) / sqrt((1 - rxz^2)(1 - ryz^2))
- Numerator: the correlation beyond what Z explains
- Shared variance = partial r squared
- Equals the correlation of the two residual series
Worked examples: shrinkage, erasure and suppression
The three examples are the three fates a correlation can meet under control. Shrinkage: 0.6 becomes 0.504, shared variance 25.4 % - Z explained part of the association, the rest stands. Erasure: rxy 0.35 with rxz 0.7 and ryz 0.5 gives a numerator of exactly 0.00, because 0.35 is precisely 0.7 x 0.5; the entire X-Y correlation was Z working through both, and the partial is 0.000. Nothing about the data changed - only the question did.
Suppression is the fate nobody expects: the partial exceeds the original. With rxy 0.45, rxz -0.3 and ryz 0.6, the numerator grows to 0.63 (subtracting a negative), the denominator is 0.763, and the partial is 0.826 - 68.1 % shared variance where the raw correlation suggested 20 %. Z was masking the relationship, correlating with Y while opposing X, and removing it reveals the stronger link. Any analyst who assumes controlling only shrinks correlations will misread suppressor variables every time.
One more use of the shared-variance column deserves emphasis: it converts a correlation into the currency of explanation. A partial of 0.504 sounds like 'half a relationship'; 25.4 % shared variance states plainly that three quarters of what varies in the residuals of Y is still unexplained by X - which is usually the more decision-relevant fact, and the one that keeps modest correlations from being oversold in reports.
| Case | r(xy) | r(xz) | r(yz) | Partial r | Shared variance |
|---|---|---|---|---|---|
| Shrinkage | 0.6 | 0.5 | 0.4 | 0.504 | 25.4 % |
| Erasure | 0.35 | 0.7 | 0.5 | 0.000 | 0.0 % |
| Suppression | 0.45 | -0.3 | 0.6 | 0.826 | 68.1 % |
Partial versus semi-partial correlation
The partial correlation removes Z from both variables; the semi-partial (or part) correlation removes Z from only one - usually the predictor - leaving the criterion whole. The semi-partial answers 'how much unique variance does X explain in Y', which is the question regression users ask when they read a squared semi-partial as an R-squared increment. The partial answers the cleaner theoretical question about the X-Y relationship itself. They coincide in direction and differ in size: the semi-partial is never larger than the partial, because its denominator keeps Y's Z-variance in.
This page computes the partial, the more common request and the one defined by the three-correlation formula. If you arrived wanting the unique-contribution figure for a regression, compute the partial here as a first look and then take the semi-partial from your regression output, where it is printed as the part correlation.
A numerical illustration of the partial/semi-partial gap: from the first example's correlations, the semi-partial for X predicting Y with Z removed from X alone is 0.40 / sqrt(1 - 0.4^2) = 0.436, against the partial of 0.504. The 0.436 squared - about 19 % - is the R-squared increment X adds to a regression already containing Z; the 0.504 squared, 25.4 %, is the share of the residual variance. Same data, same control, two legitimate answers to two different questions, which is why naming the coefficient precisely matters in a methods section.
When controlling misleads: colliders
Control is not automatically virtuous. If Z is a common effect of X and Y - a collider - conditioning on it manufactures association between its causes, and the partial correlation can show a relationship that does not exist in the world. Selecting on a variable influenced by both (studying only hospitalised patients, only hired applicants, only surviving firms) is the same error in disguise. The erasure example is the mirror warning in the other direction: a Z that is really a mediator - X causes Z causes Y - will, when controlled, erase a genuine causal path and call it confounding.
The formula cannot tell a confounder from a mediator or a collider; only the causal story can, and it must be argued before the arithmetic, not after. Use this calculator with a diagram in mind: arrows into both X and Y from Z justify control; arrows from X and Y into Z forbid it; a chain through Z makes the partial the direct effect, which may or may not be what you want.
Higher-order partials and regression
Controlling for two variables gives a second-order partial, for k variables a k-th order one, each defined by the same residual idea and computable from the correlation matrix by recursion. Multiple regression is the same machinery wearing a different hat: the t-test on a regression coefficient is a test of a partial correlation, and the coefficient's sign is the partial's sign. Nothing new is needed to go further - but the inputs stop being three correlations you can hold in your head and become a matrix, which is where hand calculation properly ends.
One numerical caution: the three input correlations must be mutually consistent - they must form a valid (positive-definite) correlation matrix. Invented or mismatched triples (say, all three at 0.9 with inconsistent signs) can push the denominator toward zero or the result outside [-1, 1], and the calculator will faithfully report the impossible number. Check surprising outputs against that consistency first.
Practical sourcing of the inputs: the three correlations should come from the same sample and the same variable definitions. Mixing a published rxy from one study with rxz from another invites the inconsistency problem above, and partialling a variable measured differently in different sources controls for a fiction. When the inputs are consistent, the sampling distribution of the partial behaves like that of an ordinary correlation with a few degrees of freedom spent on the control - with one control, treat its effective sample size as n - 1 when judging precision.
In short: compute it, square it, and argue the causal diagram before believing either.
FAQs
rxy 0.6, rxz 0.5, ryz 0.4: partial correlation?
Numerator 0.40, denominator 0.794, partial correlation 0.504.
How much variance do X and Y share after control in that example?
25.4 % - the square of 0.504.
When does a partial correlation come out exactly zero?
When rxy equals rxz times ryz: 0.35 = 0.7 x 0.5 in the second example, so the numerator is 0.00 and the partial is 0.000.
Can controlling for Z make a correlation stronger?
Yes: 0.45 becomes 0.826 when rxz is -0.3 and ryz is 0.6, the suppressor case, with 68.1 % shared variance.
What is the denominator in the first example?
0.794: sqrt((1 - 0.5^2)(1 - 0.4^2)).
Why does the second example's denominator use 0.618?
sqrt((1 - 0.7^2)(1 - 0.5^2)) = 0.618; the numerator being zero makes the partial zero regardless.