[R] Ask for functions to obtain partial R-square (squared partial correlation coefficients)
Ye Xingwang
xingwang.ye at gmail.com
Mon Aug 20 15:55:05 CEST 2007
The partial R-square (or coefficient of partial determination, or
squared partial correlation coefficients) measures the marginal
contribution of one explanatory variable when all others are already
included in multiple linear regression model.
The following link has very clear explanations on partial and
semi-partial correlation:
http://www.psy.jhu.edu/~ashelton/courses/stats315/week2.pdf
In SAS, the options is PCORR2 and SCORR2.
For example(from http://www.ats.ucla.edu/stat/sas/examples/alsm/alsmsasch7.htm)
data ch7tab01;
input X1 X2 X3 Y;
label x1 = 'Triceps'
x2 = 'Thigh cir.'
x3 = 'Midarm cir.'
y = 'body fat';
cards;
19.5 43.1 29.1 11.9
24.7 49.8 28.2 22.8
30.7 51.9 37.0 18.7
29.8 54.3 31.1 20.1
19.1 42.2 30.9 12.9
25.6 53.9 23.7 21.7
31.4 58.5 27.6 27.1
27.9 52.1 30.6 25.4
22.1 49.9 23.2 21.3
25.5 53.5 24.8 19.3
31.1 56.6 30.0 25.4
30.4 56.7 28.3 27.2
18.7 46.5 23.0 11.7
19.7 44.2 28.6 17.8
14.6 42.7 21.3 12.8
29.5 54.4 30.1 23.9
27.7 55.3 25.7 22.6
30.2 58.6 24.6 25.4
22.7 48.2 27.1 14.8
25.2 51.0 27.5 21.1
;
run;
proc reg data = ch7tab01;
model y = x1 x2 / pcorr2 SCORR2;
model y = x1-x3 / pcorr2 SCORR2;
run;
quit;
There has been a post in
http://tolstoy.newcastle.edu.au/R/help/05/03/0437.html
It will be great appreciated if someone could write a general function
to work with class lm or glm to obtain the
pcorr2 (squared partial correlation coefficients using Type II sums of squares)
and scorr2 (squared semi-partial correlation coefficients using Type
II sums of squares)
for all independent variables (>3 variables) simultaneously?
Thank you.
Xingwang Ye
More information about the R-help
mailing list