I actually computed partial correlation using MATLAB for HBM05 meeting.
The following code computes the partial correlation between anatomical
and cognitive measures while partialing out "age" and "total brain size".
x=[age_control; area_control];
y=[anatomy'; control_score'];
sigma=cov([x;y]');
a=sigma(3:4,3:4)-sigma(3:4,1:2)*inv(sigma(1:2,1:2))*sigma(1:2,3:4);
partial.correlation=a(1,2)/sqrt(a(1,1)*a(2,2));
The following paper clearly demonstrates the need for partial
correlation rather than simple correlation.
http://www.stat.wisc.edu/~mchung/papers/HBM2005/hbm2005.autism.correlation.pdf
---------------
Moo K. Chung
http://www.stat.wisc.edu/~mchung
Assistant Professor
Department of Statistics
University of Wisconsin-Madison
|