Examining the election results with Benford's test

The Benford law is a very interesting mathematical observation of naturally occuring numbers. In such numbers the frequency of the first digit from 1 to 9 has a certain pattern. One third of all numbers will have number 1 as the first digit, 17% will have number 2 as the first digit and 12.5% will have number 3 and so on.

Image from Wikipedia.

This can be used to detect if numbers have been manipulated. This is commonly used in detecting financial fraud and sometimes election data.

The Judges from Egypt* group published a detailed count of the presidential elections runoffs between Ahmed Shafik and Mohamed Morsi. The data is of 350 main electoral stations, which provides sufficient granularity to examine the phenomenon described.

Plotted in the graph below is the rate for Morsi, Shafik, invalidated ballots and the ideal Benford rate.

You can see that there isn't much deviation and the numbers follow Benford's law (green line). In Morsi's first digit the number 6 and 7 are more frequent than expected. I used the chi square test and it wasn't a significant difference (p=0.99).

Although article 28 of the constitutional declaration means that whatever result published by the Presidential Election Committee is final. If the data is published in sufficient detail we can compare the numbers to what have been collected so far and see if the final numbers were manipulated.