Abstract: Is redistricting the result of partisan gerrymandering or apolitical considerations? I develop a statistical test for partisan gerrymandering and apply it to the U.S. Congressional Districting plan chosen by the Republican legislature in Pennsylvania in 2001. First, I formally model the optimization problem faced by a strategic Republican redistricter and characterize the theoretically optimal solution. I then estimate the likelihood a district is represented by a Republican, conditional on district demographics. This estimate allows me to determine the value of the gerrymanderer’s objective function under any districting plan. Next, I use a geographic representation of the state to randomly generate a large sample of legally valid plans. Finally, I calculate the estimated value of a strategic Republican redistricter’s objective function under each of the sample plans and under the actual plan chosen by Republicans. When controlling for incumbency the formal test shows that the Republicans’ plan was a partisan gerrymander.