Sunday, September 13, 2015

FEC Data: Top 10 employers of donators by top candidates

Here are the top 10 employers of folks who donated to some candidates I am tracking. Visualization done with Kibana using data from FEC.

This is a percentile chart of only the top 10 employers, aggregated by the sum of the total contributions. 


It's hard to tell some colors apart; so here is the same data in tabular format.

Top 12 CAND_NAME.raw Top 10 EMPLOYER.raw Sum of TRANSACTION_AMT
CLINTON, HILLARY RODHAM SELF-EMPLOYED 5,829,156
CLINTON, HILLARY RODHAM N/A 5,498,335
CLINTON, HILLARY RODHAM RETIRED 1,018,560
CLINTON, HILLARY RODHAM SELF 278,810
CLINTON, HILLARY RODHAM NOT EMPLOYED 278,517
CLINTON, HILLARY RODHAM MORGAN & MORGAN 247,625
CLINTON, HILLARY RODHAM AKIN GUMP STRAUSS HAUER & FELD LLP 102,475
CLINTON, HILLARY RODHAM LATHAM & WATKINS LLP 90,350
CLINTON, HILLARY RODHAM SULLIVAN &  CROMWELL LLP 84,000
CLINTON, HILLARY RODHAM MORGAN STANLEY 73,750
SANDERS, BERNARD NOT EMPLOYED 879,938
SANDERS, BERNARD SELF-EMPLOYED 377,741
SANDERS, BERNARD N/A 121,130
SANDERS, BERNARD RETIRED 74,970
SANDERS, BERNARD SELF 51,683
SANDERS, BERNARD NONE 28,110
SANDERS, BERNARD GOOGLE 12,300
SANDERS, BERNARD MICROSOFT 6,000
SANDERS, BERNARD SELF EMPLOYED 5,500
SANDERS, BERNARD HARMONIX 5,400
BUSH, JEB RETIRED 1,178,120
BUSH, JEB SELF-EMPLOYED 1,056,680
BUSH, JEB HOMEMAKER 1,012,670
BUSH, JEB CANDIDATE 388,715
BUSH, JEB GOLDMAN SACHS 144,900
BUSH, JEB STUDENT 82,600
BUSH, JEB NEUBERGER BERMAN 63,100
BUSH, JEB JEB 2016 INC. 30,710
BUSH, JEB NONE 30,000
BUSH, JEB TENET HEALTHCARE 23,600
CRUZ, RAFAEL EDWARD "TED" RETIRED 1,003,835
CRUZ, RAFAEL EDWARD "TED" SELF EMPLOYED 547,690
CRUZ, RAFAEL EDWARD "TED" HOMEMAKER 515,360
CRUZ, RAFAEL EDWARD "TED" SELF 489,492
CRUZ, RAFAEL EDWARD "TED" SELF-EMPLOYED 455,988
CRUZ, RAFAEL EDWARD "TED" NONE 83,005
CRUZ, RAFAEL EDWARD "TED" N/A 77,703
CRUZ, RAFAEL EDWARD "TED" ASHFORD HOSPITALITY TRUST 54,000
CRUZ, RAFAEL EDWARD "TED" REDMAN MANAGEMENT 51,300
CRUZ, RAFAEL EDWARD "TED" WOODFOREST NATIONAL BANK 42,850
RUBIO, MARCO RETIRED 1,145,962
RUBIO, MARCO SELF-EMPLOYED 655,630
RUBIO, MARCO HOMEMAKER 519,485
RUBIO, MARCO SELF EMPLOYED 210,014
RUBIO, MARCO GOLDMAN SACHS 47,080
RUBIO, MARCO MCNA DENTAL 36,900
RUBIO, MARCO FLORIDA CRYSTALS CORPORATION 25,880
RUBIO, MARCO STUDENT 25,542
RUBIO, MARCO NONE 24,550
RUBIO, MARCO MAIN LINE HONDA 20,800
PAUL, RAND SELF 286,669
PAUL, RAND NONE 232,443
PAUL, RAND RETIRED 186,110
PAUL, RAND SELF-EMPLOYED 85,006
PAUL, RAND SELF EMPLOYED 74,052
PAUL, RAND HOMEMAKER 26,601
PAUL, RAND N/A 17,852
PAUL, RAND GALILEO GLOBAL ADVISORS 17,800
PAUL, RAND GRUBBS NISSAN 15,800
PAUL, RAND PHOTRONICS INC 15,800
TRUMP, DONALD J RETIRED 13,075
TRUMP, DONALD J SELF-EMPLOYED 8,150
TRUMP, DONALD J THE TRUMP ORGANIZATION 4,049
TRUMP, DONALD J AON RISK SERVICES 2,700
TRUMP, DONALD J MCGEORGE ROLLING HILLS RV 2,700
TRUMP, DONALD J MERIDIAN CAPITAL GROUP, LLC 2,700
TRUMP, DONALD J POSEIDON BARGE 2,700
TRUMP, DONALD J WALNUT BOTTOM RADIOLOGY 2,700
TRUMP, DONALD J WM. E. MARTIN & SONS CO., INC. 2,700
TRUMP, DONALD J HOMEMAKER 2,300

Wednesday, September 9, 2015

Checking Out Federal Election Committee Data In Kibana


I really like using Kibana to look at data, not only can you gain some insight; but it's just plain old fun. I recently had some free time and stumbled onto Federal Election Committee's website (FEC) http://fec.gov/. For those of you not familiar with them; they track all political contributions to PACs and political candidates.


 In the spirit of transparency and gaining some insight I decided to write a little script to pull the data and make it a bit easier to work with. Originally, it was to format it into a neat CSV with headers plus decoded and denormalized data for pandas, but I soon wrote another script to also index this data into ElasticSearch so I can look at it in Kibaba. Kibana is a great tool for checking out data, but it doesn't make the best presentation tool. Either way, here are a few screenshots.


Initially, it was interesting to out exactly who is in the lead. Now there are a lot of elections and candidates,  and I didn't want to overcrowd the charts to I filtered out the bottom of the pack that will probably not win. Here is the list of candidates that are included in an ES format string that you can re-use:
(CAND_NAME.raw :"BUSH, JEB" OR CAND_NAME.raw:"RUBIO, MARCO"  OR CAND_NAME.raw:"CAIN, HERMAN"  OR CAND_NAME.raw:"SANDERS, BERNARD"  OR CAND_NAME.raw:"PAUL, RAND" OR CAND_NAME.raw:"CLINTON, HILLARY RODHAM" OR CAND_NAME.raw:"CRUZ, RAFAEL EDWARD \"TED\"")

 So I ran a quick visualization to add up transaction amounts and aggregate them per week per candidate.



No big surprise there, Hillary has been banking cash throughout the campaign.  Cruz was off to a good start too, but dwindled after March. However check out Bernie, he was a bit low on cash until June; where he got some massive dough. Jeb's cash flow spiked up a bit too, however overall it's kind of hard to distinguish each candidate because so many of them are bunched up in the same place (bottom).

Using Kibana I can change the type of chart to log (from linear) to make this a bit better. Here is another version of exactly same information. For the layman; notice how the distance between millions starts to shrink closer to the top.

Not sure if this was terrible helpful in this case; but the functionality is here regardless.

Another thing I wondered is who actually contributes to these candidates and what are they all about? Now this is data from the individual contributions file from FEC, so it should be limited to individuals donating to various committees and candidates. Lets see if we can break down these contributions by state, but not in a fancy map; just a regular bar plot (my favorite :))

Here are the top 10 states that gave money:



 Looks like California, Texas, Florida and New York have really been leading the charge here... lets see what it looks like based on the total amount contributed. I changed the Y axis to the the sum of total contributions.


Looks like DC left all these states in the dust. Hmm, now I wonder, who from DC contributed? And to whom? We'll come back to that another blog post, but now lets check out the employment information of our generous contributors. A regular bar chart would be a bit boring so lets do a split bar chart based on candidate and top 5 occupations that contributed.


And here we are..... Top 3 contributors to Hillary are Attorneys, Retired and Homemakers; these are also the top 3 occupations for almost all of the candidates. It's hard to tell what up with Bernie though, his bar is all squished up and indistinguishable. Lets adjust our bar chart to be a percent chart. Through this we should see the relationship between slices in each bar, but not between the bars themselves.

A few clicks in the options and here we are:





What the hell is that slice consuming Bernie's bar... Oh, it's the "Not Employed" occupation, looks like those guys contributed the most money to him.  The other ones up top are professors and physicians.

However it's weird that not employed were giving Bernie so much money; I mean where would they get it from? We can confirm this by adjusting the Y axis here, instead of summing up the transaction amounts, we can just do a count of contributions. So here it is... now before you look at it; one thing that I want to point out is that the order of the bar columns is changed and so are the color labels. Kibana is just good like that; it keeps you on your toes to make sure you are always paying attention, and yep, that big now blue bar is still there.




Anyway, I hope you enjoyed this. I know that it was pretty fun writing this; I am going to play around with the data a bit more and show some new stuff in a couple of weeks. If you want to experiment with this at home; all you need is ElasticSearch, Kibana (open source and free from https://www.elastic.co/) and my code to download and massage the FEC data (https://github.com/nickvasilyev/FEC_DATA_LOADER).