Category: statistics

You should be reading Matt Black’s fantastic NHS blog

The NHS is in the news, so it’s probably time to promote the hell out of this awesome blog I found!

Point the first: There is no relationship between “rising demand” for A&E treatment and waiting times. Also, a large majority of people waiting in A&E need to be admitted, so there is no point badgering people to see their GP/go to a pharmacist/call a number instead.

Point the second: demand isn’t actually rising much, instead, we started counting people who go to walk-in clinics as A&E attenders. As a consequence, the constant initiatives badgering people to go to walk-in clinics, minor injury units, GPs, pharmacists, or just fuck off and die and don’t bother us already actually make the problem worse.

Point the third: the 4-hour wait target is part of the problem, not part of the solution, because in effect it rewards those A&Es who either maximise the number of patients waiting 3 hours, 59 minutes, or else palm off as many patients as possible on some other hospital. (The histogram is spookily like the distribution of house prices when stamp duty was levied on a similar basis.) Fascinatingly, the best-performing hospitals show less of this effect. Also, for some reason, hospital discharge processes slow right down every morning around 8am, causing queues to propagate back through the system.

Point the fourth, from a different blog it links to: the biggest cause of discharge waits and hence of queues in A&E turns out to be just handing out medicines from the pharmacy, and this could be dramatically improved by not letting the doctors touch it, because unlike the pharmacists they can’t be trusted not to screw it up.

Point the fifth: there is no shortage of A&E docs, but the Royal College of Emergency Medicine understandably likes the idea of more of them.

Point the sixth: picking fights with the docs about working weekends is stupid, because the driver of queuing is discharge, not admissions.

Point the seventh: hospitals typically discharge about 20% of their patients a day, but they do it mostly just before knocking off at 5pm, while emergency admissions seem to follow the sun and peak in the middle of the day, so a queue must mathematically exist until arrivals drop off during the night.

Point the eighth: one overriding theme in all of these is that the NHS’s tradespeople are really important and we should trust them much more relative to the docs. Ironically, though, it’s by using the tools of statistical process control and scientific management that this socially radical conclusion becomes apparent.

Point the ninth: Jeremy Hunt is still health secretary. Why?

NRS social grades are flawed but at least it’s not Facebook

I never knew until very recently that the standard National Readership Survey socio-demographic classifications – ABC1, C2DE etc – deal with pensioners by classifying them all as working-class unless they are rich enough to be considered independently wealthy and therefore bucketed in with the As. (The rival National Statistics classification doesn’t deal with the retired at all.) This is a really important example of the politics of data. Inevitably, in collecting data, one has to make decisions about what you are going to count and how. Once made, though, these become social facts.

I had taken it as read for years – decades – that the Labour Party’s electorate was drifting up the social class scale, that there was a problem getting the working class to vote Labour. This has become a substantial media industry. Here’s the Guardian blithely ignoring the issue. But in fact, much of this supposed effect is actually an epi-phenomenon of the boomers getting old. We classify pensioners – people who by definition have stopped working – as working class. Therefore, if old people are more likely to vote Conservative (they are) and their numbers are increasing (they are), arithmetically the Tory share of vote among the C2DEs must go up.

The following chart, from Ipsos MORI, gets to the point. If you look at the cross-break of age groups by class, you find that the effect pretty much vanishes. Labour won the working class, defined as such, handily, and lost the retired by a distance.

The really disturbing thing here is that after all these years of arguing back and forth about those Very Real Concerns of the White Working Class, I never thought to interrogate this fairly basic point about the data. It would be easy to point out that mainstream pundits didn’t, but then most of them count like the rabbits in Watership Down: one, two, three, four many. But my own incuriosity about the classifications startles me. This pragmatic device of newspaper industry market research seemed as enduring and given as class itself. Given that British people tend to imagine they have a refined and forensic awareness of class, this is really quite worrying.

It’s also fascinating that the infrastructure of facts that supports our understanding of politics is so closely connected with day-to-day operations in newspaper circulation departments, but then how could it be otherwise? One of the most important facts about British politics is that it’s structured by the era of mass literacy. Newspaper readership, even now, is much higher than it is in France or the United States, and the NRS itself was devised back when the Daily Mirror was the most-read paper in the world that wasn’t compulsory.

This gives rise to an interesting question. However flawed the NRS is, it’s relatively open. You can just look up the details. It’s not technically open-source, but it might as well be. If you can find the money to commission a poll, or round up enough volunteers, you are free to replicate its results. Of course I didn’t bother even to look it up, but then democracy is among other things the rule of those who turn up. It may be a flawed contribution to the infrastructure of facts, but it’s a contribution. Can we say this about Facebook or any other Internet advertiser’s metrics, which who knows we might be using in fifty years’ time?

Update: it’s been brought to my attention that the rabbits in Watership Down can count to four. Thanks, twitter pedant.

Respectful. Diverse. Compassionate. Fluffy. Thunkful

Bizarre question in a Labour Party survey:

we’d like to know how you feel about our values as a nation. Please complete this sentence: “Above all, I believe Britain should be…”

The options were:

  1. Compassionate
  2. Diverse
  3. Fair
  4. Pioneering
  5. Respectful

What are they up to? Presumably “Respectful” is meant to identify Hazel Blears fans, the sort of people Orwell said were drawn to socialism by a hypertrophied sense of order. I went for “Fair”; as with dumb insolence, I figured they couldn’t do me for it.

sidewalk social scientist don’t get no satisfaction..

So I said you could hide a million-strong dole queue with enough bogus hairdressing and then it totally like happened.

Discussion follows. Fortunately it’s possible to answer this question with data and that’s precisely what Anjum Klair of the TUC policy division’s fine blog did. There’s a lot of detail there, but let’s focus on chart 2.


The green bars represent part-time self-employment, the red ones full-time self-employment. The blue line is the total. Earlier in the second recession, part-time self-employment is driving the total, up to about June 2012. Full-time is flat at this point. The first major uptick is the end of May or beginning of June, 2013. Then there’s a brief dip at the end of August. And then it takes off.

This is crucial, both because it matches Faisal Islam’s chart very closely in point of time, but also, as Anjum Klair points out, it accounts for 82% of the net increase in employment over that period.

So what happened in the spring of 2013? Back on the 3rd of March, 2013, I blogged on a variety of evidence that more or less fictitious self-employment was an emerging survival plan for the unemployed and for badgered Jobcentre Plus staff alike, as well as being a way for chancers like A4e to juice their billings to the government. I called this the bogus hairdresser phenomenon for reasons set out in the post.

I also pointed to this fine post of Voidy’s on the Universal Credit regulations and their tendency to encourage the self-employed to declare more hours.

Basically, declaring self-employment permits you to stop the abuse, permits the Work Programme chancer to bill the government, permits the Jobcentre Plus caseworker to close the file and therefore happy their manager up, and lets you claim Working Tax Credit. If you have kids, you also get additional tax credits in respect of this, which means that you may actually be better off than on JSA. The regulations sort-of get this, giving the DWP the power to bother you to do more hours – therefore pushing you to declare full-time.

So when did the regulations come into force? The 29th of April, 2013. Give them a month to spread through the bureaucracy and for all parties to learn about the new setup, and I think we’ve got a suspect. By October, other people using other methods had also noticed a rapidly growing gap between claimant-count and survey-based measures of unemployment and of underemployment.

Oh, and you were wondering about this? Wonder no more.

The Bradford mutants strike back.

David Goodhart responds to Jonathan Portes and it’s as bad as you might expect. To focus, remember he said 50% of schoolchildren in Bradford have special educational needs? Here’s the tape:

Bradford has just opened two more schools for children with Special Educational Needs,’ he writes. ‘On some measures nearly half of all children in the area qualify for special help.’

Goodhart tries to source it:

One of the main authorities on cousin marriage within the Pakistani community in Bradford is a woman called Nuzhat Ali who told me that almost 30 per cent of Pakistani children suffer from mild or severe disability as a result of cousin marriage adding “that almost half have special needs at school.

Before quoting this, he tries to hide behind “on some measures”, but the quote clearly refers to having special educational needs, a term which has a legal definition and which is what the ONS counts. And suddenly all is clear. Making the charitable assumption that this isn’t just some random person he met, this could actually be the truth…if you stick with what she said rather than Goodhart’s gloss on it.

50% of the subgroup of children with Pakistani origins who have mild or severe disability might well be statemented for SEN. That’s kind of the point of SEN. I wouldn’t be at all surprised if 50% of white kids who have a mild or severe disability were statemented, because the point of statementing is precisely to give disabled kids additional help. Obviously, that’s 50% of 30%*, i.e. 15% of Pakistani children, so the question is 15% * (fraction of Pakistanis in BradMet schools).

The variable is, I think, less than 0.5 = 50%, so your answer is something less than 7.5% of the total school population, rather than 50% of the total.

If the relevant subgroup was those children, of Pakistani origin, who have a mild or severe disability that is positively identified as the result of cousin marriage, which is an alternative reading of the quote, the subgroup in question would be even smaller (some kids have disabilities for other reasons or none) and so would the final score. I don’t believe it is, though, because 30% is implausibly high.

My guess is that she is talking sense, but Goodhart either got his sums wrong or didn’t care. Meanwhile, Goodhart apparently wants to wave the Very Serious Journalist Cock even though he’s not actually a journalist and never has been and talk about going out of London and talking to people, not “looking at databases”, in a weird vaudeville of the US pundits vs. Nate Silver.

But this is serious business, as is this.

*Rather, it’s 50% of “almost 30 per cent”, which could be as little as 25%. As the national average is 20% and the maximum 27%, that would be getting close to the point at which you might think there was actually nothing to see here at all and kick the null hypothesis over the main stand. But there is no way of knowing how much exaggeration is at work here.

Monarchism, mapped

Ever wanted a map of where people care about the monarchy? Jubilee street parties, per 10,000. The borders are coloured to reflect the number of parties. Darker is more in both cases.

Purbeck is the Valley of Loyalty. Next door in the rest of Dorset is the Zero Zone. Ken Clarke’s constituency contains the only people north of London who care. I don’t have any data for Scotland or Northern Ireland.

And YES. Self-hosted WordPress doesn’t fuck with embedded maps!

There are two kinds of people, those who think there are two kinds of people…

And the ones who think the other kind of people ought to be exterminated. Discussion of Jonathan Haidt’s six foundations theory of politics (which argues there are six, innately determined, moral intuitions that define political identity), in which it’s suggested that they actually reduce to two, driven by the emotions of shame and guilt. Now, this bit interested me:

If you assume the existence of these six sets of modules, he can show that whether you identify as liberal or conservative correlates with different answers to questions meant to stimulate those modules. He does not, however, make a novel empirical hypothesis that would be true if his use of the six module theory were true.

Well, I used to know a man who did something similar, Chris Lightfoot, but with the distinction that rather than theorising six modules, coming up with questions, and demonstrating that they correlated with partisan identification, he came up with agree-disagree questions about politics whose answers correlated with partisan identification, and then tried to infer structure from the results.

Interestingly, the political survey project also got two axes, one which seemed to be a spectrum between authority and liberty, and one which seemed to be an economic left/right spectrum. The first was by far the most statistically significant and the most powerfully correlated with voting. The second was much weaker, and it’s also worth noting that the identification of it with degrees of economic egalitarianism or state-vs-market was much looser and more debatable than the liberal/authoritarian one, partly because it was mostly asking about a state/market dichotomy rather than about labour/capital or equality/meritocracy. One might suggest that if he had a hypothesis, it was that as a result the Lib Dems were going to be in government, not surprising as (like me) he was a strong supporter at the time.

Where the rubber hit the road, Tories and extreme rightists were indistinguishable, and were separated from Labour, the Lib Dems, Greens, Scottish and Welsh nationalists primarily by greater authoritarianism. There was much more overlap on the economic scale, but the non-rightist parties were observably more egalitarian, although there wasn’t much to say between them on that score. To put it another way, there was a substantial degree of consensus about the economic sphere, although the Right did have an extreme tail, and disagreement about authority vs. liberty.

Now, Daniel Davies pointed out that the authoritarian/liberal axis was probably measuring the same thing as Robert Altemeyer’s social authoritarianism index, and both of these were measuring the same thing as Theodor Adorno’s F-type personality. I will go further and argue that the shame axis is also the same thing.

Where you stand, though, is where you sit. YouGov administered Chris’s questions on the back of their national opinion poll in 2005, when the second stage of the rocket of the housing bubble hadn’t yet kicked in and a casual observer might have been forgiven for thinking that economic issues weren’t especially salient, and the Liberal Democrats were operating as a party with Labour’s economic policy and less authoritarian values. The Conservatives, in the meantime, pursued a policy until very late in the day of being a party that stuck to the socio-economic consensus and split their ticket on liberty, going somewhat more authoritarian on crime and immigration and somewhat less on things like ID cards. That’s consistent with the model, at least.

What I would love to see, though, is a re-run of the project. I expect that the economic axis will be much more salient, perhaps even to the point of being the stronger. But I don’t expect that this will be a one-for-one exchange. Instead, I expect that the total variance on the two axes will have increased, which is essentially a measurement of the polarisation, or intensity, of politics.

OpenTech washup, and an amended result

So it was OpenTech weekend. I wasn’t presenting anything (although I’m kicking myself for not having done a talk on Tropo and Phono) but of course I was there. This year’s was, I think, a bit better than last year’s – the schedule filled up late on, and there were a couple of really good workshop sessions. As usual, it was also the drinking conference with a code problem (the bar was full by the end of the first session).

Things to note: everyone loves Google Refine, and I really enjoyed the Refine HOWTO session, which was also the one where the presenter asked if anyone present had ever written a screen-scraper and 60-odd hands reached for the sky. Basically, it lets you slurp up any even vaguely tabular data and identify transformations you need to clean it up – for example, identifying particular items, data formats, or duplicates – and then apply them to the whole thing automatically. You can write your own functions for it in several languages and have the application call them as part of the process. Removing cruft from data is always incredibly time consuming and annoying, so it’s no wonder everyone likes the idea of a sensible way of automating it. There’s been some discussion on the ScraperWiki mailing list about integrating Refine into SW in order to provide a data-scrubbing capability and I wouldn’t be surprised if it goes ahead.

Tim Ireland’s presentation on the political uses of search-engine optimisation was typically sharp and typically amusing – I especially liked his point that the more specific a search term, the less likely it is to lead the searcher to a big newspaper website. Also, he made the excellent point that mass audiences and target audiences are substitutes for each other, and the ultimate target audience is one person – the MP (or whoever) themselves.

The Sukey workshop was very cool – much discussion about propagating data by SMS in a peer-to-peer topology, on the basis that everyone has a bucket of inclusive SMS messages and this beats paying through the nose for Clickatell or MBlox to send out bulk alerts. They are facing a surprisingly common mobile tech issue, which is that when you go mobile, most of the efficient push-notification technologies you can use on the Internet stop being efficient. If you want to use XMPP or SIP messaging, your problem is that the users’ phones have to maintain an active data connection and/or recreate one as soon after an interruption as possible. Mobile networks analogise an Internet connection to a phone call – the terminal requests a PDP (Packet Data Profile) data call from the network – and as a result, the radio in the phone stays in an active state as long as the “call” is going on, whether any data is being transferred or not.

This is the inverse of the way they handle incoming messages or phone calls – in that situation, the radio goes into a low power standby mode until the network side signals it on a special paging channel. At the moment, there’s no cross-platform way to do this for incoming Internet packets, although there are some device-specific ways of getting around it at a higher level of abstraction. Hence the interest of using SMS (or indeed MMS).

Their other main problem is the integrity of their data – even without deliberate disinformation, there’s plenty of scope for drivel, duplicates, cockups etc to get propagated, and a risk of a feedback loop in which the crap gets pushed out to users, they send it to other people, and it gets sucked up from Twitter or whatever back into the system. This intersects badly with their use cases – it strikes me, and I said as much, that moderation is a task that requires a QWERTY keyboard, a decent-sized monitor, and a shirt-sleeve working environment. You can’t skim-read through piles of comments on a 3″ mobile phone screen in the rain, nor can you edit them on a greasy touchscreen, and you certainly can’t do either while looking out that you don’t get hit over the head by the cops.

Fortunately, there is no shortage of armchair revolutionaries on the web who could actually contribute something by reviewing batches of updates, and once you have reasonably large buckets of good stuff and crap you can use Bayesian filtering to automate part of the process.

Francis Davey’s OneClickOrgs project is coming along nicely – it automates the process of creating an organisation with legal personality and a constitution and what not, and they’re looking at making it able to set up co-ops and other types of organisation.

I didn’t know that OpenStreetMap is available through multiple different tile servers, so you can make use of Mapquest’s CDN to serve out free mapping.

OpenCorporates is trying to make a database of all the world’s companies (they’re already getting on for four million), and the biggest problem they have is working out how to represent inter-company relationships, which have the annoying property that they are a directed graph but not a directed acylic graph – it’s perfectly possible and indeed common for company X to own part of company Y which owns part of company X, perhaps through the intermediary of company Z.

OpenTech’s precursor, Notcon, was heavier on the hardware/electronics side than OT usually is, but this year there were quite a few hardware projects. However, I missed the one that actually included a cat.

What else? LinkedGov is a bit like ScraperWiki but with civil servants and a grant from the Technology Strategy Board. Francis Maude is keen. Kumbaya is an encrypted, P2P online backup application which has the feature that you only have to store data from people you trust. (Oh yes, and apparently nobody did any of this stuff two years ago. Time to hit the big brown bullshit button.)

As always, the day after is a bit of an enthusiasm killer. I’ve spent part of today trying to implement monthly results for my lobby metrics project and it looks like it’s much harder than I was expecting. Basically, NetworkX is fundamentally node-oriented and the dates of meetings are edge properties, so you can’t just subgraph nodes with a given date. This may mean I’ll have to rethink the whole implementation. Bugger.

I’m also increasingly tempted to scrape the competition‘s meetings database into ScraperWiki as there doesn’t seem to be any way of getting at it without the HTML wrapping. Oddly, although they’ve got the Department of Health’s horrible PDFs scraped, they haven’t got the Scottish Office although it’s relatively easy, so it looks like this wouldn’t be a 100% solution. However, their data cleaning has been much more effective – not surprising as I haven’t really been trying. This has some consequences – I’ve only just noticed that I’ve hugely underestimated Oliver Letwin’s gatekeepership, which should be 1.89 rather than 1.05. Along with his network degree of 2.67 (the eight highest) this suggests that he should be a highly desirable target for any lobbying you might want to do.

a dance to the music of confirmation bias

OKTrends has an amusing post, but what I like about it is that it’s consilient with the process I defined here. My idea was that songs that were rated 5 might be good, but might also just be violently weird to the reviewer. By the same logic, the same must be true of the 1s. Assuming that my tastes aren’t the same as the reviewer, the information in the reviews was whether the music was either mediocre, or potentially interesting. The output is here.

The OKTrends people seem to have rediscovered the idea independently looking at dating profiles – it’s better to be ugly to some and beautiful to others than it is to be boringly acceptable to everybody.