In a shocker, House Majority Leader Eric Cantor has lost the Republican primary in Virginia’s 7th Congressional District to a relatively unknown college professor, David Brat. Brat spent little money in the race; Cantor spent over a million dollars. The political media will spend days trying to figure out what happened, but here are a few quick thoughts.

First, this race had a heavy insider vs. outsider dynamic, and the tea party is definitely not dead. As my colleague Nate Silver pointed out previously, it was probably too early to call for the tea party’s demise. Cantor’s loss puts an exclamation point on that.

Yes, the difference between being part of the establishment and being a tea party member can be overplayed. In this case, however, it applies. Brat had the backing of local tea party groups, and you can’t get more establishment than being the House majority leader.

Cantor, in contrast to past victims of GOP primary challenges, such as Sen. Lisa Murkowski of Alaska or former Indiana senator Dick Lugar, has little history of bucking his party. As you might expect of a Republican in a leadership position, he’s voted with his party 95 percent of the time. Because Cantor’s party is quite conservative, his votes have been quite conservative.

But his position of authority also saddles him with any grievances that voters might have against the GOP leadership.

We can look at the statistical system DW-Nominate scores to confirm this. DW-Nominate ranks members of Congress on two dimensions based on their roll call votes. The first dimension is essentially a liberal-to-conservative measure. Cantor is more conservative than any of the Republicans thought to be in trouble in 2014, according to DW-Nominate. (He has about as conservative a voting record as Oklahoma Sen. Jim Inhofe, so he’s no moderate.)

The second dimension of DW-Nominate is less commonly discussed. It describes differences among members of Congress that can’t easily be placed on a left-right scale — for instance, voting on civil rights issues during the mid-20th century. (Many northern Republicans voted in favor of civil rights legislation, while many New Deal Democrats from the South voted against it.) More recently, the second dimension has come to represent something like an insider vs. outsider (or establishment vs. tea party) spectrum.

I don’t want to claim that Cantor’s defeat was all that predictable — it wasn’t. But he does share something in common with those who lost before him, as DW-Nominate places him firmly on the establishment side of the spectrum. In fact, DW-Nominate’s insider-outsider score has had statistically significant explanatory power in describing the outcomes of Republican primaries for the U.S. Senate since 2010 — even if we control for how conservative the district is (based on its presidential voting in 2012) and how conservative the candidate was (based on DW-Nominate’s left-right scale). For those interested, here’s the Stata output:

This anti-establishment dynamic was evident in one of the dominant issues of the campaign: immigration reform. Cantor supported a Republican version of the DREAM Act, created to give legal status to undocumented immigrants brought to the U.S. as children, and Brat repeatedly called Cantor’s stance “amnesty.” Immigration reform has long been an issue that’s divided the establishment from the grass roots more so than it has the left from the right.

One last thought: This race is another example of why you shouldn’t trust the internal polls put out by candidates. Just a few weeks ago, Cantor released a survey showing himself up 34 percentage points. A public poll had the race much closer, with a 13 point lead for Cantor. I’ve written about the bias of internal surveys released to the public. We should assume that internal polls are biased and misleading — unless we have a good reason to think otherwise.

In this case, we knew what we were getting with Cantor’s polling firm, McLaughlin & Associates. As demonstrated by Daily Kos Elections, McLaughlin has gotten many races wrong in the past two years. In Virginia, it had Mitt Romney and U.S. Senate hopeful George Allen winning their 2012 races easily. Both Republicans lost by a significant margin.

Despite Cantor’s McLaughlin poll, it was clear in the final weeks that he thought he was in trouble. He spent a lot of money on negative advertising against a little-known opponent. Compared with the polling he put out, he knew something we didn’t. Sometimes it’s better to follow the money and watch what the campaigns are doing than to listen to what their pollsters say.