Wednesday, March 6, 2013

The Singular Value Decomposition and Congressional Voting

I am teaching a class about the SVD (Singular Value Decomposition) of a matrix this week.  I was inspired by a nice article of Carla Martin and Mason Porter, "The extraordinary SVD", to compute the SVD of the voting record of the 112th Congress (House of Representatives) to show to my class.

If you're interested in how this is done, here is the Sage code I used as a Sage worksheet. 

Here is the projection onto the first two singular vectors:




3 comments:

Unknown said...

Apparently something is missing because evaluation in the # parse the data section fails with "d" unknown.

Michael said...

I'd like to play around with this code but in it there are references to several objects defined elsewhere. Any chance you could provide the full code?

Tiffani said...

Awesome!