The failure of the Senate on Wednesday to pass a variety of gun control measures is yielding its share of second-guessing. How close was President Obama to seeing the bills meet the 60-vote super-majority required for approval? And was it a good use of his political capital to try?

I won’t attempt to provide definitive answers to these questions, but we can address some simpler ones. What factors predicted how the senators voted? Which were the most surprising yes votes — and which no votes does Mr. Obama have the most license to complain about?

In particular, we will look at the vote on the highest-profile of the gun control measures: the amendment proposed by Senator Joseph Manchin III, Democrat of West Virginia, and also sponsored by the Republicans Pat Toomey of Pennsylvania and Mark Kirk of Illinois, to institute national background checks. That amendment, which required 60 votes for approval, received 54 votes instead. I ran a simple logistic regression model that sought to explain each senator’s vote on the amendment based on five factors.

First, the gun-ownership rate in the senator’s state.

Second, whether or not the senator caucuses with the Democrats. (I excluded Harry Reid of Nevada from the analysis; he voted no for procedural reasons as the Senate’s majority leader.)

Third, the senator’s overall voting record on a liberal-conservative scale, as determined by the system DW-Nominate. (Higher ratings indicate a more conservative voting record. For those senators who were newly elected or appointed this year and who have no DW-Nominate rating, I used a composite measure instead based on public issue statements and fund-raising totals.)

Fourth, the share of the vote that Mr. Obama received in the senator’s state in 2012.

And fifth, a variable indicating whether the senator is running for re-election in 2014.

Most of these measures are highly correlated with one another: for instance, states with higher gun-ownership rates are more likely to have elected conservative, Republican senators and less likely to have supported Mr. Obama last year.

That makes the individual factors difficult to untangle from one another. As shown in the chart below, senators were more likely to vote for Mr. Manchin’s amendment if they were more liberal, if they were Democrats, if the gun-ownership rate was lower in their states, if Mr. Obama performed better in their states in 2012 and if they are not running for re-election in 2014.

Photo

No one factor dominates, however. Rather than artificially cleaning up the model by throwing out variables, it is probably best to acknowledge that the senators may have been weighing a variety of electoral, local, national and ideological considerations against one another, yielding some unpredictability in how they voted and some ambiguity about what the root causes were.

The next chart compares the senators’ projected likelihood of voting for Mr. Manchin’s amendment, according to the model, against whether they actually did so.

Photo

Four senators are projected by the model to be nay votes but voted yes. These included two of the amendment’s sponsors, Mr. Manchin and Mr. Toomey, along with the Republicans John McCain of Arizona and Susan Collins of Maine, both of whom come from states with fairly high gun-ownership rates.

The most unlikely no vote (excluding Mr. Reid) was from Senator Heidi Heitkamp of North Dakota, who is not running for re-election until 2018. The model assigns her an 87 percent chance of voting for Mr. Manchin’s amendment, but she did not do so.

No other senators, however, were projected to have better than a 50 percent chance of voting for the amendment but failed to do so. Does this imply that Mr. Obama did about as well as he could?

Actually, the model is not designed to tell us very much about that. It reflects a statistical snapshot of what happened, but has no explicit way to consider all the counterfactual possibilities for what might have turned out differently.

What does seem to be the case is that the factors governing each senator’s vote were complex and idiosyncratic enough that there were 60 votes potentially in play. Fourteen senators are given somewhere between a 20 and an 80 percent chance of voting for the amendment by the model, meaning there were a lot of swing votes.

The path of least resistance for the amendment to pass, according to the analysis, would have been to win the vote of Ms. Heitkamp along with four more from among the following group of six: the Democrats Mark Begich of Alaska and Max Baucus of Montana, and the Republicans Kelly Ayotte of New Hampshire, Rob Portman of Ohio, Marco Rubio of Florida and Dean Heller of Nevada (this assumes that Mr. Reid would have voted yes as well). Some of these Republicans, however, like Mr. Rubio and Ms. Ayotte, are plausible candidates for the Republican presidential nomination in 2016, meaning they may be more concerned about appealing to conservative primary voters than about public opinion in their states.

Nevertheless, judging by the model, there were some difficult yes votes for the amendment, including Mr. Manchin and Mr. Toomey, as well as Mr. McCain and some vulnerable Democrats like Senator Mary Landrieu of Louisiana. It was close enough to give the president and gun control advocates plenty of room to contemplate what might have been.