Translate

Friday, May 24, 2013

Big Data and Local Elections (Part III)

These are more queries on the 2012 Voter Database. I will be receiving an updated voter database history soon.  These queries were achieved with PostgreSQL and the R Programming language, which are free, cross platform data analysis and RDBMS platforms. This software is fast, efficient, and fairly easy to learn.

Perhaps what is most interesting here is how much 'Bellingham' as a city dominates voter registration counts in Whatcom County.  I suspect that the voter registration forces each voter into one city or the other as Bellingham only has about 80K total population. Cities with over 10K registered voters:

 "Blaine"        | 10062
 "Lynden"        | 12607
 "Ferndale"      | 13566
 "Bellingham"    | 73671

Over 73K of the 126K registered voters live in these zip codes:

  98229 | 20120
  98226 | 26158
  98225 | 27393

Female registered voters outnumber males by 5K:

 "M"    |   60380
 "F"    |   65552

Only 15 out of 178 Precincts have over 1000 registered voters. Those precincts are:

 239        |      1003
 181        |      1009
 302        |      1013
 229        |      1015
 140        |      1022
 245        |      1044
 136        |      1061
 253        |      1063
 231        |      1068
 169        |      1088
 126        |      1104
 145        |      1115
 182        |      1150
 108        |      1181
 201        |      1217
 208        |      1239


Looking at original registration dates, we see the tremendous increase in yearly registration in recent years:


 date_part | yearcount
-----------+-----------
      2012 |     11795
      2008 |     10578
      2004 |      9533
      2010 |      6819
      2011 |      6689
...


WC2012=# SELECT ResidenceCity, COUNT(ResidenceCity) AS nCity FROM voterdbfvl1 GROUP BY ResidenceCity ORDER BY nCity;
  residencecity  | ncity
-----------------+-------
 "Rockport"      |    36
 "Glacier"       |   196
 "Acme"          |   438
 "Nooksack"      |   724
 "Lummi Island"  |   769
 "Pt Roberts"    |   945
 "Sedro-Woolley" |  1182
 "Sumas"         |  1421
 "Maple Falls"   |  1697
 "Deming"        |  1803
 "Custer"        |  1926
 "Everson"       |  4903
 "Blaine"        | 10062
 "Lynden"        | 12607
 "Ferndale"      | 13566
 "Bellingham"    | 73671
(16 rows)

WC2012=# SELECT ResidenceZipCode, COUNT(ResidenceZipCode) AS nZIP FROM voterdbfvl1 GROUP BY ResidenceZipCode ORDER BY nZIP;
 residencezipcode | nzip 
------------------+-------
            98283 |    36
            98220 |   438
            98276 |   724
            98262 |   769
            98281 |   945
            98284 |  1182
            98295 |  1421
            98266 |  1697
            98240 |  1926
            98244 |  2000
            98247 |  4903
            98230 | 10062
            98264 | 12607
            98248 | 13565
            98229 | 20120
            98226 | 26158
            98225 | 27393
(17 rows)

WC2012=# SELECT Gender, COUNT(Gender) AS nGender FROM voterdbfvl1 GROUP BY Gender ORDER BY nGender;
 gender | ngender
--------+---------
 ""     |      14
 "M"    |   60380
 "F"    |   65552
(3 rows)

WC2012=# SELECT PrecinctID, COUNT(PrecinctID) AS nPrecinct FROM voterdbfvl1 GROUP BY PrecinctID ORDER BY nPrecinct;
 precinctid | nprecinct
------------+-----------
 183        |        36
 128        |        66
 267        |       110
 167        |       134
 179        |       200
 164        |       240
 159        |       251
 109        |       318
 304        |       319
 224        |       325
 263        |       339
 156        |       356
 236        |       358
 139        |       368
 158        |       376
 112        |       389
 105        |       390
 119        |       402
 165        |       404
 157        |       405
 252        |       410
 104        |       423
 605        |       456
 124        |       460
 504        |       461
 114        |       465
 235        |       467
 212        |       484
 130        |       491
 172        |       493
 242        |       495
 116        |       495
 207        |       511
 217        |       528
 255        |       535
 123        |       537
 237        |       538
 121        |       539
 223        |       541
 155        |       542
 170        |       543
 226        |       544
 122        |       556
 204        |       557
 110        |       558
 143        |       561
 401        |       564
 257        |       566
 117        |       570
 177        |       570
 261        |       571
 238        |       574
 161        |       578
 265        |       580
 202        |       585
 149        |       587
 107        |       589
 509        |       594
 260        |       597
 604        |       598
 153        |       602
 205        |       603
 173        |       603
 102        |       612
 248        |       613
 180        |       619
 176        |       630
 402        |       633
 611        |       637
 254        |       649
 147        |       649
 132        |       651
 214        |       653
 241        |       664
 262        |       671
 111        |       672
 113        |       679
 603        |       683
 801        |       686
 501        |       689
 507        |       690
 162        |       692
 607        |       699
 251        |       700
 243        |       701
 103        |       704
 134        |       711
 120        |       713
 220        |       715
 701        |       724
 264        |       733
 154        |       733
 142        |       738
 246        |       738
 163        |       742
 221        |       742
 228        |       744
 174        |       744
 608        |       748
 218        |       749
 303        |       751
 230        |       757
 502        |       759
 152        |       763
 209        |       765
 256        |       765
 138        |       770
 215        |       774
 232        |       775
 129        |       790
 219        |       794
 247        |       800
 606        |       806
 216        |       813
 503        |       819
 125        |       820
 506        |       820
 258        |       821
 266        |       829
 610        |       831
 233        |       834
 115        |       836
 508        |       836
 602        |       841
 234        |       849
 240        |       849
 250        |       852
 106        |       863
 227        |       863
 127        |       873
 244        |       873
 210        |       874
 259        |       875
 150        |       876
 211        |       882
 175        |       885
 609        |       887
 171        |       889
 505        |       898
 118        |       902
 178        |       905
 203        |       907
 144        |       909
 160        |       917
 141        |       919
 168        |       921
 131        |       932
 148        |       934
 151        |       942
 225        |       943
 249        |       944
 101        |       945
 222        |       962
 166        |       964
 137        |       974
 146        |       980
 133        |       981
 301        |       985
 206        |       992
 135        |       992
 601        |       995
 213        |       995
 239        |      1003
 181        |      1009
 302        |      1013
 229        |      1015
 140        |      1022
 245        |      1044
 136        |      1061
 253        |      1063
 231        |      1068
 169        |      1088
 126        |      1104
 145        |      1115
 182        |      1150
 108        |      1181
 201        |      1217
 208        |      1239
(178 rows)


WC2012=# Select (extract(year from OriginalRegistrationDate)),COUNT(extract(year from originalregistrationdate)) AS YearCount FROM VoterDB GROUP BY (extract(year from original
registrationdate)) ORDER BY YearCount DESC;
 date_part | yearcount
-----------+-----------
      2012 |     11795
      2008 |     10578
      2004 |      9533
      2010 |      6819
      2011 |      6689
      1992 |      5752
      2000 |      4378
      2009 |      3833
      2006 |      3737
      2007 |      3625
      1995 |      3585
      1996 |      3540
      1993 |      3190
      1994 |      3134
      2003 |      3050
      1999 |      2831
      2002 |      2818
      2005 |      2789
      1988 |      2720
      1998 |      2470
      1997 |      2341
      2001 |      2273
      1991 |      2165
      1984 |      2161
      1980 |      1848
      1990 |      1657
      1972 |      1438
      1976 |      1329
      1982 |       945
      1983 |       933
      1986 |       888
      1989 |       861
      1968 |       789
      1970 |       726
      1987 |       722
      1979 |       691
      1971 |       671
      1964 |       618
      1978 |       585
      1975 |       515
      1974 |       503
      1960 |       432
      1956 |       430
      1981 |       390
      1985 |       361
      1966 |       355
      1977 |       328
      1973 |       275
      1952 |       260
      1967 |       229
      1962 |       213
      1948 |       173
      1958 |       158
      1969 |       155
      1950 |       139
      1954 |       125
      1946 |        71
      1965 |        69
      1963 |        67
      1944 |        53
      1959 |        32
      1957 |        19
      1947 |        18
      1955 |        17
      1961 |        15
      1940 |        12
      1942 |        12
      1951 |        11
      1949 |        10
      1936 |         7
      1943 |         6
      1938 |         4
      1945 |         4
      1953 |         4
      1941 |         2
      1934 |         1
      1939 |         1
      1930 |         1
      2015 |         1
      2201 |         1
      1933 |         1
      2897 |         1
      2021 |         1
(83 rows)