The stock market has rallied during Donald Trump’s presidency, with the S&P 500 up nearly 24% during Trump’s first year in office. But here’s a surprise: It did even better during President Obama’s first year, rising 35.3%.

Source: Yahoo Finance More

Presidents are quick to take credit when the stock market and the broader economy perform well under their watch. Trump has tweeted many times about the booming stock market of the past year, the strong job market and a number of other economic gains. Obama was a more circumspect tweeter, but he, too, touted economic gains during his administration, usually in speeches.

Here’s the thing, though: Presidential policies have a lot less to do with financial markets and the underlying economy than politicians and their supporters like to think. The same goes for downturns in the economy. An examination of the circumstances during the first years of both the Obama and Trump administrations bears that out.

Obama, of course, took office in the midst of a financial crash and near-depression. His stock-market numbers look good because stocks were most of the way through a crash when he took office, soon to rebound. The total decline in the S&P 500 from the peak in 2007 to the trough in 2009 was 56%. Stocks had already fallen 46% by the time Obama took office. So there was only a modest drop left on Inauguration day in January 2009. Stocks bottomed out less than two months later, and began a climb that continues to this day.

Did Obama do much to boost stock values and help the economy? Probably not much more (or less) than any president would have done under the circumstances. Congress passed a huge stimulus bill shortly after Obama’s inauguration, and even though it was unpopular among some Republicans, any other president probably would have signed something similar, since fiscal stimulus is essentially a standard government response to economic crisis.

The Federal Reserve probably did more to boost stocks than Obama or Congress, through its novel quantitative-easing monetary stimulus, which turned out to be powerful financial medicine. The nonpartisan Fed, in fact, probably has more influence over the economy than any other institution, public or private—and certainly more influence than the White House.

Trump clearly benefited from an economy that had been gaining steam for several years, with companies adding millions of jobs in the years before Trump took office, and more or less continuing the same pace of expansion once he entered the White House. Trump did, however, stir animal spirits with his promise to cut taxes—a promise fulfilled late last year, when he signed a $1.5 trillion tax-cut bill.

The Trump tax cuts help explain why stocks jumped almost immediately after Trump’s election in November 2016. Markets had been expecting a Hillary Clinton victory, which probably would have meant little change in federal policy—and either no tax cut, or a very modest one. Stocks would probably be up without the Trump tax cuts anyway—since corporate earnings have been strong without them–but by not as much.

Still, Trump partisans crowing about a Trump premium in the stock market ought to be careful. Presidencies don’t always end the way they begin, with broader market forces sometimes overwhelming policy prescriptions out of Washington.

Yahoo Finance is tracking the Trump economy compared with six prior presidents going back to Jimmy Carter, and there are some vivid lessons in the data. The economy under Carter, for instance, started on a tear, then flattened out, contributing to Carter’s reelection loss in 1980. Under Ronald Reagan, the job and stock markets started out weak, then took off. A recession greeted George W. Bush in 2001, followed by a boom, followed by another recession far worse than the first. Obama took office amid disaster but ended up with relatively strong numbers after 8 years.

Stocks are fast out of the gate under Trump—but the true measure of presidential success is longevity, not sprinting speed. Trump still has three years to go, and what happened in Year 1 may bear no resemblance at all to what happens in Year 4.

Confidential tip line: rickjnewman@yahoo.com. Encrypted communication available.

Read more:

Rick Newman is the author of four books, including Rebounders: How Winners Pivot from Setback to Success. Follow him on Twitter: @rickjnewman

Follow Yahoo Finance on Facebook, Twitter, Instagram, and LinkedIn