Do you really need to invest in bonds?

NY Fed president: 'Animal spirits have been unleashed'
NY Fed president: 'Animal spirits have been unleashed'

As I see it, bonds aren't a good investment. Interest rates are lower than they should be, and if rates rise and inflation picks up, bonds will take a beating. Then again, I think stocks are risky too, so I feel like I'm damned if I do invest in bonds and damned if I don't. What's an investor to do? --O.F.

Basically, you've described the situation investors face not just today but all the time and with all investments, whether they realize it or not. There is no such thing as an all-gain-no-pain investment; there's always an upside and a downside.

In the case of bonds, investors have lately been focusing much more on what can go wrong. After seven years or so of pundits crying wolf that interest rates are about to surge and send bond prices reeling, it seems that the time for rising rates has finally arrived.

Indeed, 10-year Treasury bond yields have already climbed about a percentage point from their lowest point in 2016. And with the economy seemingly picking up steam and Federal Reserve officials suggesting that they could raise the federal funds rate three or more times in the coming year, there's a good chance that bond rates will continue to rise.

But does that mean bonds are no longer a worthwhile investment and that investors should steer clear of them? The answer is no.

Related: How to build a simple-but-effective retirement portfolio

One reason is that while it appears rates will move upwards from here, we don't really know whether this will be the case -- or, even if it is, how high they'll climb. Remember, as far back as 2010 or so, investment pros were warning about the coming Armageddon in bonds. Yet, those alarms were premature to say the least. Since the end of 2010, the broad taxable bond market has returned an annualized 3% or so. Not exactly a rout.

I'm not saying we'll see a repeat of that performance over the next few years. I doubt we will. But given prognosticators' less-than-impressive records when predicting the path of markets -- remember how wrong they were about Brexit and the stock market in the wake of Trump's election victory -- you certainly don't want to avoid bonds simply because the consensus is that they're headed for hard times.

Another reason not to flee bonds is that while rising rates do hurt bond prices in the short-run, higher rates can actually boost bond funds' returns over the long term. The reason is that a bond fund is always investing the interest payments from the bonds it holds as well as reinvesting the proceeds of maturing bonds in new bonds. When interest rates are rising, that money is being invested in bonds with higher yields, which eventually boosts the fund's return.

Granted, it can take a while for this process to overcome the hit that bond prices take when rates rise. But this dynamic pays off if you are investing for the long term, say, for a goal like funding your retirement.

Related: Is now the time to invest my retirement savings in stocks?

But perhaps the most important reason to continue to hold bonds is that, rising rates or no, bonds still fulfill what for long-term investors is their most important function: They act as a bulwark against the volatility of the stock market.

In general, bonds tend to do well when stocks do poorly. In 2008, for example, when the Standard & Poor's 500 index dropped 37%, the Bloomberg Barclays U.S. Aggregate Bond Index gained 5.2%.

Of course, bonds can also go through periods where they suffer losses. When 10-year Treasury yields surged by more than one and a half percentage points in early 1994, for example, the broad bond market lost roughly 6% over the course of a little more than three months, and long-term Treasuries lost nearly twice that amount.

But as long as you hold a diversified portfolio of bonds that includes both government and investment-grade corporate issues with a broad range of maturities, the potential losses in bonds aren't likely to be anything close to the downdrafts of 50% or more that stock investors have had to endure in past bear markets.

So rather than avoiding bonds altogether, you should instead be thinking about how best to divvy up your portfolio between stocks and bonds. Ideally, you want to own enough stocks to get the superior long-term growth that stocks have historically provided, but at the same time you want to have enough bonds to provide some stability to your portfolio and to mitigate the downsize when stocks go into one of their periodic slumps.

There's no stocks-bonds mix that's ideal for everyone. But you can at least get a sense of what's appropriate for you by going to this risk tolerance-asset allocation tool. The tool will also show you how your recommended mix, as well as others more conservative and more aggressive, have performed on average in the past and in both good and bad markets.

Once you've settled on the percentage of bonds that makes sense, you can then consider measures to protect yourself somewhat from the effects of rising interest rates.

The best way to estimate how much of a hit a bond fund may take when rates rise is by looking at the fund's duration, which is a gauge of a bond fund's sensitivity to changes in interest rates.

For example, a total U.S bond market index fund that tracks the Bloomberg Barclays U.S. Aggregate Bond Index -- a good proxy for the taxable bond market overall -- currently has a duration of about six years. That means the fund's price would drop roughly 6% for each one-percentage-point rise in interest rates (although that loss would be offset by the fund's annual yield of a little less than 2.5%).

A short-term bond index fund, by contrast, would have a duration these days of between two-and-a-half and three years, thus resulting in a price drop of, say, 2.5% for each percentage-point rise in rates (although the short-term fund's yield of 1.5% or so would lessen the impact of the price drop).

So by limiting yourself to bond funds with short durations or by splitting your bond stake between funds with short durations (say, two to three years) and ones with intermediate durations (say, five to seven years), you can mitigate the damage somewhat should rates rise. You can find a fund's duration on both the Quote page and in the Portfolio tab of a fund's listing.

Related: Do I have enough savings for a secure retirement?

Finally, the more you know about bonds and how they work, the more you'll likely you'll be able to make an informed decision about how to invest in them. So I suggest you check out this 10-question bond quiz to see how much you know about bonds.

But what you don't want to do is give in to the fear and anxiety about rising rates and abandon bonds altogether. Because if you do, you may find that you've avoided the downside of bonds, but in so doing exposed yourself to an even bigger setback should stocks experience a major decline.