A lot of people think the U.S. is already in a recession. So, maybe it's time to learn how to invest during one.

The headlines are full of bad news, from the housing slump and the subprime mortgage crisis to lower productivity and record oil prices.

Stocks across the board have tumbled since last October, and you've probably been watching your own portfolio shrink. Major indices like the S&P 500, DJIA and Nasdaq Composite are well off their mid-2007 record levels. You may even be tempted to sell and get out while you still can.

Don't do it.

Selling now guarantees a loss, and you risk missing the eventual rebound -- which could be impressive.

Don't Panic

News reports about recession can be frightening. And it's true that recessions historically weaken the job market and wage growth.

But recessions also lay the groundwork for recoveries in both the economy and the stock market. Interest rates almost invariably fall, making it less expensive to borrow money.

Lower demand brings down inflation. Meanwhile, cost-cutting and debt reduction makes companies nimbler and more competitive, so they can position themselves for growth when the economy picks up steam.

And while economists look backward at months-old data to declare recessions, the stock market looks forward -- so stocks typically fall prior to and in the early stages of a recession, and then bounce quickly off their lows when investors start to see light at the end of the tunnel.

Market timing -- trying to jump in and out of the stock market at opportune moments -- is impossible. No one knows when investors will collectively decide that stocks look attractive again. Indeed, recessionary rebounds typically occur six months or so before the economy recovers, while the headlines are still gloomy.

Selling now and hoping to buy on the way up is a sure way to generate write-downs of your own.

Be Patient and Look for Deals

Take a long view and shop around for some bargains.

The historical record might provide some guidance about where to look for undervalued stocks. A study by Standard & Poor's analyzed performance in the late stages of recessions dating back to the mid-1900s. It found that, in general, stocks in certain sectors -- in particular, financials, consumer discretionary, information technology and industrials -- tend to do best during a recovery.

In most cases, the stocks hit hardest heading into a recession exhibit some of the strongest growth coming out of a recession.

Based on historical patterns, you might expect the financial and consumer discretionary sectors to offer appealing investment opportunities, because they performed poorly last year and both sectors typically do well coming out of a recession.

Bear in mind, however, that no two recessions are the same -- and, as the saying goes, past performance is not a guarantee of future results. For example, technology stocks led the market down prior to our last recession, which ended in late 2001. As many investors remember all too well, the tech sector got slaughtered during most of 2002.

So don't suddenly plow all of your money into financial stocks or consumer discretionary in anticipation of a rebound. Instead, look for bargains among some of your favorite stocks, and consider adding modestly to holdings that look like especially good deals.

Don't Miss Out

Consider contributing a little extra to your 401(k) or other long-term accounts. Money you invest now can buy more fund shares than it would have a few months ago -- setting you up for substantial gains when the market comes back.

And if you don't hold any investments -- mutual funds, stocks, a 401(k) or other long-term retirement account -- now might be a great time to dive in. Prices are down and bargains abound.

Even if the market hasn't finished dropping, this probably will prove to be a good time to invest.

Peter McDougall is a freelance writer who lives in Freeport, Maine, with his wife and their dog.