The economy has been the migraine headache of Barack Obama's presidency, a stubborn pain that has lingered for four years. But now that most economists agree the pain is going away, how much credit does Obama deserve?

PolitiFact surveyed economists to see how much the president's policies have helped or hindered the recovery.

As with seemingly everything in Washington, there are two sides. But we found the answers weren't always predictable.

Of course, presidents have limited powers, particularly with something as big and unwieldy as the U.S. economy. The president has little control over the giant forces such as consumer buying habits, technological advances, patterns of international trade and changes in demographics.

To cut taxes, boost government spending or change laws to encourage investment, a president must gain the support of Congress — no easy task in our polarized age. And he has little control over the government agency that probably wields the most economic power: the Federal Reserve.

In general, presidents tend to get too much credit when things are going well, and too much blame when things are going poorly.

Still, presidents do wield some economic power. So let's review the arguments about whether Obama deserves credit or blame for the economy's performance on his watch.

Why Obama deserves some credit

Gary Burtless, an economist with the Brookings Institution, rattled off several Obama initiatives that helped. Burtless cites things Obama did or supported before he was sworn in, including passage of the Troubled Asset Relief Program, or TARP, and the selection of an economic team that was focused on rescuing a financial system in dire straits.

"The emergency actions taken by the Fed, the Treasury, and the Congress in the fall of 2008 and winter and spring of 2009 (are) almost certainly the most important factors that kept a severe recession from metastasizing into a Great Depression," Burtless said. "President Obama deserves major credit for that."

Burtless also credits Obama's reappointment of Fed Chairman Ben Bernanke, the auto bailout and the economic stimulus, the $787 billion program of spending initiatives and tax cuts that Obama passed with the help of a Democratic Congress. "The president deserves full marks for pushing and getting those actions," he said.

Those who say Obama deserves some credit offer a pretty stark alternative.

"It's pretty hard to celebrate 7.9 percent unemployment or an economy that is 9 million jobs below its trend level — but it could have been worse," said Dean Baker, co-director of the liberal Center for Economic and Policy Research.

Bruce Bartlett, an economist who worked for the Ronald Reagan and George H.W. Bush administrations but who has recently clashed with conservatives, added that "it's too easy to criticize Obama based on some theoretical ideal shaped by hindsight. The critical question, it seems to me, is whether Republican policies would have worked better. I believe there is no question that they would have worked much worse. The dominant Republican view seems to be that the government should have done nothing. The party view seems to be that all stimulus, fiscal or monetary, is bad, or at least worthless."

Chris Edwards, an economist with the libertarian Cato Institute, agrees Obama was not responsible for the onset of the recession, but he believes the president's policies "are mainly responsible for the slowness of the recovery."

Edwards said Obama's policies have created a less-than-ideal environment for business investment, including new burdens and taxes from Obama's health care law, additional layers of financial regulation and large and growing deficits.

Dartmouth College economist Bruce Sacerdote acknowledged that Obama needed to use federal spending to stimulate the economy, but he worries about the long-term consequences of the growing debt.

"The administration has not proposed a long-term plan which will bring the deficit down to sustainable levels," he said. "I think that this is a terrible policy. I do not believe that this uncertainty has reduced short-run economic growth, but it is a major, major long-term problem."

Meanwhile, Barry Bosworth, a Brookings economist, noted that most of the important moves cited by his colleague Burtless came in the first half of the president's first term. "After the passage of the stimulus, Obama has done little about the economy and let the focus shift to other issues," Bosworth said, whether it was due to health care in 2010, the presidential election in 2012 or gun policy in recent months. "Now he has lost control of the discussion," Bosworth said.

Of course, a big reason for the stasis of Obama's agenda in 2011 and 2012 stems from the Republican takeover of the House in the 2010 midterm elections. Which brings us to …

Why it's hard to tell

If you're grading Obama's performance, it's important to note that he could only do so much with the House in Republican hands. His ideas were often non-starters with the Republican-controlled House — and likewise, the Republican ideas were stymied by Obama and the Democrats who controlled the Senate.

Instead, the White House had to battle House Republicans in two seemingly avoidable crises — the debt ceiling in 2011 and the fiscal cliff in 2012. In both cases, the White House ended up as the nominal winner, but the administration had to spend a lot of political capital to do it.

"Is avoiding a complete disaster created by Congress a win?" asks George Washington University economist Tara Sinclair.

There are other complications. It goes without saying that there's no way to re-run history and compare how Obama did to what other approaches might have brought. And it's not clear that Obama had any surefire policy solutions to work with.

For instance, Bosworth said, the Obama administration struggled with the problem of foreclosures and underwater mortgages because it had trouble crafting a policy that would help homeowners in dire straits without rewarding banks that had made bad loans. And the Fed was hobbled early on because interest rates were already close to zero by the time the economy went into freefall. That eliminated one of the Fed's tried-and-true tools — lowering interest rates.

That said, the Fed's actions — including pumping more money into the economy through a policy called quantitative easing — have almost certainly had an effect, and the president's lack of influence on the Fed weakens any linkage between Obama and economic results.

"The Federal Reserve has taken some rather drastic and unprecedented steps to avoid a double-dip recession and encourage consumer spending and lending," said Satya Thallam, an economist with George Mason University's law school. "If one buys into the argument that these Fed policies have had positive effects on the economy, which I do, or even if one blames them for forestalling a robust recovery, then that credit or blame for that effect should be separated from the president's policies."

All these complexities suggest that the presidential credit-and-blame game is anybody's guess.