Thursday, 30 June 2016
Wednesday, 29 June 2016
Is populism dumb?
Monday, 27 June 2016
Quick update on the relationship between migration and immigration sentiment
Chris Hanretty commented he'd found a positive relationship at constituency level between migration levels and positive migration sentiment. I wondered if there might be some hidden non-linearity there too. Chris kindly (and like a good scientist) provided his data along with his blog post so I downloaded it (plus migration data from the 2011 census) and took a look. Here is mean immigration sentiment by
So, the relationship here is consistently positive. But note that until you get to the last 3
Note also: this uses stock of international immigrants. My previous post used flows over the past 10 years, which is presumably more relevant to the EU debate – the EU had nothing to do with UK immigration to the UK in, say, the 50s, 60s and 70s. But I couldn't find constituency-level data on flows.
Saturday, 25 June 2016
Did areas with the fewest immigrants vote for brexit?
Well, as the Germans say, "jein". (By the way, wouldn't it be great if we could declare that as the referendum result?)
Here's a plot of areas' vote for Leave, against their international immigration net inflows 2004-14. I've added a line from a linear regression. Yep, there's a clear negative slope.

But here's the same data with a local smoother, which lets the relationship vary at different parts of the data.
This tells a different story. For low levels of migration of up to 5% – which includes more than 80% of all local authorities – vote to leave is flat or increasing with migration. Then there is a long tail of local authorities with very high levels of immigration, and here the leave vote declines with migration.
Running linear regressions confirms the story. When you exclude the influential observations with really really high migration, the correlation of migration flows and vote to leave becomes significantly positive.
| All Local Authorities | Local Authorities with < 5% inflows | ||
|---|---|---|---|
| (Intercept) | 55.27*** | 53.65*** | |
| (0.59) | (0.65) | ||
| inflow_int_pct | -0.62*** | 0.98** | |
| (0.09) | (0.36) | ||
| R2 | 0.12 | 0.02 | |
| Adj. R2 | 0.11 | 0.02 | |
| Num. obs. | 380 | 299 | |
| RMSE | 9.80 | 8.82 | |
| ***p < 0.001, **p < 0.01, *p < 0.05 | |||
Moral: beware of superficially convincing statistics.
Better still, beware of self-righteous memes, which make us feel better about losing an argument, by telling us that our opponents were fools.
Update: Chris Hanretty said, how about a Scotland dummy? And he should know, so I threw one in. Then I threw in all the regions, because of omitted variable bias and what the heck. This is still only local authorities with < 5% inflows:
| Scotland dummy | Regional dummies | ||
|---|---|---|---|
| (Intercept) | 55.87*** | 56.95*** | |
| (0.60) | (1.16) | ||
| inflow_int_pct | 0.31 | 0.59* | |
| (0.31) | (0.29) | ||
| I(Region == "Scotland")TRUE | -16.10*** | ||
| (1.56) | |||
| RegionEast Midlands | 1.95 | ||
| (1.66) | |||
| RegionLondon | -14.37*** | ||
| (2.70) | |||
| RegionNorth East | 2.35 | ||
| (2.44) | |||
| RegionNorth West | -0.45 | ||
| (1.62) | |||
| RegionScotland | -17.24*** | ||
| (1.75) | |||
| RegionSouth East | -5.13*** | ||
| (1.45) | |||
| RegionSouth West | -2.70 | ||
| (1.63) | |||
| RegionWales | -3.53 | ||
| (1.87) | |||
| RegionWest Midlands | 2.79 | ||
| (1.77) | |||
| RegionYorkshire and The Humber | 2.48 | ||
| (2.05) | |||
| R2 | 0.28 | 0.43 | |
| Adj. R2 | 0.28 | 0.41 | |
| Num. obs. | 299 | 299 | |
| RMSE | 7.58 | 6.86 | |
| ***p < 0.001, **p < 0.01, *p < 0.05 | |||
Second update.
Someone on twitter said that my second picture above "focuses on tiny variations in the middle but ignores the vast trend". This is an understandable mistake and I worried that someone might make it. The 'tiny variations in the middle', where the trendline goes up, look small on the graph, but that is where 80% of the data is. To clarify, here is the same data, divided into deciles. Each column shows 1/10 of the data, from the 10% of areas with the least migrant inflow, to the 10% of areas with the most. This is hump shaped, as I said, and the only decline is in the top two deciles. (But to be fair, the only increase is in the bottom two deciles, so maybe my regression above is also a bit misleading; there's no reason to lump the middle of the data either with the bottom or the top.)
One obvious point to make is that in the top two deciles, migrants with UK citizenship may have voted to remain. So I don't think this data proves much about "exposure to immigration"; we have to be careful of the ecological fallacy here, i.e. of inferring individual attitudes from aggregate data.
Tuesday, 21 June 2016
A Brexit anecdote
Friday, 27 May 2016
Listening to the Today programme
Friday, 20 May 2016
Linkage
Natural selection in the contemporary United States. (NB: "contemporary" means about a generation ago, so contemporary in a biological perspective.)
Saturday, 14 May 2016
New nature study on genetics of education
There's a new Nature study out on the genetics of education. Pretty cool and interesting stuff.
The background here is that after candidate gene studies failed, people suspected that education and similar things are the result of small effects of many genes. To get a good estimate of those effects you need to "go large" with big N studies. So far this agenda seems to be living up to the hype. We still can't explain much of the variance, but we're explaining much more than we could before.
... Aaaand there's already people calling for this kind of work to be defunded. Blame genetics or culture – those people are idiots.
Monday, 25 April 2016
A paragraph I am thinking about
Explorers Elisha Kane and Isaac Hayes wintered with the Polar Inuit in 1853 and 1861, respectively, and reported that the Polar Inuit lacked kayaks, leisters, and bows and arrows and that their snow houses did not have the long heat-saving entryways that were seen among other Inuit populations. They could not hunt caribou, could only hunt seals during part of the year, and were unable to harvest arctic char efficiently, although char were plentiful in local streams (28). Apparently the population was struck by an epidemic in the 1820s that carried away the older, knowledgeable members of the group, and according to custom, their possessions had to be buried with them (29). The Polar Inuit lived without these tools until about 1862, when they were visited by a group of Inuit who migrated to Greenland from Baffin Island (28, 29). There is every reason to believe that these tools would have been useful between 1820 and 1862. The Polar Inuit population declined during this period, and the tools were immediately adopted once they were reintroduced. After their introduction, population size increased. It is also telling that the kayaks used by the Polar Inuit around the turn of the century closely resemble the large, beamy kayaks used by Baffin Island Inuit and not the small sleek kayaks of the West Greenland Inuit. Over the next half century the Polar Inuit kayak design converged back to the West Greenland
design (30). If this inference is correct it means that for 40 years (nearly two generations) the Polar Inuit could have benefitted from the lost knowledge. Moreover, they collectively remembered kayaks, leisters, and bows and arrows, but did not know how to make them and could not recreate that knowledge.
Boyd and Richerson PNAS 2011. Ungated copy of original article.
Thursday, 21 April 2016
R tip: run commands without brackets
Using R, I often want to type quick commands in. But R commands always have brackets. Typing brackets (e.g. ls()) is a big hassle. I find myself missing the unix command line where you can just type ls.
So, here’s a quick hack to do just that. Put the following in your .Rprofile file in your home directory.
print.command <- function (x) {
default.args <- attr(x, "default.args")
if (! length(default.args)) default.args <- list()
res <- do.call(x, default.args, envir=parent.frame(2))
if (attr(x, "print_result")) print(res)
invisible(NULL)
}
make_command <- function(x, ..., print = TRUE) {
class(x) <- c("command", class(x))
attr(x, "default.args") <- list(...)
attr(x, "print_result") <- print
x
}
Now, just add the following for any command that you’d like to type without brackets. For example, for ls:
ls <- make_command(ls)
From now on, typing the command will run it.
If you want to include default arguments, add them as arguments to make_command, and if you don’t want to print the result, add the argument print = false. So, for a quick way to turn debugging on, I use:
oer <- make_command(options, error = recover, print = FALSE)Typing oer at the command line now runs options(error = recover). All without undue stress on my little finger and the Shift key.
Thursday, 10 March 2016
I corrected for multiple testing and lived
So I decided to match words with actions, and correct for multiple testing in the honesty paper. The experience left me feeling a bit ambivalent. Here's what I learned, and some conclusions.
- There are many ways to "correct" for multiple testing, and the P values mean different things.
Suppose now you have 20 P values for 20 null hypotheses. If all the nulls are true, you will probably get a P < 0.05 just by the luck of the draw. But how do you want to correct for that?
One question is: "what's the chance of rejecting even one null hypothesis, if all the nulls are true?" So, if you reject a hypothesis when its P value is less than 0.05, you need to adjust those P values upwards somehow, so that, if your nulls are all true, there is no more than a 5% chance of getting any single value below 0.05.
The simplest way to do this is the Bonferroni correction: multiply your P values by 20. This works because, for any events:
Prob(A or B happens) ≤ Prob(A happens) + Prob(B happens) (*)
Applying this:
Prob(any P value < 0.05 under null) ≤ Prob(first P value < 0.05 under null) + ... + Prob(20th P value < 0.05)
So now, if we multiply our P values by 20 on the right, and reject if any corrected P value is less than 0.05, we will be rejecting if any uncorrected P value is less than 0.0025. And assuming that the basic tests are correct, i.e. that the chance of the first P value being 0.0025 or less is indeed 0.0025 under the null:
Prob(any P value < 0.05) ≤ 0.0025 + 0.0025 + ... + 0.0025 = 0.05
OK? Fine. But, two problems.
First, this test is very conservative. It is using that inequality marked (*) above. That inequality only holds with equality if the two events are mutually exclusive. For example, the probability, when rolling a die, of getting an even number or a roll of 4 or more is 4 in 6; the probability of either event on its own is 1 in 2. So, the Bonferroni correction only gives you exact P values if it is impossible to get more than one P value less than 0.05 under the null.
Take an extreme case. Suppose you run the same test twice. Obviously you get the same P value. The chance of getting either P value below 0.05 is just 0.05. If you Bonferroni correct, you are arbitrarily doubling your P values and your chance of getting a corrected P value < 0.05 is 0.025.
Of course you wouldn't do that, but if you run two similar tests - say, tests on the same sample that might have the same kind of error - then you will have the same issue.
The second problem is that it doesn't always make sense to worry about making a single type I error. If I compare 15 countries on some score, I can make 105 possible pairwise comparisons. Do I really want to have less than a 5% chance of getting any star anywhere?
That suggests an alternative way of correcting for P values: to control the "false discovery rate". Correcting this way means: if you reject null hypotheses when they have a corrected P value of less than x%, then on average, no more than x% of your rejected nulls will be true.
But this has problems too. Standard corrections are still conservative. And while significance stars indicating, say, P<0.05, make some sense, it is hard to make much sense out of a specific P values. For example, a P value of 0.03 would mean "of all the P values in this set, not more than 3% would have P < 0.03 under the null". OK, but what do I know about this hypothesis?
As a result of these problems,
- Corrected P values are often hard to interpret.
P values are confusing already. Corrected ones can add a new layer of confusion. They need to be explained carefully.
- It might be more important to correct for 2 tests than for 20.
The problem is the papers which do just 2 or 3 tests, each presented on its own, and get one or two significant results. But that's already enough to seriously screw up p values. Suppose these tests are independent: the chance of getting at least p<0.05 result in 2 is almost 10%. In 3, 14%. See this famous and funny paper.
- Authors need to think about what tests go together.
These different tests are doing different things. Some are my key hypotheses. Some are more like robustness checks. Others are put in because a reviewer wanted them. How many tests am I running? Offhand, I don't know, and I'm sure my readers won't either. So, just reporting corrected P values for the whole paper makes no sense. Who cares what proportion of my results would be significant under the null? Or whether any one of them would be significant? What matters is, for each group of key hypotheses – things I really want to claim – how strong is the evidence for that. So, you don't want to correct for everything in your paper together. Group things that belong together as conceptually "a single hypothesis". I mostly did this, doing several different corrections for multiple testing.
- Bootstrapping has promise but can be hard to implement.
This is cute, and potentially gives non-conservative p values, but it clearly requires a lot of work to do, especially if you haven't thought about it from the start. Which brings me to the last point:
- Write your analysis with multiple testing in mind.
Apologies for the length of this post. I'll try to be shorter in future (and write about more enjoyable topics....)
Tuesday, 9 February 2016
John List on multiple hypothesis testing
But the psychologists were there first ....
Thursday, 7 January 2016
Sunday, 3 January 2016
An anecdote from a teacher friend
(Paraphrased.)
“I caught a pupil of mine cheating on his history coursework, he’d copied it wholesale. So I told him he couldn’t take his A level. First my boss comes in and asks me to reconsider. I say no. So then my boss comes back with the boy and asks me to reconsider. I say no. Then my boss’s boss comes in with the parents, and ask me to reconsider. You see, the school’s results will look bad if we don’t let him take the exam I say no. Finally, my boss’s boss’s boss comes in. I still say no. I like the kid as a person, but he shouldn’t have cheated."
What lessons can we draw from this? First, obviously, misused incentives are as toxic in the education system as elsewhere. Second, it is an example of how difficult (but crucial!) honesty can be. It involves the drawing of clear lines in a story full of shades of grey. I’m sure the kid was nice, I’m sure his parents thought up excellent reasons why his future shouldn’t be harmed by this one mistake, and that the head teacher made the same eloquent arguments, I bet nobody was crass enough to say “we can’t make our exam results look bad”. I equally bet that nobody pointed out the consequence - which is, after all, highly diffuse, distant and uncertain - that if we turn a blind eye to large-scale cheating, our education system will cease to do its job.
More abstractly, I think this anecdote shows that the theory of repeated games is very misleading as a guide to the social science of ethical behaviour.
Let’s recap: numerous “folk theorems" show that if a situation is repeated often enough among the same group of actors, they can achieve almost any outcome, including efficient outcomes (roughly, those which are best for everyone), by punishing bad behaviour in future rounds of play. This has often been taken as a parable for real world. If only people can interact often enough in stable communities, then they will force each other to do the right thing. So, for instance, Coleman (1988): “Social capital in the creation of human capital”. Or Elinor Ostrom passim. Or Ellickson, Order without law, about midWestern ranchers.
Unfortunately, no. Look at the story. Everyone around my teacher friend is persuading him to do the wrong thing. People in the relevant community have interests that are misaligned with that of the wider society. The pressure they bring to bear is making outcomes worse, not better, and only my friend’s strong personality bears up against them. This will be typical in any social system larger than Hillary Clinton’s proverbial village. To function well, large societies need internalized moral rules, not just social pressure.
Thursday, 24 December 2015
Linkage
Thursday, 3 December 2015
Thursday, 26 November 2015
Linkage
The Private Finance Initiative does not look like good value for money. Sigh.
Private finance provides a short-term cash flow benefit for a department. However, over the long term it will not have an advantage as it will have to spend its future budget (over a 25- to 30-year period) to repay the capital and interest of the debt and a return on the investors’ equity to compensate the private sector for their participation in the project....
The Office of Budgetary Responsibility estimates that official government debt levels would be 2% of GDP higher if public rather than private finance had been used in government private finance deals.
In [two previously mentioned] cases the decision to use private finance was made at a time of low private finance costs relative to gilts but by the time these deals were closed the spread above gilts had increased significantly but the ability to use public financing was no longer available to the department....
Wednesday, 25 November 2015
Why not inflate?
As an observer with a poor grasp of macro, my suspicion is that inflation sometimes happens because it is a socially optimal (read: least painful) way to deal with past debts. I suspect it will happen to the Eurozone at some point too. But an awful lot of institutional and ideological scaffolding will first have to be dismantled. Interesting.
One question I'm unsure about is whether expected inflation does the job of deflating debts. I assume it does for e.g. social security transfers, but not for inflation-proofed debt or short-term debt which has to be rolled over. I don't know how much this vitiates the argument for inflation as a "soft default".









