A random walk

December 16, 2011

A little while ago I gave a talk at Ru3y Manor about randomness.

I put the slides in a random order before the talk, as a bit of a gimmick. Watching it back, it just about worked even though I had no idea what slides are coming next. It felt very different doing it, but I don’t think my nerves really come across.

The video of me adlibbing and squirming is now online. Hope you enjoy watching me suffer a little.

Update: it’s been pointed out that my method of shuffling the slides is subject to bias. Here’s a Monte Carlo proof of sorts. If this truly bothers you, you should probably get out more.

Another month, another inflation figure release and another bit of adding-upsey maths. If I’ve got it wrong, please correct me.

The BBC states:

From January 2007 to January 2011, the RPI went up by 15%, according to the Office for National Statistics (ONS).

Wages though, as measured by average weekly earnings, rose by just 7.6%

So, on average, the earning power of people in work fell by 7.4% in that time, the ONS said.

Now, I take that last paragraph to mean that if I could afford on my annual salary to buy 1000 oranges in January 2007, I would be able to
afford 926 oranges in January 2011 – 7.4% of 1000 being 74 oranges.

But this can’t be right. Let’s work it through:

If my annual salary in 2007 was £100 (not far off, as it happens!) and oranges cost £1, in January 2007 I could buy 100 oranges.

Given 15% price inflation, in 2011, oranges would cost £1.15 and 7.6% wage inflation would put my salary at £107.6.

Now I can afford 107.6/1.15 oranges or ~93.6 oranges. That’s a drop in my spending power of 6.4%.

It’s a quibble, and the thrust of the article remains.

But I’d have a bit more confidence in it if the maths added up. One of those figures, I think, must be wrong.

Inflation, apples and oranges.

September 11, 2011

Inflation screws up all our thinking about prices, but if we’re careful to avoid meaningless numbers, it’s easier to reason about.

I’m somewhat obsessed with inflation. It’s hard to reason about increases/decreases in prices, market sizes, and so on when a 1994 pound is to all extents a different unit to a 2011 pound. And in our culture of shallow infographics where we’re invited to compare THIS to THAT constantly it’s really important to get accurately to the meaning of monetary information.

@RoryTweet posted this brilliant picture showing two rail tickets, one from 1994 the other from 2011. Now, they show different things – one a travelcard bought under the now defunct Network Card scheme, and the other an off-peak return – but if we assume they’re the same for a minute, what can we say about the change in prices?

Well, obviously £4.20 < £10.20. But how much less? Looks like less than half. The difference is £6. So an 140% increase. Wow.

But 1994 pounds aren’t 2011 pounds, so let’s use different units – how about apples and oranges? Would it make sense to say 4.20 oranges < 10.20 apples? Maybe, but not really, right?

A 1994 pound is worth around 50% more than a 2011 pound, so let’s say to convert an orange amount to an apple amount, we need to times by 1.5. Or with proper units, our conversion rate is 1.5 apples/orange. We’ll need to know that conversion rate, and its units in a bit.

So – using our conversion rate. We can say:
4.2 oranges * 1.5 apples/orange = 6.30 apples.
10.2 apples – 6.3 apples = 3.9 apples less.

Or we can go the other way and say:
10.2 apples / 1.5 apples/orange = 6.8 oranges.
6.8 oranges – 4.2 oranges = 2.6 oranges less.

We can now see that the cost has risen by 61% – 3.9 apples/6.3 apples or 2.6 oranges/4.2 oranges. We don’t need any units here, apples cancel apples, oranges cancel oranges. And the percentage calculation works no matter which fruit (or year) we take as a base.

This is much less than the 140% we originally guessed at. We overestimated the increase by 2 and a third times. Goddamned inflation, scourge of dramatic infographics everywhere, does this.

Now here’s where it gets tricky. It’s tempting to say – of the increase of 6 fruit, a certain amount of that increase is down to apple/orange conversion (or inflation) and a certain amount is down to a price rise.

But, I hope you can see that the idea of a 6 fruit increase is kind of meaningless in itself. The rise doesn’t have meaningful units, it’s, in our example, literally comparing apples and oranges.

So, the trick is to convert to a base unit – either 1994 or 2011 pounds and then talk about percentage increases. That works, the units make sense.

And we can avoid meaningless statements. If you see an infographic or statement comparing £ amounts without having converted them to an annual base first or talking about absolute increases due to inflation, well, beware, they’re likely to be very wrong.

I’ve been playing with Chrome browser extensions this week. My latest creation is an inflation ready-reckoner.

It puts a button in your toolbar, click the button and it finds all the pound currency amounts on the page you’re viewing, adding a small button to each of them that pops up a table so that you can deflate or inflate the figure appropriately back to 2001.

Here it is, in action, on the Guardian site:

You can install it from here: Inflation ready-reckoner. It’s free.

Now for the science…

We’re used to thinking of articles and stories being published, fixed, unmalleable. Hyperlinks can of course give some context, a hidden layer behind the narrative, giving some contextualisation. But the text remains fixed.

It feels subversive, fun and useful to dick around with the text using browser extensions. Convert the currencies into more useful ones, insert references that didn’t exist, give context and understanding that the author didn’t intend.

Provide a different code-mediated reading.

It’s a bit like augmented reality, a layer inserted between what leaves the server and what hits your brain.

And, it’s necessarily a political act too – names matter. What happens if I change every occurence, in every article, of “George Osborne” to “George Osborne (18th Baronet of Ballintaylor)”. Or “UK citizen” to “UK subject”. Or “Mumbai” to “Bombay”.

Most of the Chrome extensions are boring, packaged up RSS feeds or utilities. But there’s something more exciting that can be done here. I’ll keep playing.

I tweeted earlier today: “Thinking of my pimped web-browser as my go-to weapon in the guerilla war against propaganda, bad journalism and general shiftiness.”

Yes, that’s it, sort of.

NHS Behind the Headlines

August 15, 2011

Another repackaged hack, this time, one I did at a Rewired State event.

I’ve been a big fan of the Behind the Headlines (BtH) blog that the NHS produce. They do something seemingly beyond our media organisations’ abilities. Namely, they link to science, evaluate it and avoid making shit up for the sake of a scare-worthy headline and its accompanying ‘share-this-link’ traffic.

It’s a bit of a pain, when faced with a health news story to go to the BtH blog, search for it, find the truth, etc. Too many clicks. What you really want is the NHS BtH blog post right there while you’re reading the churnalism.

Luckily, if you’re using Google’s Chrome browser, I’ve fixed that for you. Here’s a Behind the Headlines Chrome Extension that puts a little skull xray button in your address bar on stories that BtH has covered.

When you’re browsing a health story (maybe like this one) or a science paper (how about this one?), click the button and see what NHS BtH has said about said article or paper. Easy. It looks like this:

Behind the scenes, there’s a server running on Google Appengine that every couple of hours, scrapes the BtH blog for new articles. See github for source of both the server and the browser extension.

You can install the extension from this link

It’s been written, just sitting there, for over a year, and I’m sorry I haven’t released this before now – the NHS Choices people said they were going to pay me for it, and that dragged on and on for months, and then nothing. Not even an email to say no, thank-you. Well, there we go, I suppose. I wonder how many other open-data type projects lose momentum when someone official feigns interest but doesn’t have the authority to make stuff actually happen.

A week ago I bought a bike – a folding Brompton, the commuting man’s Transformer – and have been cycling to and from work – a 10km trip from Greenwich to Shoreditch. It’s been a lot of fun so far and I’m still alive.

In fact, I’d say it’s been a fount of joy for my miserable, achy bones.

Cycle lanes

Though they’re temptingly green, I’ve found cycle lanes to be broken, pitted, plated, and potholed – hostile places to cycle. Maybe it would be better with bigger wheels? I’ve already come to avoid them, which sort of defeats the point.

Routeplanning

The Tfl cycle routeplanning app gave me a few options to get from SE10 to EC2A.

It’s really important for me to have a simple, leisurely, quiet route to work while I build confidence. It gave me one.

I’ve found most of the mobile apps to be a bit rubbish though – lots of data and visualisations, little utility.

Oh, and one-way streets. Who knew so many of the streets I was familiar with were one-way? Never thought about it before.

London

Biggest moment of joy was when I got the Overground train yesterday and went over a road that I cycle down. I wanted to tell everyone in the carriage: “see that road there? I cycle down that.”

My brain’s been busy sewing together a bigger patchwork map of a South London that I only really knew from train windows and the top decks of buses. I’m realising there’s a level of detail I’ve never seen before, just there, every day.

I cycle past a duck pond on my way to work. A duck pond. And I pass next to Millwall Stadium and that huge (Surrey Quays?) recycling plant. Today, I saw a bin lorry from Westminster council go into said plant. Yesterday, I saw a new slide being delivered to a playground, and an older brother teaching his sibling to dribble a football.

Somehow these mundane things are awesome and surprising. I feel like I’m getting to know where I live and how it fits together. And gosh, it beats looking at the miserable faces of commuters on trains and buses.

And I’ve been terribly lost too, gloriously cycling-round-in-circles lost. That was fun.

Fitness

How long is it since I did any exercise?

Well, somewhat shamefully, it would be measured in decades rather than weeks. And yet I cycled 12 goddamned miles today, and got out of breath and went really bloody fast down a hill and got home and felt great. Pretty damned pleased with myself.

Brompton

I am in love with this bike. So much fun to cycle. I’ve never owned or driven a car, but there’s a bit of me that yearns to own 2 tons of precision, mechanical, noisy engineering. The simple, clever, classy steel Brompton is the next best thing. It feels like something machined, and not much does these days.

It also feels, um, British – there, I’m so smitten I’ve even come over all jingoistic.

Jag drivers

It’s a bit early to conclude that all Jag drivers are wankers, I can confirm though that all the wankers I’ve come across this week were driving Jaguars.

Twice I’ve been beeped at this week, both beepers were driving Jaguars and both times were beeping for me to get out of the way when I was cycling perfectly legally, and not particularly slowly, in the middle of the road before a right hand turn.

No big deal, and the only problem I’ve had. And even so, nice to have one of my petty class prejudices confirmed.

Conclusion

I wish I’d done this sooner.* And, I hope I can keep it up.

* if I get hit by a lorry in the next week, I take it all back. What a silly idea this cycling lark was.

On AV

May 2, 2011

You should be voting YES in the referendum on Thursday.

There are definite arguments to made against AV. Let’s go through them.

The strongest argument against is that it’s a step on the way to proportional representation(PR). It seems silly not to concede that it is, even though we’ll be voting on AV and not on PR.

PR is bad because there are offensive minority parties, currently underrepresented, that could gain parliamentary representation in a fairer electoral system. This is the only sense in which the Tories’ claim that AV will be a boon to the BNP survives logical analysis.

Most countries that have PR have a threshold – say 5% of national vote – before parliamentary representation is given, which mitigates this somewhat.

But, hold on a second, is FPTP really better here? It privileges local representation (of sorts). This allows minority parties to focus campaigns on particular areas – eg. Barking for the BNP, or indeed Bethnal Green for Respect. And tout d’un coup these parties can gain parliamentary representation though organising locally a minority base vote.

So, sticking with FPTP seems the greater risk here, which explains why the BNP favour a NO vote.

AV, on its own, greatly mitigates the risk by requiring 50% (yes, yes, of preferences remaining…) before parliamentary representation is given.

PR’s also bad because, although systems vary, top-up appointments to parliament are made through party-drawn-up lists. There may be politicians in parliament who have never stood for election and this will undoubtedly strengthen the job-for-life political class.

It surprised me that the YES campaign made central the claim that it’ll end job-for-life seats, while opening the door to PR which makes that somewhat worse. This is a genuine argument against voting YES, perhaps the only valid one I think – that AV and PR might strengthen the hold of the political class.

But PR is, in principle, a very good thing. And it’s the kind of thing that no-one can really argue against. Parliament should reflect the vote of the people. And, if that makes for strange bedfellows and uncomfortable coalitions, so be it. Time for politicians to up their games.

Another argument, AV is not PR. Well, ok, but can you really deny it’s a step on the way? Does it really make sense to vote against this modest reform because it doesn’t go far enough? If this referendum fails, there’s unlikely to be another chance at reform in my lifetime. No, I don’t think this makes any sense. Grow up.

If the referendum on Thursday is lost, you can damn well be sure that the Tory response in the face of any constitutional reform will be: “proof that people care more about government services than constitutional reform.” And that’s largely, uncontroversially true. But we can have both, we deserve that much.

The argument about votes being counted twice is so mathematically disingenuous there’s no sense in really arguing about it. AV is run over multiple rounds, with the assumption that if your preferred candidate is still running, you’ll still vote for them. Everyone’s vote is counted once per round.

Next, we come to the simplicity of the voting system. Well, I find this argument quite astonishingly patronising. Not least because we’re already using this system, quite happily, for other elections. If you want to make a concession, we can write into law that a single cross in the box represents a first preference for that candidate. Problem solved.

The argument for AV is simple – in a third of our parliamentary seats, MPs are elected with fewer than 50% of the votes, the lowest gained just 29% of the votes.

FPTP is too coarse-grained. We cannot tell how much voter support Simon Wright (who gained just 29% of the vote in Norwich) is entitled to – perhaps 50% of voters would have accepted his election, perhaps a majority would have preferred someone else over him.

AV is an honest attempt to change this – to ensure that those elected are supported by the largest number of voters in their constituency. Even if many of those voters would prefer someone else as a first choice.

Optimistically, AV will change the way parties focus funds, by reducing the number of safe seats. Parties will change, even I suspect fragment, and campaigning will be broader, less negative, and more honest. Gone will be those awful, innumerate, patronising “only the Libdems can win here” bar-charts. One can dream. And I do. It’s a step in the right direction.

Tactical voting will be reduced – one can support, for example, a minority right-wing candidate without the danger of letting the pinkos in. And with that reduction, we have at least a chance to halt the decline of our political discourse.

Voting YES on Thursday is an optimistic choice – there are many unknowns and we’d be daft not to consider them. But, our democracy is in poor, old-fashioned, backward shape and well, we just deserve better. I’ll be voting YES.

Rogue Trooper

Rogue Trooper is the last genetic infantryman. He’s a blue, genetically-engineered supersoldier bred to be immune to the deadly chemical war-poisoned atmosphere of Nu Earth. But that is not all. No, that is not all. On death, a GI’s mind can be downloaded on to a biochip and embedded in equipment. Rogue travels with his fallen comrades, Gunnar, Helm and Bagman, embedded in his gun, helmet and backpack.

At the Internet of Things hackathon on Saturday, @jodrell and I set out to create Rogue Commuter. We’re not allowed to do genetic engineering any more – not after the last time – so instead we concentrated on bringing Umbrellar and ManBagman, Rogue’s trusty commuting sidekicks, to life.

Umbrellar and ‘Bagman are small javascript programs that start life on a server and can be edited through a simple webpage. They can talk to each other, and say things out loud, but that’s about it.

Meanwhile, running on a smartphone is a personality host – much like the server, but mobile. When it detects a bluetooth id linked to one of the personalities on the server, that personality migrates from the server to the phone and starts running there.

On the phone, the personality has access to all its host’s senses – GPS, Bluetooth, etc. When the bluetooth id goes out of range, the personality migrates back to the server, along with anything it’s learnt along the way.

So, when Rogue Commuter picks up his backpack in the morning, ‘Bagman starts running on his phone the phone in his pocket. Bagman checks if the pack is lighter than it was yesterday – have you forgotten anything? He dials up the weather report, wait, where’s Umbrellar? It’s likely to rain later. We’re still in the house so it’s fine to politely remind Rogue.

So, ‘Bagman thinks we’re heading for the 7:22 train, it’s not delayed, but that makes a change. It’s been delayed three times this week and he’s already sent a letter of complaint to SouthEastern. Hey Umbrellar, how are you? “Not so good, I’ve been carried around for a week and not opened once. I think he’s got a new hat and forgotten about me altogether.” Hmm. Will you two shut up!

And so on…

Amazingly, we got something more-or-less running. A sinatra app with an embedded V8 interpreter ran the personalities on the server.

Screenshot of app

We used PhoneGap to make an app for the phone. We had difficulty accessing Bluetooth on the iPhone, so Android-only this time.

New species appeared, evolved and died out in the time it took us to get XCode set up to deploy an app to an iPhone. What a waste of time.

Oh, and, with a teaspoon, lots of electrical tape, a microswitch and a butchered Bluetooth headset we made an umbrella that could tell you via bluetooth how many times it had been opened. This was exciting:

I’m taken with the idea that the things around me could have personalities, and that those personalities can be hackable. That they could interact and new things emerge.

Deploying software to my inanimate gear was as easy as giving it a name (or Bluetooth ID). That seems right to me.

I wonder for how long, if I take this forward, I can keep up the conceit that it’s my bag talking and not just another goddamned app on the phone being intrusive.

Not quite a Nu frontier, but at the end it felt, surprisingly, more than the sum of its (rather ramshackle) parts. Can’t wait to play with this kind of thing again.

No more hack-days for me.

March 23, 2011

The hack-day used to be my favourite kind of event. But I’ve not really enjoyed the last couple I’ve been to. I’m not sure why.

Maybe I’m just getting old.

Specific things have niggled me though – and I thought them worth sharing. Maybe others are feeling the same about these events. Maybe I’m alone in feeling like this.

My hack-day is a developer’s speakeasy.

It’s where I get away from deadlines, milestones, next week’s release, last month’s specification. It’s where I just code.

A little part of me died when I saw a project planning tool for hack-day projects win a prize recently.

At my speakeasy, it’s ok to drink to get drunk. It’s ok to be coding, just coding.

The aim isn’t to build a prototype, nor to start a project that will live on past the day, nor to do some cheap R&D.

You could do all of these things, but you can have a successful hack-day without any of them.

In my speakeasy the aim is to spend some time being a coder. If you like, you can share what you discovered. You can throw away what you’ve done, use it to inspire yourself or others. Or, just to get a laugh.

Maybe you’ve given people a murky glimpse of the future. Maybe it’s a product for no-one. Most of the time, it’s just what it is – no more, no less.

In my hack-day, no-one moans about what they couldn’t do. Or blames others for their often woeful APIs. We just code. Around obstacles if we can, through them if we can’t.

In my speakeasy, you can drink moonshine.

Scrape away, even if it’s not allowed. Make up some data, just to make someone smile. Do something in terrible bad taste. It’s all allowed, there are no lawmen here.

And there’s often stuff you’re not allowed to play with in real life – new materials, people, perspectives, tools.

You’re allowed to play in my hack-day speakeasy and no-one will stop you. But if you don’t want to play with the sponsors’ toys, don’t.

My hack-days have only accidental connections with the Agile principles – I don’t care if you embrace change, if your software works, or even if you have a customer. Just come, and code, and share.

And the discipline needed to do Agile successfully? I leave that for my work. Agile, hack-days are not.

Hmm, prizes. It’s flattering to win them, but increasingly, they’re a silly distraction. More for the sponsors than the developers.

The judges’ huddling in a room discussing winners. Feels odd to me every time. I guess if you’re the sponsoring type, it’s important to have a meeting to look forward to while the hacks are being shown.

Hey sponsors, if you like what you see, write a blog post or find the developers and shake their hands.

Now, I can see how my speakeasy hack-day seems unrealistic. Hackdays need sponsorship. Who would sponsor such an open-ended, non-specific event?

But hack-days are an improbable game anyway, and I don’t know, but couldn’t they be done much more cheaply than they are? Without sponsors. Maybe, with developers even paying their own way?

Does anything of lasting value to the sponsors come out of them anyway? The most inspiring things I’ve seen have come from the least directed hacking.

Hack-days shouldn’t feel like work – those that aren’t created by developers for developers will fall short.

So, I’m giving organised hack-days a miss for the foreseeable future. But I’m going to make more effort to find time for hacking with other developers on my own terms.

Updated: I edited the post a little to make it a bit clearer that it’s about what I want out of hack-days, not necessarily what they should be in general. Others will completely disagree, and they might be right. But for me, these things speak to something that I haven’t felt in recent events.

Lost Bomber

January 23, 2011

This is a write-up of the hacking I did at the excellent history hackday, organised by the mighty @fidothe.

This story is about my great-uncle, David William Griffiths. He died returning from a bombing raid over Bremen in 1941. He was 21 years old.

I wanted to put his death in context, and in doing so I discovered it was an ordinary, almost average death, and all the more important for it.

His death is commemorated in the Commonwealth War Graves Commission’s online register. I also found some information about his last mission on the Lost Bombers site.

The diary entry says: “Airborne 2213 18Jun41 from Leeming. Last heard on W/T at 0250 19Jun41 and it is believed the Whitley crashed seven minutes later into the sea off Ameland. Cause unknown.”

My Uncle David’s death is historically insignificant, not part of a defined battle or definite campaign. But his death, I understand, affected his brother, my grandfather, enormously – a terrible grief.

So much so that our family history might be very different if it hadn’t happened.

I wanted to see if I could use the data out there to put David’s death in context.

I wrote scripts to scrape the Commonwealth War Graves Commission site. I created my own database containing all the records for Airmen and -women that died in 1941 – records of some 12,396 deaths and as many individual stories as David’s.

casualties by age

At 21 years old, David was of the modal age. The median age is somewhere around 23. Some 2,700 people younger than David also died that year.

casualties by rank

As a Sergeant, he was also of the modal rank.

casualties by date

He was around the 4,400th airforce casualty that year, on a day that saw 40 people die. Not the heaviest of days, not the easiest. Some 8,000 more would die by the end of the year.

There’s more to tell you and more to find: the Whitley bomber that he was in was but two months old, and soon to be phased out for more reliable models. They were used to drop leaflets during the Phoney War before the outbreak of direct hostilities. But it looks like this mission was probably a bombing raid. It would be great to get hold of some of these leaflets and mission logs.

His crew was, as I think is typical, from various parts of the country and of the commonwealth. A Scot, a Canadian, two Englishmen and David, Welsh, of course taking off from Yorkshire and lost to the North of then Holland. In a time of less travel and more local variety, the variety in these thrown-together crews is fascinating. I’d love to get into the data and understand it better.

In 1941, looking at airforce personnel alone there are 12,395 other stories to be told. And these stories are on the very edge of living memory. I remember David’s portrait – a coloured photograph in his RAF uniform – hanging pride-of-place in my grandparents’ front room, so it’s always been a part of the family history I was dimly aware of. But, since my grandmother died recently, there’s no first-hand link to his person.

I’m left, after all this, thinking of just how young these bomber boys were. Looking at this data has been a much more moving exercise than I was expecting.


The data exported to a Google Fusion Table: data
The PDF of the presentation I gave at the hackday: pdf