Subjective Ways of Cutting a Continuous Variables

You have probably seen @coulmont‘s maps. If you haven’t, you should probably go and spend some time on his blog (but please, come back afterwards, I still have a story to tell you). Consider for instance the maps we obtained for a post published in Monkey Cage, a few months ago,

The codes were discussed on a blog post (I spent some time on the econometric model, not really on the map, by that time).

My mentor in cartography, Reka (aka @visionscarto) taught me that maps were always subjective. And indeed.

Consider the population below 24 years old, in Paris. Or to be more specific, the proportion in a quartier of the population below 24.

> Young=(df$POP0017+df$POP1824)/df$POP)*100

There is a nice package to cut properly a continuous variable

> library(classInt)

And there are many possible options. Breaks can be at equal distances,

> class_e=classIntervals(Young,7,style="equal")

or based on quantiles (here probabilities are at equal distances)

> class_q=classIntervals(Young,7,style="quantile")

So, what could be the impact on a map. Here, we consider a gradient of colors, with 200 values

> library(RColorBrewer)
> plotclr=colorRampPalette(brewer.pal(7,
"RdYlBu")[7:1] )(200)

With the so-called “equal” option (which divides the range of the variable into 200 parts), we have the breaks on the right of the legend. With the “quantile” options (where quantiles are obtained for various probabilities, where here we divide the range of probabilities into 200 parts), we have the breaks on the left of the legend. If we get back to the graph with the cumulative distribution function, above, in the first case, we equally split the range of the variable (on the x-axis), while in the second case,  we equally split the range of the probability (on the y-axis).

Breaks are very different with those two techniques. Now, if we try to visualize where the young population is located, on a map, we use the following code

> colcode=findColours(class_e, plotclr)	
> plot(paris,col=colcode,border=colcode)

Here, with the equal option, we have the following map,

while with the quantile option, we get

> colcode=findColours(class_q, plotclr)	
> plot(paris,col=colcode,border=colcode)

Those two maps are based on the same data. But I have the feeling that they do tell different stories…


OpenEdition suggests that you cite this post as follows:
Arthur Charpentier (December 2, 2014). Subjective Ways of Cutting a Continuous Variables. Freakonometrics. Retrieved October 8, 2024 from https://doi.org/10.58079/ouxt


2 thoughts on “Subjective Ways of Cutting a Continuous Variables”

  1. A nice demonstration of something that cartographers have known about for over a century. Mark Monmonier’s little book HOW TO LIE WITH MAPS (U of Chicago Press) deals with the issue, but the very best paper on it is from Ian Evans (1977) “The selection of class intervals” in Transactions, Institute of British Geographers, n.s., 2, 98-124. The golden rule is to inspect the statistical fd of the data before you class them. This in not the only issue with area-value (aka choropleth) maps!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.