One year ahead of the presidential election, a pervasive disquiet has shaped voter attitudes, with a majority of Republicans pessimistic about moral values and the increasing diversity of the nation’s population and Democrats uneasy about an economy they see as tilted toward the rich.

By more than 2-1, voters say they are more worried than hopeful about changes in the country’s morals and values. By nearly the same ratio, more worry than express hope about the changing national economy. And by 5-1 they say they are worried by how the nation’s politics have changed.

Those concerns — detailed in a new USC Dornsife/Los Angeles Times poll, conducted online by SurveyMonkey — have been driving voter decisions about which candidates they favor for president. They have helped propel two nontraditional candidates, Donald Trump and Ben Carson, to the forefront of the Republican field.

Trump tops the field nationally, but barely, the poll found. He has support of 25 percent of Republican voters to Carson’s 21 percent. Two Republican senators in their first terms, Marco Rubio of Florida and Ted Cruz of Texas, now provide the strongest challenges to the leaders. Rubio, who has gained endorsements from several GOP elected officials in recent days, moved into third place, with the support of 12 percent of Republican voters across the country; Cruz got 10 percent.

Jeb Bush, the party’s one-time front-runner, fell to 4 percent, putting him in a tie with Carly Fiorina.

On the Democratic side, economic anxieties have helped fuel Vermont Sen. Bernie Sanders’ challenge to the party’s front-runner, Hillary Rodham Clinton. She received just under half the vote, 48 percent, nationally. Sanders got support from 3 in 10 Democratic voters, the poll found.

Martin O’Malley, the former governor of Maryland, continues to barely register, getting 2 percent nationwide.

Sanders has run an ideological campaign — emphasizing breaking up the nation’s biggest banks and restricting big-money donations to politicians. His support reflects that; he runs much closer to Clinton among Democratic voters who identify themselves as liberal than among voters as a whole. He also does well among voters younger than 30.

But the poll finds another base for his support: Sanders leads Clinton by a large margin among self-described independents who lean toward Democrats. Independents can vote in Democratic primaries in some states, although getting them to turn out in a primary is sometimes difficult. And Sanders runs much closer to Clinton among voters who feel anxious about their economic futures than among those who feel hopeful.

Those findings suggest that Sanders has tapped into a well of voters who feel disaffected from the political establishment and economically stressed, much as Trump has, although with a very different ideology.

This USC Dornsife poll, conducted in English and Spanish, questioned 3,035 voters nationwide from Oct. 29 to Nov. 3.

The respondents were drawn from the roughly 3 million Americans who take SurveyMonkey polls each day and weighted to match demographic factors measured by the census, including age, race, gender and education level.

The results have an error estimate of plus or minus 2.5 percentage points.

Voters’ downbeat mood is particularly notable in light of economic numbers typically associated with good times. The nation’s unemployment rate, 5 percent, is the lowest since April 2008, and the economy has grown steadily, albeit slowly, since the recession ended in June 2009.

Still, by 70 percent to 29 percent, voters see the country as headed in the wrong direction.

That sense of the country headed the wrong way has been true now for a dozen years, through two presidencies, for “the longest period of sustained pessimism in more than a generation,” said Neil Newhouse, a veteran Republican pollster who advised Mitt Romney’s campaign in 2012.

Pessimism is particularly profound among white voters, especially those without a college education. In that group, 74 percent say they are worried by the way the economy has changed.

By contrast, minority voters have a considerably more upbeat view, particularly those who have graduated from college.

Those two groups — whites who have not graduated from college and minorities who have — stand at opposite ends of the political spectrum. Whites without college degrees have become a bulwark for Republicans, while upwardly mobile minority voters have reshaped the Democratic Party.

Among the Republicans in the presidential race, several candidates have tapped into the pessimistic mood of whites who have not graduated from college, none more directly than Trump, whose slogan “Make America great again” expresses a sense of better times gone.

Trump has a significant lead among white voters nationwide who have not graduated from college. Rubio, by contrast, does notably better with the college-educated.

Trump’s strongest base of support, however, comes from those troubled by the effect of immigration on the U.S.

Nationally, voters divide closely over whether “immigrants from other countries mainly strengthen American society” or “mainly weaken” it, with 49 percent seeing immigrants as a source of strength and 43 percent as a weakness.

Trump’s backers are overwhelmingly in the “mainly weaken” camp, with 82 percent taking that view. Carson’s supporters, by comparison, overwhelmingly say they are worried about changes in the nation’s morals and values. They are also far more likely to be regular churchgoers than backers of Trump, who draws most of his support from people who seldom or never attend. A quarter of Carson supporters say they attend religious services more than once a week, far more than the rest of the GOP field.

On the Democratic side, fewer voters express concern about economic change than Republicans. Instead, Democrats’ unease centers more on the sense that the economy has tilted too much in favor of the rich.

Asked which is a bigger problem, “unfairness in the economic system that favors the wealthy” or “over-regulation of the free market that interferes with growth,” voters split sharply by party.

Among self-identified Democrats, more than 8 in 10 name unfairness as the bigger problem. Republicans say the opposite, with just under three-quarters naming over-regulation.

By roughly 60 percent to 40 percent, voters overall side with the Democrats on that issue. But that does not translate into belief in the government’s ability to solve the problems voters see in their lives.

Only 1 in 10 voters say that the federal government “increases opportunities for people like me.” Half of voters say the government “gets in the way. ”