Saturday 15 March 2014

Stata and Benford's Law

I came across this interesting phenomenon called Benford's Law. It states that in a naturally occurring random number sets the probability of 1 being the leading digit of any given number is ~30% and not ~11% as one would expect (the options being 1 through 9). 2 comes up about 18% of the time with decreasing chances all the way through to 9 with ~5%

One thing to note is this dose not happen in limited sets like human hight but does come up everywhere from credit card numbers to the lengths of rivers and this happens irrespective of the units of measurement. Its a difficult phenomenon to understand and involves some mathematics which I don't so if you want to find out more check out the wikipedia page: https://en.wikipedia.org/wiki/Benford's_law

The law can be used to test for fraud because if a set is fabricated by a person or computer it should fail to obey the distribution. I wanted to test this law in Stata and the code below does that - showing an equal distribution and failing the law.

set obs 1000000
gen num = int(1000*uniform())
gen str10 numstring = string(num , "%6.0f")
gen numstring1 = substr(numstring,1,1)
destring numstring1 , generate(num1)

histogram num1 , bcolor(ebblue) lwidth(vthick) 


This happens because Stata and most computer programs cannot generate random numbers; they generate pseudo-random sets.

Thursday 6 March 2014

Master of Arts Dissertation

MA Dissertation: Scottish Electoral Engineering: 
The Introduction of the STV System to the Scottish Parliament

My undergraduate dissertation concerns the impact of introducing the Single Transferable Vote to the Scottish Parliament which currently uses the Additional Member System. It is a technical,semi-statistical, evaluation discussing the possible effects of a change of voting system discussing Electoral Laws, District Magnitude, and Ballot Structure. The use of quantitative methods is not central to the analysis as other work on this blog is.

The dissertation revived  68% (an upper B) and allowed me to graduate with a comfortable 2:1.

Below is the abstract of the dissertation and a link to download it in full.

Abstract:
With the upcoming referendum on Scottish independence, the possibility for electoral reform has become a pertinent issue. This dissertation examines the effects on the party system of introducing the Single Transferable Vote (STV) to the Scottish Parliament replacing the Additional Member system (AMS) system. It does this through a three section approach investigating electoral laws, district magnitudes and ballot structure and using empirical calculations to quantify and support the expected outcomes. After considering all of the outcomes, this dissertation comes to the conclusion that the introduction of STV to the Scottish parliament would increase the proportionality of the party system and increase both the number of parties in the vote and in parliament. This in turn is expected to lead to a fairer party system and increased trust and engagement from the voting public.

Link to full document: Tom Wallace MA Dissertation


Welcome to my blog!

Hello and welcome. I'm Tom and I am currently a Master's student in Applied Social Research at Stirling University. I use quantitative methods and secondary survey data to investigate social and political issues.

My background is in Political studies specifically electoral systems, party systems and political theory. I also do statistical work on a verity of social and economic data sets such as the British Household Panel Survey, the British Social Attitudes Survey, and the World Values Survey.

I am hoping to start a PhD in Politics using qunatatative methods in 2015.

I started this blog to post do-files and information on statistical projects as I complete them which will provide my research with transparency an accessibility. Most of this information would usually be found in an appendix but I am hoping to start attracting contracted quantitative analysis work where a large appendix is less appropriate but access to procedural files is still required ethically.