President Reagan's optimism was out of style with much of the investment community and the economic fraternity throughout his term in office, but in retrospect his view seems justified by the results.

The Dow Jones industrial average produced a 16 percent average compound investment return during his two terms, and the bond market's 10 percent real rate of total return was the best for any presidency since Warren Harding's.As the president said in his farewell address, "We weren't just marking time; we made a difference."

A great many of the investment talent in Wall Street and the economic brains of academe and business didn't really believe him, though, and you can find it imprinted on their record year after year during the 1980s.

While he exuded hope they issued warnings.

It was a regular ritual: When the annual White House economic forecast was issued it was instantly discounted as overly optimistic. Sometimes it was, but maybe it was intentional - a challenge to work for, rather than an easy mark.

Throughout eight years the warnings came from Wall Street about inflation, recession, monetary collapse, niggardly corporate earnings, the weaknesses of the manufacturing sector, the budget deficits. Disaster seemed imminent.

Maybe President Reagan was lucky to escape the disasters, and there are grounds for believing that some of the financial disappointments of his administration might adversely affect the economy for years to come.

Still, there was a job to be done when he entered office and it couldn't wait. The recession of the early 1980s was by some measures the worst since the Great Depression of the 1930s. Moreover, confidence was shot.

The great American manufacturing machine was in its own private depression, outmatched both domestically and abroad by newer entrants in the world marketplace. Inflation roared. Interest rates were high. Faith was a feather.

It was so bad President Jimmy Carter had referred to the American people as suffering from a malaise. Optimism wasn't in the picture, but it was put there. Nothing does it like economic progress, or the belief that it will come.

Interest rates began a long decline, from a prime above 18 percent in 1981 to under 8 percent by the mid-1980s. Inflation came down from the double digits to under 4 percent. Economic activity surged. Disposable personal income shot from a gain of less than 1 percent in 1982 to 5.9 percent in 1984. Profits ascended from minus 27 percent in 1982 to plus 22 percent in 1983. More than 19 million jobs were created and filled, 3 million of them in 1988 alone.

Rusty from disuse, the American manufacturing sector was resurrected and became competitive again. Almost stagnant, and sometimes falling during the previous two decades, manufacturing labor productivity grew at an annual rate of nearly 3.5 percent from 1986 through the third quarter of 1988. More than 400,000 jobs were created in manufacturing in both 1987 and 1988, and much of the increased production was sent overseas, helping to lower the trade deficit.

You might never have guessed some of these achievements if you placed credence in the threats, warnings, caveats, criticisms, advisories and the like that accompanied daily, weekly and monthly analyses from research departments.

Maybe it was just a ritualistic rite to distract the demons. Somebody believed; otherwise, the economy couldn't have done what it did - stocks couldn't have risen, for instance - and Reagan couldn't have been re-elected.

The president believed, and it was contagious.