After we arrived at baseline estimates of candidate support, we adjusted their support proportionally in each state until both candidates were tied nationally. Finally, we multiplied each candidate’s adjusted share of support by the number of pledged delegates available in each state to arrive at delegate targets (unlike Republicans, Democrats award all of their pledged delegates proportionally). Because there is limited data available to model the 99 pledged delegates from six delegations — American Samoa, Democrats Abroad , Guam, Northern Marianas, Puerto Rico and the Virgin Islands — we set both Clinton’s and Sanders’s targets in those contests at half of the delegates available.

We reached these estimates by developing benchmarks for each state based on its demographics. In particular, we used exit polls to determine the racial composition of the Democratic electorate in each state, how each state lines up on a liberal-conservative scale, and whether Democratic voters live in rural or conservative areas. Sanders does better in whiter, more liberal and more rural states. Clinton does better in states with more nonwhite voters — especially African-Americans. For more detail about these procedures, see this article .

These interactive charts show which candidate is on target to win the Democratic nomination and which one is falling behind. They are based on our estimate of how many delegates Hillary Clinton and Bernie Sanders would need in each primary and caucus to win a simple majority of the 4,051 pledged delegates at the Democratic National Convention.

These interactive charts show which candidate is on target to win the Republican nomination and which ones are falling behind. They are based on our estimate of how many delegates Donald Trump, Marco Rubio and Ted Cruz would need in each primary and caucus to win a simple majority of the 2,472 convention delegates at the Republican National Convention.

We reached these estimates by developing benchmarks for each state in the form of a baseline estimate of the candidates’ support. These are based on an examination of polling data, including state-by-state polling from Morning Consult, a nonpartisan polling and media firm that has surveyed more than 7,000 Republicans online since Jan. 1, along with other surveys from Jan. 1 through Feb. 25 from the FiveThirtyEight polling database.

These estimates are also informed by states’ demographic data and social media data. In contrast to our Democratic estimates, which are determined strictly by a formula, there is some degree of subjectivity in this process; we looked at a number of factors with the goal of finding consensus in the data. In particular, we used the Census Bureau’s 2014 American Community Survey to model geographic support for Trump and Rubio based on proportions of residents with at least a college degree in each state (the lower the better for Trump, the higher the better for Rubio — an observation bolstered by exit polls and real votes thus far). We also referenced the Pew Research Center’s Religious Landscape Study to model Cruz’s geographic support based on shares of evangelical Protestants in each state (the higher the better for Cruz). We examined the number of Facebook “likes” for each candidate in each state, as well as patterns in Google searches: Trump performs better in states where Google searches indicate a high degree of racial animus.

Next, we plugged each candidate’s baseline level of support into each state’s delegate allocation rules (for example, proportional vs. winner-take-all) to evaluate how votes would translate into delegates. Then, we gradually and proportionally adjusted each candidate’s level of support until the candidate reached 1,237 delegates nationally. Note that because there are three top GOP contenders each vying for a majority, the sum of the candidate targets in each state often exceeds the total number of delegates available in that state.

Little data exists to model candidate support in American Samoa, Guam, Northern Marianas, Puerto Rico and the Virgin Islands. However, in 2008 and 2012, these territories gave almost all their support to the “establishment” candidate, so we assumed each territory would give two-thirds of its support to Rubio. Furthermore, note that all of North Dakota’s delegates and most of Pennsylvania’s delegates will be unbound to a single Republican candidate. (Some delegates from other states and territories will be unbound as well.) We assumed these delegates would vote in proportion to candidates’ estimated support shares in their states.

CORRECTION (March 16, 1 p.m.): A previous version of this article mischaracterized the delegate rules for Colorado and Wyoming. Delegates from those states may choose, before being elected, to be bound to a candidate or to be unbound; the two states will not necessarily send most or all of their delegates to the convention unbound.