Americans don't envy Bill Gates or Michael Dell (or not very much). We know that their billions spring from tremendous personal effort and innovation.

But the "undeserving rich" drive us completely nuts. They're steering their BMWs to their sailboats at their summer homes--not because they created a worthwhile business venture, but only because they bought Microsoft at $3.

Deep in your heart, you think, "Grrrr, I could have done that, too." But you didn't, and that makes you sore.

The green--in our eyes and in other people's wallets--brings out the worst in us. I don't mean morally, I mean our worst instincts as investors.

In recent years, academics have studied investor behavior, with sobering results.

We think we make rational decisions. More often, we veer from hope to fear and back again, without putting our brains into gear at all. (That's hope, not greed; it's important to appreciate the difference.)

Bull markets intensify these feelings, especially among investors who don't have a lot of experience, says Thomas Gilovich, a professor of psychology at Cornell University and co-author, with Gary Belsky, of "Why Smart People Make Big Money Mistakes" (Simon & Schuster, $23).

Tyros (described as people who can't spell b-e-a-r) make up the majority of stock owners today. Most financial advisers are inexperienced, too. If you opened your heart, here's what you'd find:

* Loss aversion. We take great pains and unusual risks to avoid a loss (or avoid admitting a loss), maybe because it's a blow to the ego as well as the wallet. We cling to stocks that go down, expecting them to "come back up" to the price we paid--as if natural law ordains they should.

In a peculiar bit of mental accounting, we put "paper losses" in a separate box, as if they hadn't occurred at all.

If we don't sell our losers, what do we sell? Our winners, of course--and we sell them early, for fear of losing the capital gains we already have. As a result, we forgo what might have been even larger gains.

Loss aversion has one more perverse effect. In a bull market, where envy reigns, we take unusual investment risks, simply for fear of losing out. "If you don't take the chance, you'll feel that you've fallen behind," Gilovich says.

* Illusion of control. You think that if you're personally at the helm--or at the mouse--bad things can't happen. You'll always be able to intervene in time.

"Online trading caters to this particular bias," says Hersh Shefrin, a finance professor at Santa Clara University in California. Because we can access all the information used by the pros, we begin to think that we're pros, too. We don't realize how much our results depend on chance.

* Overconfidence. Make two right investment calls in a row and suddenly you're a guru. Did your stocks rise? It's because you know just how to play them. Did they fall? You had bad luck.

"We spend a lot of time framing the world in a way that makes us feel a little better about ourselves," says Terrance Odean, a finance professor at the University of California at Davis.

Odean has made four studies of investor behavior (two with Brad Barber, also a finance professor at UC-Davis). They're drawn from the records of a major discount brokerage house, so they show the kinds of decisions investors make for themselves, with little or no input from stockbrokers or financial planners.

Among the findings:

* Overconfidence leads to more frequent trading, but the stocks people buy don't do as well as the stocks they sell.

* On average, the more you trade, the less you make.

* Men trade more than women, and their accounts don't perform as well.

* Both sexes did poorly compared with what they could have earned if they'd kept the stocks they owned at the start of each year.

The investors who were studied generally made money, Odean says, which they probably attribute to the effort they put in. In fact, the hours they spent trading stocks diminished their returns.

Poor investment choices aren't woven into our DNA. "They're more characteristic of beginners," says economics professor Charles Plott, who replicates market behavior in his Laboratory for Experimental Economics and Political Science at the California Institute of Technology in Pasadena. "With experience, decisions become more thoughtful and performance improves."

So try to catch on, before your primary learning experience is spelled w-i-p-e-o-u-t.