Skip to content

Partial Correlation Calculator

Paste a spreadsheet, pick two variables and the ones to hold constant, and get the partial correlation between them — with its t-test, p-value and confidence interval — plus both semipartial correlations and an added-variable plot. It runs in your browser: nothing is uploaded. Free, no sign-up.

Paste from a spreadsheet (with a header row if you have one), or separate values with tabs, commas, semicolons or spaces. Blank cells and NA count as missing.

How to Use the Partial Correlation Calculator

  1. 1. Paste your data. One row per case, one column per variable, copied straight from Excel, Google Sheets or SPSS. A header row is detected automatically; blank cells and NA are treated as missing.
  2. 2. Choose X and Y. These are the two variables whose relationship you want to examine.
  3. 3. Tick the variables to control for. Any number of them. Rows missing a value for any selected variable are left out, and the widget tells you how many.
  4. 4. Read the result. The partial correlation, its p-value and confidence interval appear beside the ordinary correlation, so you can see how much the controls change the picture. The added-variable plot shows what the partial correlation is actually correlating.

What a Partial Correlation Is

A partial correlation is the correlation between X and Y once the influence of other variables has been taken out of both. Practically: regress X on the control variables and keep the residuals, do the same for Y, and correlate the two sets of residuals. Each residual is the part of that variable the controls cannot explain, so the result answers "if everyone had the same GPA, how strongly would hours studied and exam score still go together?"

With a single control variable Z there is a closed form:

Partial r

r_xy·z = (r_xy − r_xz × r_yz) ÷ √((1 − r_xz²)(1 − r_yz²))

t-test

t = r × √((n − 2 − k) ÷ (1 − r²)), with n − 2 − k degrees of freedom

The calculator does not use this formula or an inverted correlation matrix for the answer: it solves the two regressions with a QR decomposition, which stays accurate even when the controls are strongly correlated with each other. The closed form is shown in the working for the one-control case, where you can check it by hand.

Worked Example

Twenty students report weekly study hours, their exam score and their prior GPA (the "Load example" button pastes these). Hours and score correlate at r = 0.8007, p < 0.0001: more study, higher scores. But prior GPA correlates 0.8287 with hours and 0.9059 with score — students with strong records both study more and score higher. Controlling for GPA:

r = (0.8007 − 0.8287 × 0.9059) ÷ √((1 − 0.8287²)(1 − 0.9059²)) = 0.2109, t = 0.8897 on 17 degrees of freedom, p = 0.3861, 95% CI −0.2691 to 0.6070. Most of the apparent link between hours and score was shared with GPA. That does not prove studying is useless — with 20 cases the interval is wide and still includes sizeable positive values — but the headline correlation overstated the independent association.

Partial Versus Semipartial Correlation

PartialSemipartial (part)
Removes the controls fromBoth X and YOnly one of them
Question answeredHow related are X and Y among cases equal on Z?How much of Y's total variance does X add beyond Z?
Square equalsShare of Y's leftover variance that X explainsIncrease in R² when X joins Z as a predictor
SizeNever smaller than the semipartialNever larger than the partial

In the example, the semipartial correlation of score with hours-purged-of-GPA is 0.0893, so once GPA is accounted for, hours add only about 0.8% (0.0893²) of the total variance in scores. Both semipartials are shown, one for each variable you might purge.

Assumptions and Cautions

  • Linear relationships. Partial correlation controls for linear effects only. If a control acts non-linearly, add a squared version as another control.
  • Sample size. You lose one degree of freedom per control. With n − 2 − k below about 20 the interval is wide; with k ≥ n − 3 there is no interval at all.
  • Not causation. Controlling for a variable does not show it is a confounder or a mediator, and controlling for a consequence of X and Y can create a correlation that was not there. Decide what to control for from theory, not from which result looks best.
  • Measurement error in a control. An error-prone control only partly removes its influence, so some of the confounding leaks through.

Frequently Asked Questions

What does controlling for a variable mean?
It means statistically removing that variable's linear influence from both of the variables you are correlating, so the remaining association is the one that holds among cases that are equal on the control. It is an adjustment on paper, not an experiment: it cannot rule out confounders you did not measure.
What is the difference between partial and semipartial correlation?
A partial correlation takes the controls out of both X and Y. A semipartial (or part) correlation takes them out of only one, which makes its square the unique share of the total variance in Y that X explains over and above the controls. Regression output reports semipartials as the squared part correlations or the R² change.
How do I interpret a partial correlation that is smaller than the zero-order correlation?
A drop means part of the original association was shared with the controls. If the partial is near zero the relationship may be spurious (a common cause drives both variables) or fully mediated (X affects Y through the control). If it grows, the control was suppressing the relationship. Statistics cannot tell you which story is true; your design and theory must.
How many cases do I need for a partial correlation?
The test has n − 2 − k degrees of freedom, so you need at least k + 3 complete cases to get a p-value and k + 4 for a confidence interval. For stable estimates aim for many more — dozens of cases rather than a handful — and more still if the correlation you expect is small.
How do I report a partial correlation in APA style?
Give the coefficient with its degrees of freedom, confidence interval and p-value, without a leading zero: partial r(17) = .21, 95% CI [−.27, .61], p = .386. Name the variables controlled for in the sentence. The widget builds this line with a copy button.
Can I compute a partial Spearman correlation?
Yes: replace each variable by its ranks (the RANK.AVG function in a spreadsheet handles ties), paste the ranks, and the result is the partial Spearman correlation. The p-value is then approximate, as it is for any rank-based partial correlation.

Related Tools

More in Statistics Calculators

See all Statistics Calculators