Using legislative data to calculate the effectiveness of state lawmakers

Legislators sponsor a lot of bills. A large chunk of them go nowhere. According to a Sunlight Labs analysis of the 110th U.S. Congress, of the 11,056 bills introduced, 9,904 died. State legislatures are no different.

With so few bills passed relative to introduced, something that is interesting to look at is the passage rate of sponsored bills by individual legislators. Additionally, it's useful to look at what categories of bills (e.g. environment, crime, civil rights, municipalities) legislators sponsor, whether as a lead or co-sponsor, and have success passing.

From a general knowledge standpoint, this is useful for citizens to get an idea of how their legislators compare to others. It's simple for a legislator to introduce a bill -- the difficulty comes with actually getting it passed.

For organizations (non-profits, businesses, universities, etc.) that are pushing for the passage of legislation, this is a metric that is useful for determining which legislators to target for introducing bills. If I want to introduce a bill that changes landlord-tenant law, I'd want to to know who has sponsored and who has had success passing similar bills previously.

A few weeks ago I spent a night with Ruby writing up a script to calculate this for various state legislatures and sessions.

Since states make it a pain to get bills and laws in a useful data format, the meta information for the bills are grabbed from the datasets available on Legiscan. Alternatively, these could be scraped from each state's site.

The code is mostly self-explanatory -- it loops through each introduced bill during the session and keep tracks for each legislator the bills they introduced both as a primary sponsor or co-sponsor. Additionally it keeps track of the categories of bills they introduced.

The scripts for the 2011 West Virginia state legislature are available on Github at tylerpearson/legislation-passage-rate-analyzer. The JSON results are in a gist.

The scripts and results for 2014 in Virginia are also on Github.

This metric is just one part of using data analysis to make more informed decisions. It could be taken into consideration with numerous other factors (like which party controls the chamber, the committees it goes through, and the amount of public attention a bill receives) to calculate the likelihood that a bill will be passed.

Maybe the next blog post could be using state legislative data with Amazon Machine Learning?