Dodgy A&E graph from Vote Leave

IMG_20160522_115443 (1)

Oh my, there really has been some bad maths from the Vote Leave campaign in a report they recently published. The graph above from page 29 of the report make a totally elementary error in its implication that migration caused the increase in A&E attendances.

A phrase every A Level stats student knows (and many who have not studied stats know too) is “correlation does not imply causation.” It is easy to find things that correlate but many of these correlations are spurious. Indeed there is website devoted to such silliness.

Just because things correlate it does not mean one causes the other. For example, as one wag on Twitter demonstrated, the increase in global average temperatures is correlated with the increase in net migration. Does that mean migration causes climate change?

a and e migrtion silly causation

Of course correlation may imply causation but before you make such a bold statement you should consider other possibilities. So, why might A&E admissions be going up? Given I’m a trade union official for UNISON, the biggest union in the NHS, I can speak with a little knowledge from talking to our members. I would theorise that perhaps the fact that we have an ageing population this would mean more A&E admissions.

Is it possible to check this theory? Well yes, it is very easy.

Here you will find A&E data that gives admissions by age group. The age related data only goes back to 2011 (unlike the data in the Vote Leave report which goes back to 2002) but it still provides enough evidence to debunk the Vote Leave claim that migration has caused the increase in A&E admissions.

I compared the data between 2011 and 2014 to see the age related breakdown. I grouped them in three age categories 0-19 (children and youths); 20 – 49 (adults); 50+ (older adults). Remember we know migrants are typically younger and nearly all under 50.

Age A&E admissions

We can clearly see here the biggest increase in A&E admissions are in the 50+ age group. in fact the 50+ age group are just over 50 per cent of the increase in admissions. Given migrants are younger and nearly always well under 50 it is safe to assume that migrants are not responsible for this part of the increase.

Also, this article from the GP website Pulse says:

As many as 5.8 million people attended A&E in 2012/13 after failing to get a GP appointment, representing more than one in four of all attendances, researchers have claimed.

According to the table in the Vote Leave report, net migration was 177,000 in 2012. So these 5.8 million admissions are unlikely to be all down to migrants otherwise it  would mean they’d each visited A&E 30 times in a year!

Remember two facts. First, migrants tend to be younger than the average age of the rest of the adult population. Second, younger people have fewer health problems and use the NHS less than older people.

Of course migrants may have contributed to increased A&E admission but it is simply ludicrous to assume (as Vote Leave have done) that migrants have caused all of the increase when it is clear this ain’t so. And to cap it all after getting a spurious correlation they then use that to extrapolate out as to what the A&E admissions increase will be in 2030. This is a woeful abuse of statistics.

What makes this misrepresentation even more egregious, is that under the graph it says “there is a very strong correlation (>0.9)” and the graph shows the R squared value (or coefficient of determination) to give some technical gravitas to demonstrate “we know what we are doing.” But they don’t know what they are doing as they have ignored the iron rule that “correlation does not imply causation.”

Either they know this and they are being wilfully misleading, or they are shooting from the hip without knowing what they are doing.

If it is the former we cannot really trust anything else they say. If it is the latter, it makes me wonder what else they don’t know what they are talking about.

Advertisements

Pac-Man pie chart of UK’s spend on the EU

good pie

Please note since posting this it has been pointed out to me that this pie chart is not 100 per cent accurate – though the picture it paints is broadly correct. You need to read all the way to the bottom of this post to see info on the inaccuracies.

 

How much of overall UK government spend is on EU membership?

I took the figures from the government’s Public Expenditure Statistical Analysis 2015 and knocked up a little Pac-Man pie chart. I’m not generally a fan of pie charts – see here for why and for info about the inspiration that made me knock up this chart.

Pie charts are generally a bad data visualisation tool. But this one does the job. If you want to see my spreadsheet to check my numbers go here.

If you think the £3.7bn could be used to fix the NHS as some leave supporters claim (they’ve also claimed the savings from leaving the EU could fund other things too) take a look at my bar chart below that shows the £3.7bn would be a small beer in terms of increasing spending on the NHS, education and other public services.

horiz bar

For the sake of full disclosure, I’m a remain supporter.

Edited on 23 May 16 to add:

A few days after I posted this Ian Cuthbert pointed out on Facebook  that I had made a mistake.  He wrote:

I’m interested in the figure for costs of EU membership, as it doesn’t tally with my understanding. Your figure of £3,723m (0.5%) seems to be for EU transactions (in the Public Expenditure Statistical Analysis). But I don’t understand this to be the same as the cost of EU membership, which page 18 of that source shows as just under £8.9bn (Net expenditure transfers ti the EU). See page 18 of Public Expenditure Statistical Analysis – here’s a screen shot of the part showing costs of EU membership. Here’s the link to the document which you included:
https://www.gov.uk/…/public-expenditure-statistical…

In my own fact check on the graph I simply used the ONS and the OBR figure of £8.5 for 2015, but it was an estimate, not a final figure. That figure is, straightforwardly, the UK contribution to the EU, net of the rebate.

So I arrived at a figure of net contribution for EU membership of a little under 1.2%.

In a way, it is a moot point, because none of this includes the net economic benefits of membership. But it is this figure that the Brexit campaign has headlined (constantly!) and also seriously misrepresented. Nor does it include EU spending on UK programmes, such as ESF and ERDF, as far as I can see.

But I’d be interested to know what you think.

I replied:

You ask me what I think. I think:

a) I’ve checked what you’ve said – you are correct. I misread the wrong table.

b) I am happy to be corrected – there is no shame in it. We should all be open to challenge and that’s why I always post a link to my data sources in all graphics I do, along with the link to my spreadsheet with the calculations. Open data and open calculations is exactly where it should be at. Having people check my work and point out mistakes increases my knowledge and it makes me better. No one is always right.

c) Whilst it is of course better to have accurate figures, the point I was making is broadly the same – it is a very small proportion of total government spend. The real point to debate is whether it presents good value, as it is clear even if we stopped paying in it would be relatively small beer in terms of propping up public finances.

d) I will post a correction on my blog [this is it].

e) I’ve done a new pie chart. See below.

And here’s the new pie chart which is broadly the same as the last one

new eu pie

 

How to make a political graph properly

Pie chart of govt spendI appreciate that the title of this blog post may be a hostage to fortune and I may be called out on my attempt to produce a graph properly. But given I’ve called others out on poor graphics I thought I ought to put my money where my mouth is.

Someone posted this graph on my Facebook page and said “no attribution but what do you reckon?”

The original Facebook post of the person who initially posted this chart said “What the UK spends its money on.  If you look very hard, you’ll spot EU membership in there somewhere.”

So, rather than just say it was a badly chosen chart produced in an uneasy to decipher way (which it is), I thought I’d have a go at making this chart better. I should add I may not be using exactly the same data as the original chart as I don’t know where the author got it from (edited to add: see footnote as the original data soruce is now known). But for your info I am using the government’s Public Expenditure Statistical Analysis 2014-15.

So why do I think this was a badly chosen chart? Well, it’s a pie chart and pie charts are nearly always bad charts to use. So what’s wrong with pie charts?

Let’s take a step back and ask ourselves “what is a chart or graph?”

Technically speaking it is the visual display of quantitative information. Incidentally this is the title of a massively influential data visualisation book by Edward Tufte.

Any chart encodes a numerical value visually, for example, as a plot on an x-y graph, as a bar in a bar chart or as a slice in a pie chart.

In a bar chart the numerical value is encoded in the length of the bar.

A pie chart seeks to show the relationship of each slice to the whole, effectively showing the percentage of the whole.  In a pie chart percentage value is encoded in the internal angle of the pie slice.

The issue here is that charts ad graphs are used to compare values and it is far easier to compare by eye the lengths of a bar in a bar chart as oppose to the internal angles of spices in a pie chart.

But sometimes pictures can tell the story better than words. Take a look at the two pictures below.

Bad pie 2

Bad pie 2

The above examples were borrowed from here. There you go:  bar charts are (nearly always) better than pie charts.

So now let’s see how we can improve upon the original pie chart. Note I’ve not used exactly the same data so I done a rough reproduction of the original chart below. As you will see while it is not a busy and hard to read as the original it is still not easy to read and do comparisons across the spend types.
Pie govt spend - ravi
Just for a laugh let’s see it in 3D. You will see adding 3D makes it even more difficult to read accurately as the 3D effect now distorts the way the internal angles are viewed. Never, ever, ever use 3D pie charts. They are the enemy of clarity and understanding.
pie 3d
So let’s turn it into a bar chart instead. See below. You can see it is far easier to compare the spend on each item as all you have to do is quickly compare the bar lengths, which is far easier than comparing pie slices/angles.
bar govt spend
The above bar chart is better, but we can still improve upon it by turning it into horizontal bar chart so the labels are easier to read. And to make it even better, we should order the bars from largest to smallest; add titles; makes the grid lines less dominant; and add a reference to the author and where the data came from.
horiz bar

I once was the one of the view that pie charts should never be used but I’ve softened a little and I think very occasionally pie charts can be used to illustrate data clearly. I’ve knocked up a pie chart to illustrate this point.

Note, just to amuse myself, I could not help myself but to colour it yellow and rotate it to produce a Pacman type chart.

good pie
There you go folks. It is possible to make your point quickly and clearly if you chose the right chart and think about how you present the data.

On the actual issue of EU membership I’m firmly with the remain camp. My reasons for supporting remain are perhaps best summed up by my union’s General Secretary Dave Prentis who recently gave three good reasons for suppporting remain in his blog:

Rights at work – the regulations we rely upon to protect people at work are enshrined in EU law and upheld by the European Court of Justice. Leaving would mean that hard-won rights like paid holiday, fair working hours, equal rights for part-time workers, and maternity and paternity leave would no longer be guaranteed.

Protecting your standard of living – leaving the EU would put working people’s standard of living at risk by creating economic uncertainty. This would risk investment in jobs and damage consumer confidence. It would also make the pound vulnerable, which would push up prices and interest rates.

Protecting public services – we see every day how a weaker economy has meant cuts in public spending affecting everything including the NHS, local services, policing and education. We can’t afford to risk any more cutbacks at a time when our public services are under increasing pressure.

To read his full blog post on why UNISON are campaigning to remain go here.

Edited to add: Since tweeting this post out I’ve been informed that the original pie chart came from this blog and the source data was the Public Expenditure Statistical Analysis of public spending in 2013-14. My source s the same but for the more financial year 2014-15.

Another dodgy political graphic

Hillary Clinton Venn diagramI posted, here, here, and here about some dodgy graphics after the recent council elections.

And today the following tweet from Democratic US Presidential candidate Hillary Clinton was brought to my attention.

I realise not everyone finds maths easy, but two-circle two dimensional Venn diagrams are pretty straightforward. Here, Clinton (or most likely her campaign team) have managed to misuse a Venn diagram in such a mangled way I’m pretty much lost for words.

I will leave it for you, the reader, to gasp in awe and wonder at such an abomination.

One thing this does show is that dodgy political graphics are not the sole preserve of UK politics.

Left win big in Keralan state elections

naha_2859665g

LDF supporters celebrate in Mallpuram. Photo: Abdul Latheef Naha from The Hindu website

The Keralan State election results are now in (Red Wave Trounces UDF) and there was a big win for the Communist Party of India (Marxist) (CPI-M) led Left Democratic Front (LDF) coalition that beat the ruling Indian National Congress party led United Democratic Front (UDF) coalition.

The LDF won 91 out of the 140 seats.

The strong left-wing tradition (that started with the election off a Communist state government in the first elections after independence)  means that Kerala has the lowest positive population growth rate in India (3.44%); the highest Human Development Index (HDI) (0.790 in 2011); the highest literacy rate (93.91%); and the highest life expectancy (77 years)

The Keralan state assembly has a tradition of flipping between the Communist Party and Congress Party so anything but a win for the LDF would have been a big setback for the left, but the scale of the LDF win was greater than anyone had expected.

A less palatable aspect of these elections was the one seat won by the bigoted Hindu nationalist BJP (who lead the Indian national government) that gave them their first inroad into the Keralan state assembly.

A single seat win may seem like small beer and nothing to be concerned about, but the BJP are a very right-wing party with very close links to both the Rashtriya Swayamsevak Sangh (RSS) and Shiv Sena both of whom are extreme right-wing Hindu nationalist organisations with a propensity to violence, particularly towards Muslims. This violent nature of the RSS was shockingly apparent in these elections, with an RSS bomb attack at an LDF victory rally in Dharmadam, killing one CPI-M worker and injuring several others.

Kerala is perhaps the most religiously diverse part of India and is well-known for being a tolerant place where people of different faiths rub along very happily. As a consequence, unlike most of the rest of India, the BJP with their divisive bigoted politics have generally had little traction in Kerala. So although a the win by the left is to be welcomed, a single seat win in such a tolerant place like Kerala has to give rise to some concern.

Edited to add: this initial post gave the reported 85 set for the LDF but it is now apparent the LDF grouping is 91 as there are five independents who have aligned themselves with the LDF along with the one seat won by the Communist Marist Party. So the LDF now have 91 out of 140 seats.

Corrected version of a dodgy election graphic

donut chart of election results

I posted earlier today about a dodgy election graphic doing the rounds on social media (see left). I tweeted it out and put it about on Facebook. And wow – my blog stats went through the roof.

With yesterday’s post about another dodgy election graphic I’ve had over 1,000 hits yesterday and over 3,000 hits today. This is incredible for a niche vanity blog such as this, which does well to get 10 hits a day.

Anyway since the blog post got circulated I found a Facebook thread where a fella named Marrick Gaeafau actually modified the graph and added some extra context. He kindly agreed that I could share it on here.

I asked him where he got the data from and he said:

“The actual figures were gained from my own record of the elections. I’ve been keeping them since 1979”

Impressive data gathering from back in the day before it was available via the internet. Even if you don’t trust his data, it can be checked on Wikipedia here for 1995 and here for 2006.

The revised graphic is below along with a pro-Corbyn commentary that demonstrates once you have an accurate picture of what has gone how you interpret it matters too. The interpretation is where the debate should be.Proper possible election graphic

I’ve had over 2,500 hits on my two posts on dodgy graphics and I’ve had one person challenge me about why I’m doing this. He suggested that as someone on the left I should not be unpicking this as it damages the left. I disagreed with him and you can read the Twitter exchange here.

Before I provide the commentary on the graphic I want to outline why, despite being a public sector trade union official, and long time Labour Party member / activist I have critiqued the two dodgy graphics. My reasons:

  1. If you drive a car with ice on the windows you are likely to crash because you cannot get accurate feedback on your progress due to the distorted (or blocked) view you have because of the ice. If we want Labour to win the general election in 2020 we need to plot our course based on an undistorted view of progress, otherwise we will most likely crash. We do ourselves no favours if we allow ourselves to have a distorted picture of reality.
  2. I, like many other Labour Party activists rightly pour scorn on the Lib Dems for their leaflets with their legendary dodgy bar charts like this and these. We are stinking hypocrites if we indulge in our own version of dodgy graphics, and we lose the moral high ground.
  3. It damages Labour’s credibility, especially Corbyn supporters, to be associated with this. Corbyn supporters are already characterised by a hostile media as “unrealistic dreamers” and circulating such distorted graphics only serves to reinforce that characterisation.
  4. It is fundamentally dishonest to promote dodgy graphics. I’ve done my own fair share of trying to show the impact of this Tory government by using data sensibly such as an analysis (here and here) of council cuts that shows the most deprived councils are hit the hardest. Such woeful data representation from the left, such as shown on this post, gives the right evidence to say we cannot be trusted to tell the truth.
  5. We should never be afraid of the truth even if it tells us things we don’t want to hear. Telling small lies to ourselves just escalates into telling bigger and bigger lies to ourselves and we then end up somewhere very ugly.

Going back to the revised graphic with the more relevant info on it. Of course, this can be spun as a criticism of Jeremy Corbyn’s leadership. I don’t want to do that here, as there are plenty of people on social media and the mainstream media doing it and I don’t need to add to it; I’m going to give a pro-Corbyn spin on this instead.

For the record this is an academic exercise as I’m not sure I agree with all the arguments, but they are legitimate points of debate. My purpose for stating these points is not to argue for (or against) Corbyn – this post is more about the correct use of data – but I do want to demonstrate you can have a pro-Corbyn analysis of the results without resorting to distorting the way you use the data.

  1. Scotland was a mess well before Corbyn was leader and not of his making. It is far too soon to be expecting his leadership to fix these problems.
  2. Success in the mayoral elections in London and Bristol.
  3. Of course the council results were not good because the party was divided because of the public sniping from dissident MPs. That cost Labour votes. [Side nerd point: this is in fact a confounding variable that you’d want to control for. Therefore, if dissident MPs want to demonstrate Corbyn is electorally damaging they should stop their sniping and let him “fail on his own terms” to prove it is him and not their sniping that is the problem].
  4. The row over antisemitism lost Labour votes. [Side point: who is at fault for this becoming an issue is a whole other argument]
  5. In 2015 Labour suffered the worst election defeat since 1987. It is going to take a long time to turn the party’s fortunes around.
  6. They are actually a lot better than the loss of 100 – 150 councillors that were being predicted by the media before the elections.

Let’s not fool ourselves, compared to 1995 and 2006 these results were not good. But the above points do show it is still possible to make a pro-Corbyn argument around these results without using misleading graphics.

None of us should ever be frightened of the truth. Unless you have a clear and undistorted picture of where you are, you cannot make the right decisions to get to where you want to.

And before I sign off a repeat of my top tips to look out for when looking at graphics and data on social media:

  1. The graphic should have its provenance on it. That way people know who has done it and can track down the creator to ask questions. Not having the provenance on it doesn’t mean the graphic isn’t correct, but it should set alarm bells ringing.
  2. The graphic should say where the data was sourced from, with a link to the data if at all possible. If you cannot track down the data that created the graphic, then be very wary.
  3. If some significant calculations or data analysis is required then there should be a link to the spreadsheet or other analysis that was done so it can be checked. Remember the study by highly respected academics Reinhart and Rogoff, that purported to prove austerity worked; it turned out to have a spreadsheet error that made their conclusions invalid. It was only because they made their spreadsheet available that this error was spotted.
  4. If the graphic purports to compare things – ask yourself is it a fair or false comparison?
  5. If the graphic proves what you want it to, remember confirmation bias and ask yourself if you are just believing what you want to believe. Next, ask yourself if it proved the opposite of what you wanted, what would be your criticisms of the graphic? Finally, ask why these criticisms aren’t valid even though the graphic proves what you want.
  6. It if looks too good to be true, it might well be.

As the late, great physicist Richard Feynman once said

“the first principle is that you must not fool yourself – and you are the easiest person to fool”

Edit added few days after the original post: My claim in the blog title that this was as “corrected version of the dodgy graphic” may have had some issues. Several commenters have made some very valid comments of the revised graphic (read them in the post comments). So in the interests of fairness I think it is important to highlight this rather than let readers assume it is wholly correct and only find the criticisms if they dig down in the comments.  I believe it is better to be upfront about this. I am of course unhappy at having posted the graphic without casting a critical eye over it first. In my haste on a Sunday morning to get the item posted I didn’t check it. My bad. But there should be no shame in acknowledging this. I would however point out, that my criticisms of the original graphic still stand and this second graphic still has some merits, especially in the use of NEV, but it was a mistake for the graphic not to point out it was using NEV. I’m going to post more about this (and other political graphics) when I get time as I think it has thrown up some wider issues especially on whether or not the use of NEV in the revised graphic was reasonable (I think it was).

Another terrible election graphic

evolve politcs donut chart

After blogging yesterday about the terrible election graphic of the map doing the rounds on social media, a new terrible graphic has appeared on social media. It is on the Evolve Politics Facebook page.

What’s wrong with it?

First, it is using a form of pie chart instead of a bar chart, which would be a much better way to represent the data (but that’s another story).  The main problem is the metric it measures is not at all fit for purpose. 

The implication from the graphic is that compared to Cameron’s and Blair’s first year in the leadership job, Corbyn did better. What we have here is a false comparison. As with my last post I’m not going to comment on whether the results are vindication of Corbyn’s leadership or not, I will solely restrict myself to the good use of data.

Before I explain the false comparison I want to point out it says 47% of councillors won – that is nonsense as most Labour councillors defending their seats won. I am assuming it means”47% of council seats were won.

So why is the comparison false?

At each set of local elections only some councils are up for election and in many cases they are not “all out” elections, but only some seats are up. If you want to see the council electoral cycles go to the government website here for a list.

So when council seats are up for election across the country they could be in more Labour voting areas, or conversely in more Conservative voting areas. Hence comparing years like this is meaningless as it is not clear that the electoral cycles are the same, and in any event there have been significant changes in electoral cycles (and types of councils) since 1995.

The percentage of councillors elected for any political party is therefore not a good measure of success (or failure). And neither is  it useful as a comparison over different years.

The best metric to use to determine overall performance is the change in seats. In this election Labour has a net loss of 18 seats and the Conservatives had a net loss of 47 seats. I will leave it to you to interpret this as good, bad or indifferent for Corbyn.  For more info on the results go to the Guardian website here.

Alternatively you can look at National Equivalent Vote Share to get a good idea of how a party has performed. This article by Tony Travers of the LSE explains it very well. Note the article was written before the elections so it not biased for or against any party.

Here are some pointers for you all when looking at data and graphics (political or otherwise) to help you determine the useful from the crud:

  1. The graphic should have its provenance on it. I always put a little logo with my Twitter handle on it on my graphics. That way people know who has done it and can track me down if they think I’ve got it wrong or want to ask questions. Not having the provenance on it doesn’t mean the graphic isn’t correct, but it should set alarm bells ringing.
  2. The graphic should say where the data was sourced from, with a link to the data if at all possible. Again I always try to put the data source on it on my graphics. That way people can track down the data and check my graphic is correct. If you cannot track down the data that created the graphic, then be very wary.
  3. If some significant calculations or data analysis is required then there should be a link to the spreadsheet or other analysis that was done so it can be checked. Remember the study by highly respected academics Reinhart and Rogoff, that purported to prove austerity worked; it turned out to have a spreadsheet error that made their conclusions invalid. It was only because they made their spreadsheet available that this error was spotted.
  4. If the graphic purports to compare things – ask yourself is it a fair or false comparison?
  5. If the graphic proves what you want it to, remember confirmation bias and ask yourself if you are believing what you want to believe. Ask yourself if it proved the opposite of what you wanted, what would be your criticisms of the graphic. Then ask why these criticisms aren’t valid even though the graphic proves what you want.
  6. It if looks too good to be true, it might well be.

We do ourselves no favours if we fool ourselves. The title of this blog is a nod to something the late, great physicist Richard Feynman once said, and another wise thing he said is:

the first principle is that you must not fool yourself – and you are the easiest person to fool

So be careful around those graphics and don’t fool yourself.