# 18.4 - Example - Correlation Coefficients

18.4 - Example - Correlation Coefficients## SAS® Example

### Provides an IML module for calculating point and interval estimates of the Pearson correlation coefficient and the concordance correlation coefficient

(19.1_correlation.sas): Age and percentage body fat were measured in 18 adults. SAS PROC CORR provides estimates of the Pearson, Spearman, and Kendall correlation coefficients. It also calculates Fisher's Z transformation for the Pearson and Spearman correlation coefficients in order to get 95% confidence intervals.

```
*******************************************************************************
* This program indicates how to construct a bivariate scatterplot with an *
* overlay of the least squares regression line. *
* *
* This program also provides an example for calculating point and *
* interval estimates of the Pearson, Spearman, and Kendall correlation *
* coefficients. *
*******************************************************************************;
data bodyfat;
input subject age bodyfat_perc;
cards;
01 23 9.5
02 23 27.9
03 27 7.8
04 27 17.8
05 39 31.4
06 41 25.9
07 45 27.4
08 49 25.2
09 50 31.1
10 53 34.7
11 53 42.0
12 54 29.1
13 56 32.5
14 57 30.3
15 58 33.0
16 58 33.8
17 60 41.1
18 61 34.5
;
run;
proc gplot data=bodyfat;
plot bodyfat_perc*age/vaxis=axis1 haxis=axis2 nolegend frame;
axis1 label=(a=90 '% Body Fat') minor=none;
axis2 label=('Age') minor=none;
symbol1 value=star color=black interpol=r;
title "Scatterplot";
run;
proc corr data=bodyfat Pearson Spearman Kendall Fisher(biasadj=no);
var age;
with bodyfat_perc;
title "Correlation Coefficients";
run;
```

The resulting estimates for this example are 0.7921, 0.7539, and 0.5762, respectively for the Pearson, Spearman, and Kendall correlation coefficients. The Kendall tau-b correlation typically is smaller in magnitude than the Pearson and Spearman correlation coefficients.

The 95% confidence intervals are (0.5161, 0.9191) and (0.4429, 0.9029), respectively for the Pearson and Spearman correlation coefficients. Because the Kendall correlation typically is applied to binary or ordinal data, its 95% confidence interval can be calculated via SAS PROC FREQ (this is not shown in the SAS program above).