In trying to explain Donald Trump’s stunning victory last week, observers have offered numerous explanations.

He won by running up the vote among people without college degrees. He succeeded by appealing to racial resentment. He profited from economic decline in rural parts of the Midwest. He capitalized on a mix of economic anxiety, racism and sexism among his supporters.

All of these factors probably contributed to Trump’s victory. But which explain the most about his support? Without examining each of these factors simultaneously, it is difficult to figure out whether one or some mattered more than the others.

One way of testing various explanations against one another is to examine county-level vote returns, where contextual information — education levels, racial composition and so forth — can help sort out statistically which factors are most strongly related to Trump’s support.

My analysis suggests that education was an especially strong predictor of the vote, with race and economic distress — particularly declines in manufacturing — playing important, yet somewhat less influential, roles.

To draw these conclusions, I first gathered Trump’s vote share at the county level and combined it with statistics from the U.S. Census and American Community Survey (ACS). I then used variables measuring county-level education levels, racial composition and other characteristics to predict Trump’s vote share in a regression model. The model is weighted by county population and controls for Mitt Romney’s vote share in 2012, since his vote was highly correlated with Trump’s.

The figure below shows the relationship between several variables and Trump’s county-level support. The steeper the line, the stronger the correlation between the measure and Trump’s vote share.

Consistent with much post-election analysis, the share of a county’s residents with a college education is the strongest predictor. Counties with more college-educated residents gave Trump substantially fewer votes. This is in line with the exit polls, which revealed a fairly sharp cleavage on education.

A county’s racial composition also mattered. The larger the percentage of minority residents in a county — whether black, Hispanic, or Asian — the lower Trump’s support. In the graph, I plot lines for the black and Latino populations.

Notably, size of the Latino population was an even stronger predictor in 2016 than in 2012. In 2016, the effect of moving from a prototypically low Hispanic county to a prototypically high Hispanic county was 14 points larger in the Democrats’ favor than in 2012. In other words, counties with large Latino populations, such as Cook County, Ill., Los Angeles County, Calif., and Hidalgo County, Tex., are places where Clinton ran up the score. Given Trump’s demonization of Latino immigrants and promises to deport millions of them, that is perhaps no shock.

I also found evidence consistent with the “racial threat” hypothesis. As shown by the orange dotted line in the graph, Trump’s vote was higher in counties where the number of Latinos has increased significantly since 2000. This suggests that some voters may have supported Trump as a way of expressing white identity in an increasingly diverse nation.

Finally, Trump also did better in counties experiencing a loss in manufacturing since 2000. (The downward slope of the red line means that Trump did better in counties with manufacturing losses, on the left, and worse in areas with manufacturing gains, on the right.) Indeed, economic struggles may well have been the factor that flipped some Midwestern counties in such places as Michigan and Wisconsin: The effect of the manufacturing variable is stronger in that part of the country than elsewhere.

In the end, these county-level results suggest that numerous factors contributed to Trump’s win. But the education gap was especially influential, with race and economic decline — particularly in parts of the Midwest — playing a supporting role.