Just a couple of weeks ago, many political analysts were still chattering about a contested Republican convention. Then came the Indiana primary, and the forces opposing Donald Trump seemed to unravel almost immediately. This terminal phase of the nominating season is a reminder of how much and why public opinion matters.

“Momentum” is one of the most misused terms in politics — very often it’s false signal in noisy data, especially in general elections. But primaries are different. Because they’re held sequentially, winning one state may encourage voters in subsequent states to jump on the bandwagon because they want to back a winner. Winning also provides candidates with other resources, such as money and favorable media coverage. In short, there are advantages to being the front-runner: Pluralities tend to turn into majorities.

Indeed, one theory of momentum correctly suggested that as of March 15, Republican voters would start breaking toward Trump, and that he would surge to victory.

To see why, we have to start with a research paper called “The End Game in Presidential Nominations,” written in 1981 by Donald Collat, then a Yale law student, and political scientists Stanley Kelley and Ronald Rogowski. (We will call them CK&R for short.) CK&R were interested in bandwagon calculations. When political stakeholders seeking influence, patronage or other spoils choose a candidate, they must endorse someone early enough to make a visible difference, but they also have to wait long enough to be reasonably sure they are picking a winner. So when does support turn into a stampede?

To find out, CK&R studied American political conventions from 1848 to 1948. In those days, before mass communication and transportation, conventions had important substantive functions. They gave governors, members of Congress and big-city bosses a unique chance to gather, size one another up, cut deals, hammer out issues — and to battle over choosing presidential nominees, sometimes over many ballots. CK&R found that as conventions progressed, changes in delegate counts held crucial signals about when candidates became inevitable: Once they passed a particular threshold of momentum, their bandwagons started to roll. CK&R looked at a metric they called the “gain-deficit ratio”: the change in a candidate’s support from one ballot to the next, divided by the support the candidate still required to clinch the nomination. As CK&R put it, “The ratio takes account of where a candidate is, how close victory is, and how fast the candidate is progressing toward it.” And they found that at every majority-rule convention over that 100-year period (the Democrats required a two-thirds vote until 1936), the candidate who surpassed a gain-deficit ratio of 0.36 went on to win the nomination. This held true even when the eventual winner started far back, and his ultimate victory wasn’t obvious.

FIRST TO BREAK GAIN-DEFICIT RATIO THRESHOLD BECAME NOMINEE YEAR LEADER ON FIRST BALLOT CANDIDATE BALLOT NO. CANDIDATE BALLOT NO. 1848* Taylor Taylor 3 Taylor 4 1852* Fillmore Scott 50 Scott 53 1860 Seward Lincoln 2 Lincoln** 3 1876 Blaine — — Hayes 7 1880 Grant — — Garfield 36 1884 Blaine Blaine 3 Blaine 4 1888 Sherman Harrison 4 Harrison 8 1916 Hughes Hughes 2 Hughes 3 1920 Wood Harding 9 Harding 10 1940 Dewey Willkie 3 Willkie 6 1948 Dewey Dewey 2 Dewey 3 Contested Republican conventions, 1848-1948 *Before the formation of the Republican Party; these are Whig Party conventions **After the third ballot, votes shifted overwhelmingly toward Lincoln, who was just 2.5 votes shy of clinching, securing him the nomination without an official fourth ballot Source: Collat, Kelley and Rogowski

For example, at the 1940 Republican convention, 501 delegates were needed for nomination. Thomas E. Dewey of New York led on the first ballot with 360 votes, while businessman Wendell Willkie was in third place with 105. On the third ballot, Willkie moved from 171 votes to 259, giving him a gain-deficit ratio of (259-171)/(501-259), or 0.364. He then took the lead on the fourth ballot, and was nominated on the sixth.

The gain-deficit ratio isn’t the only way to measure bandwagon effects, and 0.36 isn’t necessarily a magic number. But the fact that it persisted as a threshold from the time of the Whig Party through Dewey’s nominations in 1944 and 1948 suggested something powerful was at work. CK&R concluded that over time, different delegates made decisions based on similar kinds of evidence, and that trends, not just levels, of candidate support mattered to them.

Now, here’s where things get really interesting. After 1952 (when it took the Democrats three ballots to pick Adlai Stevenson), parties began nominating candidates exclusively on the first ballot. That meant delegates had to make their bandwagon calculations before conventions — before they all met in one place to slug out a nomination battle round by round, and to put their support up for bid. But the gain-deficit ratio kept working anyway. CK&R looked at contested nominations from 1952 to 1976, tracking preconvention changes in support by using surveys of delegates from The Associated Press and The New York Times. Again, once a candidate passed the critical threshold, he always went on to win the nomination. In 1960, John F. Kennedy’s gain-deficit ratio hit 0.672 two and a half weeks before the Democratic convention, into which he went unsure if he had a majority of delegates. In 1968, Richard M. Nixon’s gain-deficit ratio passed 0.36 for the first time in the AP’s 11th poll of GOP delegates, reaching 0.519 the day before the Republican convention.

Even when nominations seemed to hinge on technicalities, conventions ended up favoring the candidates with the most momentum. It’s true, for example, that in 1952 Dwight D. Eisenhower prevailed on the first ballot of the Republican convention only after waging an extensive, bitter floor fight to unseat delegations that supported his opponent, Sen. Robert Taft. And that in 1972, George McGovern had to fight to preserve the winner-take-all results of the California primary, an idea most of his own followers disliked, before he could lock up the Democratic nod. But it’s also true that before their conventions ever started, both Eisenhower and McGovern had reached the point where a candidate had never been denied nomination.

After 1972, both parties shifted toward allocating delegates by primaries and caucuses. Now it’s up to every voter to decide how much and how early it matters to be on a winning team. Yet the gain-deficit ratio has remained an accurate predictor. (That’s one finding of research by political scientist Barbara Norrander, who updated CK&R’s work to look at the endgame of presidential nominations in the post-reform era.) For instance, in 1996, Bob Dole passed the 0.36 mark on March 12, when he vaulted from 276 to 737 delegates, with 996 needed to nominate, by winning all seven Super Tuesday primaries. In 2008, Barack Obama and Hillary Clinton both exceeded the 0.36 threshold on Feb. 5, when they split the large trove of delegates chosen by 22 states. Obama’s gain-deficit ratio after those contests was 0.71, while Clinton’s was 0.67, foretelling a narrow but eventual Obama victory.

Even though voters now have the power to select nominees, they seem to be subject to the same bandwagon calculations that affected delegates at the old conventions. And perhaps those delegates, and their bosses, always paid at least some attention to public opinion, in addition to their own judgment. Probably both. So the decision-makers are different today from 60 or 160 years ago; primaries and caucuses essentially fill the role that convention ballots used to. But much of the psychology and many of the incentives involved in decision-making remain similar. And the analytics of momentum, expressed in measures such as the gain-deficit ratio, still make sense. Candidates still win nominations when they close enough of the gap toward their goal that the next round naturally goes their way. Sufficient momentum attracts breakaway support. And then overperformance wins over even more undecideds, and discourages rivals.

Which appears to be just what happened with Trump. On March 15, he won 228 delegates across six contests, including four large, geographically diverse states. That gave him a total of 691 delegates, and with 1,237 needed to nominate, his gain-deficit ratio was 228/(1237-691), or 0.418, beyond the 0.36 threshold. What happened next would have been more predictable if Trump weren’t so singularly divisive, or if Ted Cruz hadn’t won Wisconsin, or if the gap between Trump’s and Cruz’s organizational skills hadn’t raised doubts about Trump’s hold on his delegates. But once the campaign moved beyond the last set of states demographically unfavorable to Trump, his bandwagon started to roll.

On April 19, Trump won a majority of votes in a state for the first time, with 60 percent in New York. Every day thereafter, his average support among Republicans in national polls held steady or set a new high. After Trump dominated primaries across the Northeast on the 26th, Cruz’s support among delegates began to wobble. By May 3, Trump was able to win Indiana by 16 percentage points and knock Cruz out of the race, even after trying on the morning of the primary to link Cruz’s father, Rafael, with Lee Harvey Oswald. Cruz quit that night, followed by John Kasich the next morning.

The gain-deficit ratio has presaged another unlikely development: that the Democratic race would last longer than the Republican contest. Hillary Clinton came close to passing the 0.36 threshold this year on March 15, when she swept five big states, and again on April 26, when she won four of five in the Northeast. But she hasn’t quite left orbit, thanks to proportional delegate allocation on the Democratic side and Bernie Sanders’s persistence.

The idea of Donald Trump winning the Republican nomination seemed crazy to a lot of smart people for a long time. (Although it’s an interesting question whether Trump actually represents more of a break with his party than George McGovern did in 1972, or than Barry Goldwater did in 1964.) But plurality support matters, tending to turn into majority support. And Trump may have been following a winning path all spring.