**Left Censored » R**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Pearson’s product-moment correlation, \(r\), is an incredibly useful tool for getting some idea about how two variables are (linearly) related. But there are times when using Pearson’s \(r\) is not appropriate and, even if linearity and all other assumptions hold, using it may lead one astray.

I recently ran into such a situation when looking at the persistence of municipal-level vote shares over the last four Polish parliamentary elections. The plot below presents an example of some of the data I was looking at. It shows the share of the vote going to Samoobrona (Self-Defense of the Republic of Poland) by municipality in 2005 (horizontal axis) and 2007 (vertical axis). The linear regression line is shown in red and the 45-degree line is the dashed grey line.

From the plot it is clear that support for SRP collapsed between 2005 and 2007: had SRP’s performance held steady across the two elections, we would expect the data to cluster around the 45-degree line. Instead, in all but one or two municipalities, support was lower in 2007 than 2005. Accordingly, the data fall below the 45-degree line.

However, if I had ignored the plot and used Pearson’s \(r\) as the primary measure of persistence in vote share across years — something that is not uncommon in the study party politics — I would have been lead to believe that there was, in fact, a high degree of persistence between the two elections. As reported in the plot, \(r=0.72\), which certainly seems to be good evidence of a high degree of persistence in vote shares between 2005 and 2007. So, what’s going on?

Jason Wittenberg explains in a recent paper why Pearson’s \(r\) is not an appropriate measure in this case. The problem is the fact that Pearson’s \(r\) is a measure of linearity, not persistence — it captures how far from a linear regression line the data fall (the red line in the above plot). But what we really want is a measure of how far the data are *from the 45-degree line*. For this, Wittenberg suggests using Lin’s concordance correlation coefficient, \(r_c\). From the Wikipedia article, Lin’s \(r_c\) is defined as follows:

\(

r_c = \cfrac{2s_{xy}}{s_x^2 + s_y^2 + (\bar{x} – \bar{y})^2}.

\)

The relationship between \(r\) and \(r_c\) is straightforward. From the original paper:

- \(-1 \leq -|r| \leq r_c \leq |r| \leq 1\);
- \(r_c = 0\) if and only if \(r=0\);
- \(r_c = r\) if and only if \(s_x = s_y\); and
- \(r_c = \pm 1\) if and only if \(r = \pm 1\), \(s_x = s_y\), and \(\bar{x} = \bar{y}\).

(These come from Lin’s 1989 paper, p. 258, cited below. Note I have left out a couple equivalent conditions from (iv) and have changed the notation to match the definition of \(r_c\).)

As Wittenberg notes, condition (i) is potentially quite problematic for studies of electoral persistence. It says that the magnitude of \(r_c\) is always less than or equal to \(r\). In other words, Pearson’s \(r\) (almost) always inflates the amount of persistence present in the data. Evidence of this is seen the in next plot, which compares electoral performance of each major party in the 2005 and 2007 Polish parliamentary elections.

Clearly, Pearson’s \(r\) and Lin’s \(r_c\) point to significantly different interpretations of the data when it comes to the issue of electoral persistence. As expected the magnitude of \(r_c\) is always lower than \(r\) — sometimes dramatically lower. In the case of SRP, for instance, \(r_c = 0.06\) compared to \(r = 0.72\) reported above. Also note, as expected given the conditions above, \(r_c\) is closest to \(r\) when regression line is near a 45-degree line.

So, what’s the take-away? First, Wittenberg is right in calling into question the use of Pearson’s \(r\) as a measure of electoral persistence (anyone know a better measure?). It simply doesn’t properly capture the concept. Second, always look at your data. In this case, I had never heard of Lin’s concordance correlation coefficient until I went looking for some way to measure the discordance I was seeing in the data. Had I just decided construct a table of correlations, I may have believed that there was a great deal more persistence in electoral votes shares than actually existed.

### R Code

Lin’s \(r_c\) can be calculated with the `epi.ccc`

function in the `epiR`

package. For those who may care, here is the code I used to make the second plot above:

xyplot(vote_share.2007 ~ vote_share.2005 | factor(party), data=PartyW[party %!in% c("Other", "RP")], as.table=TRUE, between=list(x=1,y=1), aspect=1, col=grey[5], cex=0.75, xlab="2005", ylab="2007", xlim=c(-0.1,1), ylim=c(-0.1,1), strip=strip.custom(bg=grey[3]), panel=function(x, y, ...) { r <- round(cor(x, y, use="pairwise.complete.obs"), 2) rc <- round(epi.ccc(x, y)[["rho.c"]][1,1], 2) panel.xyplot(x, y, ...) panel.abline(a=0, b=1, lty=2, col=grey[4], lwd=2) panel.abline(lm(y ~ x), col=red[6], lwd=2) panel.text(x=0, y=0.9, labels=bquote(r == .(r)), cex=0.75, pos=4) panel.text(x=0, y=0.8, labels=bquote(r == .(rc)), cex=0.75, pos=4) })

### References

- Lin, Lawrence I-Kuei. (1989). “A Concordance Correlation Coefficient to Evaluate Reproducibility.”
*Biometrics*45: 255–268. - Lin, Lawrence I-Kuei. (2000). “Correction: A Note on the Concordance Correlation Coefficient.”
*Biometrics*56: 324–325. - Wittenberg, Jason. (Oct. 2011). “How Similar Are They? Rethinking Electoral Congruence.”
*Quality & Quantity*.

**leave a comment**for the author, please follow the link and comment on their blog:

**Left Censored » R**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.