---
title: "Project 2: SVD Analysis of Partisanship in U.S. Congress"
author: "INSERT YOUR NAME(S) HERE"
date: ""
output: html_document
---

<!--- Begin styling code. --->
<style type="text/css">
/* Whole document: */
body{
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 12pt;
}
h1.title {
  font-size: 38px;
  text-align: center;
}
h4.author {
  font-size: 18px;
  text-align: center;
}
h4.date {
  font-size: 18px;
  text-align: center;
}
</style>
<!--- End styling code. --->

## Instructions

For this project, you will be exploring U.S. Congress voting data [voteview.com](https://www.voteview.com).
Your goal is to examine the partisanship of U.S. Congress using SVD analysis.
Like Project 1, this project is intentionally open-ended!

Exceptional projects will examine the data in multiple different ways in order to draw interesting conclusions. For example, you might examine:

* How does partisanship compare in the House of Representatives vs. the Senate?
* How does partisanship compare in the 90th Congress vs. the 116th Congress?
* Does partisanship vary by age? By state? By region?
* Who are the most "extreme" partisans in Congress?
* How does California compare to Alabama?


Your projects will be evaluated on the quality of your analyses.
This includes, but is not limited to, the quality of your writing, the usefulness and clarity of your visualizations, and how interesting the insights you provide are.
Your submission should read as one continuous and cohesive report, rather than distinct and unconnected sections. 
To this end, your report should include an introductory paragraph as well as a conclusion/summary paragraph at the end.
The target audience of your report is an educated reader who is uninformed about the details of the data, but is interested in learning more about partisanship in Congress.
I highly encourage you to use [this research article (Porter et al., 2005)](HouseOfRepresentatives.pdf) for inspiration. In particular, pay attention to how they label their primary two "concepts".
Note that the exact axes may not match up, but it can give you an idea of what to look for.

You have the option to work with a partner for this project and submit a group report. 
If you do so, you must both submit the same .Rmd, .html, and .Rproj files on Canvas with both of your names at the top of the .html.


### Details

* If you use this .Rmd as your starting template, please remove all instructions, details, and requirements. I only want to receive your final written report.
* Your Project 2 directory should include an R Project associated with your report and analysis.
* Final submissions must include .Rmd, .html, and .Rproj files
* I **strongly** recommend saving a version of the unprocessed .csv on your machine in a `Data` subfolder within your Project 2 folder so you will be able to work offline. The data are available at:
  * 90th House of Representatives: <br>"https://raw.githubusercontent.com/bryandmartin/STAT302/master/docs/Projects/project2_svd/house_90_raw.csv"
  * 90th Senate: <br>"https://raw.githubusercontent.com/bryandmartin/STAT302/master/docs/Projects/project2_svd/senate_90_raw.csv"
  * 116th House of Representatives: <br>"https://raw.githubusercontent.com/bryandmartin/STAT302/master/docs/Projects/project2_svd/house_116_raw.csv"
  * 116th Senate: <br>"https://raw.githubusercontent.com/bryandmartin/STAT302/master/docs/Projects/project2_svd/senate_116_raw.csv"
* In your visualizations, consider using color to distinguish between groups where appropriate, such as blue for Democrats and red for Republicans.
* `rc` columns stand for roll calls. Each vote has it's own roll call. The code is as follows:
  * `1`: "Yea" vote
  * `-1`: "Nay" vote
  * `0`: Present or not a member of chamber during roll call
  * `NA`: Missing data for unknown reason
* It would be reasonable for you to either remove `NA`'s, or set them all equal to `0`. Make sure you explain your decision.


### Requirements

* Your report should provide insight about at least 4 different aspects of the data.
* Each of these insights should be accompanied by either a visualization, a numerical analysis, or both.
* The text of your report (not your visualizations!) should include an explanation of the mathematical details of what you are using/visualizing in your analysis. For example, if you plot your first two left singular vectors, make sure you mathematically define in your report what is being plotted!
* If and when you visualize data in two dimensions, your report should include a discussion of how much of the energy is maintained and lost in this visualization. This discussion can also include a visualization, or it can be numerical.
* At the end of your report, you should include a code appendix with all of your code, from downloading the data to generating the figures. This code should be well-commented and follow the style guidelines we learned in class. Use comments to label which blocks of code correspond to which visualizations. *You should have no code in the main body of your report!* (Remember: you can use `echo = FALSE` to hide code.)

Keep in mind: **there are no right answers for this project!**
These are real data, and I'm hoping for creative and interesting analyses that tell a compelling story about the data rather than cookie cutter reports. Have some fun with it, and good luck!






