fivemack: (Default)
[personal profile] fivemack
So you don't have to scrape the BBC yourself:

http://www.chiark.greenend.org.uk/~twomack/2010-results.txt

contains 4056 lines of the form

Chelsea & Fulham } Blue Environment Party } 17


The vote-count is blank for all the parties in Thirsk & Malton since that election hasn't happened yet.

The example script here makes the following list of parties standing in more than twenty places:

Party nameNumber of places standing Deposits saved
Socialist Labour Party230
Monster Raving Loony Party270
Trade Unionist and Socialist Coalition380
Plaid Cymru4029
Scottish National Party5959
Christian Party710
English Democrats1071
Independent25013
Green3357
British National Party33872
UK Independence Party55899
Conservative630627
Labour631625
Liberal Democrat631630


(for the curious, the English Democrats kept their deposit in Doncaster North; the Liberal Democrats kept all of theirs but I divided by zero in Thirsk; the Conservatives lost theirs in Na H-Eileanan An Iar and Glasgow East; Philip Lardner stood as an independent in Ayrshire North after being deselected from the Conservatives)

Date: 2010-05-08 08:15 pm (UTC)
aldabra: (Default)
From: [personal profile] aldabra
Oh poor Greens. Losing deposits, losing deposits, who'll come a-losing deposits with me?

Date: 2010-05-08 08:35 pm (UTC)
From: [identity profile] helenbr.livejournal.com
You don't necessarily have to screen scrape the BBC. We've been using the data from the Guardian, which has it available as a Google spreadsheet. We'd been wondering whether Lib Dem swing might be correlated with Lib Dem votes in 2005 (it didn't seem to be).

Date: 2010-05-08 09:26 pm (UTC)
ext_8103: (Default)
From: [identity profile] ewx.livejournal.com
Oh, excellent, I’d been hoping to stumble across a data set like that (not having yet looked very hard l-)

Date: 2010-05-08 11:18 pm (UTC)
From: [identity profile] mooism.livejournal.com
650 seats in the UK, less 18 for NI gives 632 seats in GB, less one for the speaker leaves 631. Leading to the questions of which other 2 seats didn't have a Lib Dem candidate, which 2 didn't have a Labour candidate, and which 3 didn't have a Tory candidate?

Date: 2010-05-09 08:36 am (UTC)
From: [identity profile] fivemack.livejournal.com
I omitted Aberavon (the list at the bottom of each HTML file, which looked like a list of constituencies, was in fact a list of other constituencies).

And I assumed that every constituency had a three-character code. In fact every constituency except Berwick-Upon-Tweed has a three-letter code, and Berwick has a two-letter code. Bother.

More-correct data (recognisable by having 4069 rather than 4056 lines) now up.
Edited Date: 2010-05-09 08:43 am (UTC)

Date: 2010-05-09 08:42 am (UTC)
From: [identity profile] fivemack.livejournal.com
I have 20 seats with no Conservative candidate: Buckingham, eighteen NI seats, and Ayrshire North and Arran (http://news.bbc.co.uk/1/shared/election2010/results/constituency/848.stm) where the suspended homophobic candidate Philip Lardner (http://news.bbc.co.uk/1/hi/uk_politics/election_2010/scotland/8647206.stm) stood as an independent.

Date: 2010-05-09 11:32 am (UTC)
From: [identity profile] mooism.livejournal.com
Hmm, I'm sure Lardner would have been listed on the ballot paper as the official Conservative candidate. But that makes sense, thank you.

Date: 2010-05-09 12:12 am (UTC)
From: [identity profile] beingjdc.livejournal.com
Hello. This is wildly optimistic as I don't think it works very neatly, but it would be useful for me so I'm asking anyway... I don't suppose you have a script which would turn this into a table with the constituencies down the left hand side but the parties across the top, so 649 lines rather than 4000.

I mainly want to work out how closely the central probable outcome of single stochastic vote would resemble the outcome of pure national proportionality - I can do that bit, convert numbers to percentages of total votes, then add the percentages column (correct? I think so).

Date: 2010-05-09 08:30 am (UTC)
From: [identity profile] fivemack.livejournal.com
How many parties do you want along the top? 133 stood in this election, 54 in more than one constituency, 25 kept a deposit (the 54 and the 25 don't quite overlap) ...

Date: 2010-05-09 11:01 am (UTC)
From: [identity profile] beingjdc.livejournal.com
Yes, that's a bit annoying. Really I want Conservative, Labour, Lib Dem, UKIP, BNP, SNP, Green, Other. But concatenating "others" is probably more work than just starting out with 133 rows and trying things out by hand.

Date: 2010-05-09 11:26 am (UTC)
From: [identity profile] fivemack.livejournal.com
Use script http://www.chiark.greenend.org.uk/~twomack/jdc.pl or download the output from http://www.chiark.greenend.org.uk/~twomack/jdc.txt

Perl is quite a powerful data-scrunging tool; load the result into excel as delimited with semi-colons as the delimiters.

Date: 2010-05-09 12:38 pm (UTC)
From: [identity profile] beingjdc.livejournal.com
Thanks. Interesting result - comes quite close to national PR but maintains the small low-turnout bonus for parties which attract working class votes, and small-constituency bonus for the special cases.

Tories 224 as against 235 in national PR
Labour 196 as against 189
LibDem 146 as against 150
SNP/Plaid gain one each
"Others" 27 rather than 23, though Northern Ireland / randomness makes that a slightly dodgy figure I imagine.

Now to figure out how I calculate the bell curve rather than merely the central probability! La la la.

Date: 2010-05-09 12:39 pm (UTC)
From: [identity profile] beingjdc.livejournal.com
Also you seem to have lost the Conservative vote in North Ayrshire somewhere.

Date: 2010-05-09 03:17 pm (UTC)
From: [identity profile] beingjdc.livejournal.com
Oh, you noted it. They got to him in time for the ballot - I missed that, I thought he was like South Cambs and ended up nominally on the paper but formally disowned - wonder why they didn't replace him in that case.

Date: 2010-05-09 02:06 pm (UTC)
From: [identity profile] sesquipedality.livejournal.com
I think your scrape went a bit wrong. There are only 648 constituencies in it.

Date: 2010-05-09 02:12 pm (UTC)
From: [identity profile] fivemack.livejournal.com
Yes, it went wrong initially: see notes at http://fivemack.livejournal.com/210357.html?thread=997045#t997045

If you download the version dated 0943 today, of 4069 lines and 164228 bytes,

cut -d} -f1 < 2010-results.txt | uniq | wc

indicates 650 constituencies.

Date: 2010-05-10 08:23 am (UTC)
From: [identity profile] meirion.livejournal.com
Good for the Western Isles!

I was safely ensconsed in Highlands and Islands constituency all day Thursday ....

Date: 2010-05-10 01:57 pm (UTC)
ext_44: (bankformonument)
From: [identity profile] jiggery-pokery.livejournal.com
A quick *shoulder bump* to thank you for your public-spirited activity.

March 2024

S M T W T F S
     12
3456789
10111213141516
17181920212223
24 252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 22nd, 2025 08:53 pm
Powered by Dreamwidth Studios