In the year since Donald Trump was elected president, the economy and markets have been on a roll. Stocks have set one record after another, unemployment has dropped sharply and the U.S. enjoyed its strongest six months of economic growth since 2014.

Mr. Trump thinks he knows why: “The reason our stock market is so successful is because of me,” he declared earlier this week.

But...