A stunning statistic was published recently by financial analyst Robert Arnott. Bonds have been outperforming stocks. That might not be surprising to you -- it's pretty obvious that last year, when the market got clobbered, bonds would outperform stocks.

But I'm not talking about last year. Or even the last decade. I'm talking about 40 years of underperformance. From February 1969 to February 2009, an investor in 20-year Treasuries (consistently rolling to the nearest 20-year bond and reinvesting income) slightly outperformed an S&P 500 investor.

So, after what happened last year, you might be asking yourself why you're bothering with stocks at all. Why risk the stock market's volatility when bonds can offer the same returns?

How statistics lie
This bond outperformance example nicely illustrates Benjamin Disraeli's remark that "there are three kinds of lies: lies, damned lies, and statistics."

It's not that the statistic is false, but that it's completely deceiving. If you look at the 40-year time period, you'll see that interest rates on 20-year Treasuries started at 6.32% in 1969, spiked to 13.72% in 1982, then steadily dropped until in February they averaged 3.83%.

So, this means that bondholders got the best of both worlds. They were receiving high yields for most of the period, and were able to reinvest their interest at similarly high yields. Then at the end of the period, bond prices were high -- higher than at any other point in the period, since bond prices are high when yields are low. So, on top of the high income during most of the period, bondholders had their investment valued at extremely high levels at the end of the 40-year period. Thus, this was an excellent endpoint for Treasuries, allowing holders to reap big capital gains on top of their income.

Not nifty enough
Stocks, on the other hand, are suffering from bad endpoints. In 1969, talk was of the Nifty Fifty, the 50 large-cap growth stocks, like PepsiCo (NYSE:PEP), IBM (NYSE:IBM), Disney (NYSE:DIS), and McDonald's (NYSE:MCD), that many investors thought they could buy and hold, regardless of valuation. By 1972, the Nifty Fifty was trading at a gigantic multiple of 42 times earnings.

What's more, the endpoint of the 40 years is after the biggest stock market crash in 80 years. It's an absolutely atrocious endpoint for comparing the performance of stocks.

So, we're cherry-picking a fantastic period for bonds and a horrendous period for stocks, and discovering that stocks barely underperform. (And it's worth noting that stocks returned 700%, or 5.3% annually during that study period.)

Even with this unusual 40-year period, since 1871, stocks have outperformed bonds by 3.2 percentage points annually. So, just by the long-term numbers, stocks are still a better investment than bonds. It does show, however, that adding bonds to your portfolio can smooth your returns. Even if bonds don't match stocks' long-term returns, they can beat stocks for years or even decades.

A lesson from Buffett
But there's a more important lesson here than the benefits of asset allocation. It's that over the long term, the price you pay for stocks really matters, much more than the particular obsession of the day. In the 1960s and 1970s, the Nifty Fifty seemed unstoppable, but because investors paid too much, returns were mediocre.

But, investors who avoided the overvalued businesses and focused on the cheap ones could do very well. Warren Buffett paid attention to buying assets cheaply. As a result, from 1969 until the end of 2008 -- roughly the same 40-year period -- Berkshire Hathaway compounded its book value at a 20.7% rate.

Of course, Buffett wasn't invested exclusively in stocks. Berkshire owns bonds as well. But, here, too, valuation is critical. Buffett wasn't buying Level 3's (NASDAQ:LVLT) bonds during the Internet bubble in the late 1990s, but waited until they became cheap in 2001.

What to do now
So, while the historical performance of stocks versus bonds is interesting, valuations are what should dictate your investment strategy. Buy whatever's attractively valued.

Right now, that means you should avoid Treasuries and buy stocks. After all, Treasuries are still trading close to all-time highs. Yields really don't have much further to fall, and if inflation takes off, Treasuries could plummet. So, not only is the statistic deceptive, there's a good chance you'll get bitten if you interpret it to mean that you should be buying bonds today.

The stock market, on the other hand, has already crashed, and now looks cheap. Pfizer (NYSE:PFE), which used to trade at 50 times earnings, is now at a 12.5 multiple. Johnson & Johnson (NYSE:JNJ) was trading at a 30 multiple a decade ago. Now, it's at 12. Sure, the economy is in a real mess and some investors are jittery about President Obama's proposed solution to the health-care crisis. But these issues won't last forever, even if many stocks are priced that way.

The Foolish bottom line
So, while it's true that bonds did outperform over a 40-year span, if you look at the underlying causes, it actually supports the idea that today's undervalued stocks should outperform going forward. It's all a matter of buying at the right price. Our Inside Value team sees today as a great time to buy -- we've found many exceptionally cheap stocks. You can read about them with a free trial.

Fool contributor Richard Gibbons is totally nifty, though not yet 50. Pfizer and Berkshire Hathaway are Inside Value recommendations. Berkshire Hathaway is also a Stock Advisor selection, and the Fool owns shares of it. The Fool's disclosure policy secretly yearns to be a bond.