Warning: This is just for discussion and I am no mathemetician. I know that I must have made some serious mistakes below and I'm not trying to prove a point other than the numbers in the news are usually BS.

I was reading though a /. article which has a link to a PDF file that purports to show that it is extremely improbably that Buchanan could have gotten the number of votes that he did. Basically, it compares the ratio of Buchanan/Bush votes (I suppose on the theory that the more conservatives in an area, the more likely both are to get votes) and makes a claim that Palm Beach county is out of whack.

My boss, a die-hard Republican, sent me an e-mail where some "statistician proves" that it is mathematically impossible for Gore to win a recount (My rather long e-mail pointed out many flaws with the reasoning, starting with some basic addition errors that the "statistician" made).

Now, don't get me wrong, I think there were some problems with the vote. But I am getting tired of people just pulling numbers out of thin air. So to continue the trend, I decided to play amateur proctologist and find some numbers of my own with a flashlight and a pair of gloves (really, you don't want to visualize that).

What follows is a terribly written hack that is a quickie combination of two scripts that I wrote. It reads a list of Florida counties from the CNN Web site and writes them to a file. Then, it reopens the file (I told you it was a bad hack!) and reads the data back in and uses the county list to pull the vote statistics from the CNN Web site. Then, it uses the Statistics::Descriptive module to figure out the mean (average) of Buchanan and Gore's percentage of votes per county. Then, I compute the standard deviation for each of these candidates percentages. From there, I compare these figures with the figures from the disputed Palm Beach counties to determine if this shows voting discrepancy.

#!C:\perl\bin\perl.exe -w use strict; use LWP::Simple; use Data::Dumper; use Statistics::Descriptive; my $buch_stat = Statistics::Descriptive::Full->new(); my $gore_stat = Statistics::Descriptive::Full->new(); my $counties = "counties.dat"; use constant URL => 'http://www.cnn.com/ELECTION/2000/results/FL/'; my $url_data = get( URL ); my @data = split /\n/, $url_data; open OUT, ">$counties" or die $!; foreach my $line ( @data ) { print OUT "$1|$2\n" if $line =~ /<option value="(\d+)">([^<]+)<\/o +ption>/; } close OUT; use constant BASE_URL => 'http://www.cnn.com/ELECTION/2000/results/FL/ +'; my @candidates = qw( Gore Bush Nader Browne Buchanan Hagelin Phillips +); open COUNTIES, "<$counties" or die "Could not open $counties: $!"; my ( %votes, @gore_percent, @buchanan_percent ); while (<COUNTIES>) { my ( $number, $county ) = split /\|/; chomp $county; print "Processing $county:"; my $url_data = get( BASE_URL . $number ); my $county_total = 0; for my $candidate ( @candidates ) { if ( $url_data =~ /$candidate[^\d]+(\d+,?(?:\d+)?)/s ) { my $vote_count = $1; $vote_count =~ s/,//; $votes{ $candidate }{ $county } = $vote_count; $votes{ $candidate }{ 'Total' } += $vote_count; $county_total += $vote_count; } } my $buch_percent = $votes{ 'Buchanan' }{ $county } / $county_total +; my $gore_percent = $votes{ 'Gore' }{ $county } / $county_total; push @buchanan_percent, $buch_percent; push @gore_percent, $gore_percent; print "\tGore: " . ( sprintf "%.3f", $gore_percent*100 ) . "%"; print "\tBuch: " . ( sprintf "%.3f", $buch_percent*100 ) . "%\n"; } $buch_stat->add_data( @buchanan_percent ); my $buch_mean = $buch_stat->mean(); my $buch_sdev = $buch_stat->standard_deviation(); $gore_stat->add_data( @gore_percent ); my $gore_mean = $gore_stat->mean(); my $gore_sdev = $gore_stat->standard_deviation(); my $target_county = "Palm Beach"; my $target_total = 0; foreach my $candidate ( @candidates ) { $target_total += $votes{ $candidate }{ $target_county }; } my $target_buch = $votes{ 'Buchanan' }{ $target_county }; my $target_gore = $votes{ 'Gore' }{ $target_county }; my $target_buch_percent = $target_buch / $target_total; my $target_gore_percent = $target_gore / $target_total; my $buch_diff = $target_buch_percent - $buch_mean; my $gore_diff = $target_gore_percent - $gore_mean; print "\n$target_county\tTotal votes: $target_total\n\t" . "Buchanan votes: $target_buch\n\tGore votes: $target_gore\n"; print "Buchanan \% in $target_county: " . (sprintf "%.5f", $target_buc +h_percent*100) . "%\n" . "\tDifference between this percent and his mean: " . (sprintf "% +.5f", $buch_diff*100) . "%\n" . "\tStandard deviations: " . (sprintf "%.5f", $buch_diff / $buch_ +sdev) . "\n"; print "Gore in \% $target_county: " . (sprintf "%.5f", $target_gore_pe +rcent*100) . "%\n" . "\tDifference between this percent and his mean: " . (sprintf "% +.5f", $gore_diff*100) . "%\n" . "\tStandard deviations: " . (sprintf "%.5f", $gore_diff / $gore_ +sdev) . "\n";

The result?
Palm Beach Total votes: 432695 Buchanan votes: 3407 Gore votes: 269696 Buchanan % in Palm Beach: 0.78739% Difference between this percent and his mean: 0.31976% Standard deviations: 0.99817 Gore in % Palm Beach: 62.32935% Difference between this percent and his mean: 19.70633% Standard deviations: 2.16736
Oh my goodness! Gore is more than two standard deviations from the mean! There's only about a 2% chance of that! Call the presses! Obviously Gore's the cheater!

That, of course, is total BS and these numbers are completely unscientific. But, I'm willing to bet that a lot of my Republican friends would accept these numbers on face value because they fit what they want to believe!

Really, folks. Most of the numbers being tossed around (just like mine) are useless. Don't let 'em fool ya. And don't accept something just because it fits what you believe.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just go the the link and check out our stats.

Replies are listed 'Best First'.
(redmist) RE: Perl vs. Buchanan
by redmist (Deacon) on Nov 10, 2000 at 13:58 UTC
    I don't trust either of them, but you have to admit (and I know I am going to be --'d for saying this), seeing as Jeb Bush is the governor of Florida, ballot boxes seem to be getting "lost", and votes are disproportionatly high in some places for Buchanan (so much so that even Buchanan admits that something is wrong), you got to suspect that some sort of fraud is going on.

    Now, before everyone gets upset at me, I am not saying that you should trust the numbers that are being fed to you...I think they should be used as a guideline. I just think it's fishy for so many strange things to be happening in a state where one of the candidates brother is the governor, and the the other candidate seems to be losing.

    Pease don't hurt me.

    redmist
    redmist.dyndns.org
    email::redmist
      I'd like to point out that the actual head of elections in the state, Butterworth, is the chair of Gore's election committee in the state. The recounts have generally gone Gore's way, so you could make the opposite assumption here if you want.

      IMHO, there is little or no deliberate cheating, just a shitty human process that requires a bit of peace to complete. And of course peace is the one thing they ain't going to get. =)

      Personally, I find it all pretty amusing. When things get edgy, the fringe crowd starts squealing. The most remarkable data that will come from this will be just how shrill people who take a process like this to heart can get. I've got three close friends (2 Ds, 1 R) who I've put on delete-without-reading mode for email because I'm sick of the belly-aching.

      Thanks to the possibility of Electoral College Representatives being able to secretly vote and them being able to vote whichever way they please, we literally won't know who the President-Elect is till January 6th. Which is unfortunately my birthday and amusingly Epiphany.

      Obligatory useless perl code (like the elections, perl is a constant source of suprise and amusement):

      #!/usr/bin/perl -w use strict;seek DATA,0,0;print()while(<DATA>)__DATA__

      --
      $you = new YOU;
      honk() if $you->love(perl)

        Good point on the Butterworth issue. I don't actually care. I am just surprised that we don't have a system in place that would prevent conflicts of interest like this. (Of course there will always conflicts of interest.) I guess at this point in time, the thing to do that would make the most sense for me to do is to stop caring...I am almost there.

        redmist
        redmist.dyndns.org
        email::redmist