# Partial correlation - scales?

Is there any way to conduct a partial correlation analysis if the DV is dichotomous?

• If your purpose is to find the effect of a continuous variable on the dichotomous DV controlling for another continuous variable then maybe you should consider logistic regression. – Epaminondas May 4 '14 at 21:11
• Yes, I already conducted a logistic regression but was quite unsatisfied with the results – Jennifer May 5 '14 at 10:06

There isn't really a dependent variable in partial correlation; at least, the dependence of the two main variables (whose unmediated relationship is of interest – call 'em x and y) on the controlling variables is removed. The unexplained variance of x and y, i.e., the residuals, are the subjects of partial correlation. Once you have the residuals from linear models of x and y as predicted by your control variables, correlate them, and there you have your partial correlation.

A simple correlation between a continuous variable z and a dichotomous variable y is a point-biserial correlation. OLS regression of the same two variables will produce this same correlation as a slope coefficient if the variables are standardized. The residuals of y regressed onto z (doesn't matter if you standardize the variables – the next step will have the same effect) can then be correlated with the residuals of a linear model of x regressed onto z to find the partial correlation between x and y.

Here's a brief demonstration in in case anyone else finds it useful (I wanted to check my answer):

d8a=data.frame(y=rbinom(99,1,.5),x=rnorm(99),z=rnorm(99))                    #Simulated data
cor(lm(scale(y)~scale(z),d8a)$residuals,lm(x~z,d8a)$residuals)          #Base package method
require(ggm);pcor(c('x','y','z'),var(d8a))       #Dedicated function for partial correlation


The correlation of the residuals of the linear models of x and y as predicted by z is the same as the result of the function dedicated to producing partial correlations. This is no surprise; this is all normal procedure for calculating partial correlations. The algebraic operations don't change when one variable is dichotomous. However, whether one should interpret a partial correlation the same way regardless of whether any variables are dichotomous is another question...(Comments welcome!)