(Susan Walsh/AP)

As we enter the final stretch of the 2016 campaign, Donald Trump’s struggles have led to speculation about serious consequences for House and Senate Republicans. Some are even suggesting that control of the House is up for grabs.

The counterargument, however, is that House Republicans are protected by the Republican-led gerrymandering after the 2010 Census. As the story goes, this redistricting simultaneously increased the size of the Republican House majority and made those districts incredibly safe for the GOP legislators who represent them.

But how much is gerrymandering really helping House Republicans? My analysis suggests only a little bit. Incumbency appears to be the more important factor.

How gerrymandering really works

The claim that gerrymandering gave the Republicans more seats and made those seats safer is a perennial error by some political commentators. In fact, a party cannot draw district boundaries to simultaneously increase the number of seats it controls and increase the safety of those seats.

Maximizing the number of seats means creating districts with a slim majority for your party in each district. Placing a huge majority of your party’s voters into one district creates a lot of “wasted votes” that could have been used to create majorities in other districts. Thus, a seat-maximizing plan actually leads to more competitive districts.

So what happened in the 2011 redistricting? Clearly, there was gerrymandering, especially by Republican-controlled legislatures. The question is whether it actually made some congressional Republicans more vulnerable.

The graph below provides an apples-to-apples comparison: how well Barack Obama did in 2008 under the old district lines compared with how well he would have done under the new district lines. I focus on the 98 House districts that are currently represented by Republicans and had a very close presidential vote (within five points) in 2012. These marginal districts will be in the most danger of flipping if Trump drags down congressional Republicans.

Unsurprisingly, most of these districts (64 percent) moved toward the Republicans after the redistricting. New York’s 11th Congressional District moved the most.

But at the same time, 36 percent of these districts became less Republican. These districts are especially sensitive to national swings against Republican candidates.

How vulnerable is the GOP majority then?

How many seats could the GOP lose in the House as a result of a Trump loss? To estimate this, I estimated the relationship between the presidential vote and congressional vote in the 2012 election cycle. Then I simulated what would happen as Trump underperformed Mitt Romney, who lost the popular vote by almost four points. I did this simulation both with and without accounting for the incumbency advantage, which should work to Republicans’ favor.

The circles in the figure show that the GOP steadily loses seats as Trump’s loss increases. If we ignore the incumbency advantage, Republicans lose their majority when Trump’s national vote is three to four points worse than Romney’s performance in 2012. That is about what the national polls suggest now, with Hillary Clinton about seven to eight points ahead.

But once incumbency is taken into account, the GOP majority is in much less danger from a Trump disaster. They would continue to retain their majority unless Trump underperforms Romney by six points — that is, Clinton wins by 10 points. This mirrors what Eric McGhee and John Sides found in their House elections forecast: Clinton needs a very large win to give the Democrats even a 50-50 chance of winning a majority.

Could gerrymandering backfire?

These results suggest that even if some gerrymandered districts are vulnerable to a Clinton landslide, the effect of placing Republicans incumbents in office may outweigh that vulnerability. To test this trade-off between district safety and the benefits of incumbency, I conduct the same analysis but use the 2010 district boundaries before redistricting.

The picture below shows that redistricting appears to have very little effect on Republicans’ fortunes in 2016. The model that uses the pre-2011 boundaries (triangles) is nearly identical to the model that uses the current boundaries. At most, redistricting could cost Republicans only a few seats as a result of making the districts more competitive. Incumbency appears to overwhelm any effect of boundary changes.

Of course, this analysis assumes that the relationship between presidential voting and congressional voting is the same in 2016 as in 2012. Given the conflict between Trump and Republican leaders in Congress, we may find that voters are willing to vote for Republican House incumbents even if they don’t vote for Trump. If so, Republicans will have an even better chance of saving their majority.

Michael Barber is assistant professor of political science at Brigham Young University.