A word of caution for investors: Don’t be a slave to history by Allan Sloan @FortuneMagazine January 15, 2014, 10:48 AM EDT E-mail Tweet Facebook Google Plus Linkedin Share icons What a difference a year makes. After a boom in the stock market in 2013, equities regained their normal state: outperforming bonds over the long haul. FORTUNE — Today let’s have some fun with numbers. The kind that investors rely on. Which turn out to be the kind that can be skewed by their start or end dates, and that can skewer your investment portfolio if you follow them blindly. Let’s start with a key number, the five-year return for stocks. For the five years that ended in 2012, the Standard & Poor’s 500 SPX produced a return, including reinvested dividends, of a crummy 1.66% annually. That’s not exactly the kind of record that would encourage you to buy stocks, is it? But 2013 turned out to be a great year for stocks . As a result, the S&P’s five-year annual return through the end of last year jumped almost 1,000% — no, that’s not a typo — to 17.94%. This math, courtesy of AJO, a Philadelphia money-management firm whose numbers I’m using throughout this column, shows how random even long-term performance figures can be. The five-year number increased dramatically from its 2012 level because it no longer included dreadful 2008 (when the S&P posted a 37% loss) and did include 2013, when the S&P returned a nifty 32.4%. MORE: When waiting for Social Security isn’t the most lucrative Now, let’s say that as last year opened, you knew that for the 20 years ending in 2012, long-term Treasury securities had outperformed stocks, returning 8.50% a year (including reinvested interest), vs. 8.22% for the S&P. Bonds outperforming stocks over such a long period is the investment equivalent of the sun rising in the west: a repudiation of the natural order. Stocks are riskier than Treasury securities, which can’t default absent total idiocy in our nation’s capital. Therefore, financial theory says that stocks are expected to carry what economists call an “equity premium” above what bonds produce. Oops. If you decided last year to learn from history and bought long Treasuries rather than stocks, you got clocked . You would have lost 12.7% of your money (as measured by Barclays index of long-term Treasuries) in one of the worst bond years ever, and missed out on the aforementioned 32.4% S&P gain. Because of bonds’ horrible 2013 and stocks’ good one, the 20-year record is now back in favor of stocks, 9.22% to 6.92%. Bonds had been in a huge bull market because the Federal Reserve was holding down interest rates in order to stimulate the economy. But last year long rates rose despite the Fed’s efforts to hold them down. (I’m not sure if the increase had to do with “bond vigilantes” overpowering the Fed; all I know is what happened.) When long-term rates rise, the market value of existing long-term bonds declines, hence bonds’ dreadful 2013. For example, the rise in the 30-year Treasury rate to 4% at year-end from 3% as the year opened knocked 17% off the market price of a 3%, 30-year bond. MORE: Lending measure hits new low at JPMorgan “We all want to look back and compare, but that won’t make you a penny,” says Ted Aronson, one of AJO’s founding partners. “You have to look forward.” Aronson points out that at the end of 1999, a period he calls “the mother of all speculative bubbles,” the S&P five-year return was 28.6%. Five years later, post-bubble, the five-year return was -2.3%. Buying stocks right after the five great years lost you money. Buying after five horrible years worked out very well. It’s tempting to say that stocks will keep running up because of momentum and the improving economy, and that bonds will keep tanking because the Fed has signaled plans to “taper” its efforts to hold rates down. But life is rarely that simple. With stocks having risen so sharply last year, they’re riskier than they were. With long Treasuries having fallen so sharply, they’re less risky than they were (though still quite risky). I’ve inflicted all these numbers on you to show how a single year in which stocks did great and bonds did terribly can skew long-term numbers. The same thing happened — in reverse — in 2008, when long Treasuries had a great year, returning 16.6%, while stocks lost 37%. That shifted the results in favor of bonds. So even historical performance figures aren’t set in stone. Trying to figure out what will happen this year? Me too. Have fun. This story is from the February 3, 2014 issue of Fortune.