I think buying stocks during an election year is a great idea. Of course, my view is that any year that ends in a number between zero and nine is a good year to invest in stocks. Yes, I'm a fan of investing in stocks -- as long as the stocks belong to well-run companies and are held for the long run.

But I'll admit that when I see headlines stating that a certain sector tends to underperform during U.S. presidential election years, I'm intrigued. So when I read an article recently about how healthcare stocks and technology stocks usually lag behind the S&P 500 index (^GSPC 0.02%) during presidential election years, I wanted to find out if it was really true. Sure enough, if you think that history repeats itself, there's a case to be made that two sectors to avoid in 2020 are healthcare and tech.

Hands holding up a placard with "Elections 2020" printed on it

Image source: Getty Images.

Election year blues

Fisher Investments analyzed stock market data from 1926 through 2015. The firm found that the S&P 500 generated positive returns in 57% of the first year of a presidential term, in 65% of the second year, in 91% of the third year, and in 82% of the fourth year. Of course, the fourth year of all presidential terms is an election year.

That analysis didn't include the presidential election in 2016. However, the S&P 500 did deliver a positive return of nearly 10% that year. With dividends included, the index's total return was 12% in 2016. But not all of the sectors in the S&P 500 perform as well as the overall index in a given year.

There have been five presidential election years since 2000. The Health Care Select SPDR ETF (XLV -0.31%), an exchange-traded fund (ETF) that includes only healthcare stocks, underperformed the S&P 500 index in four of these years. So did the Technology Select SPDR ETF (XLK 0.46%), which includes only tech stocks, although the years in which the ETFs lagged behind the S&P 500 differed.

So far in the 2000s, you would have been better off buying an S&P 500 index fund than investing in the healthcare sector or the tech sector 80% of the time during a presidential election year. Investors who stay away from these two sectors in 2020 have history -- at least, relatively recent history -- on their side.

The problems with the premise

Should you change your investing approach this year based on patterns of the past? I don't think so. There are two big problems with the premise that the healthcare and tech sectors underperform the broader market during presidential election years.

The first problem is that five election years is way too small of a sample size from which to draw any hard conclusions. Unfortunately, the S&P sector ETFs didn't exist in any presidential election years before 2000. 

We could, though, use the Nasdaq Composite Index as a proxy for the technology sector. This index tends to be more tech-heavy than the S&P 500. And in three of the four presidential election years between 1984 and 1996, the Nasdaq composite index beat the S&P 500. 

The second problem is even more significant, in my view. There were many different dynamics at work in each of the election years that have been mentioned that go well beyond the impact of the presidential campaigns.

For example, in 2000 the dot-com bubble burst, causing most tech stocks to plunge. In 2008, many investors saw healthcare stocks as a safer haven than many other types of stocks, with the result that the sector outperformed the S&P 500.

Rhyming in 2020?

This year will also have its own distinctive factors that set it apart from presidential election years of the past. Some of the leading Democrat presidential candidates are in favor of major healthcare reforms. As the election cycle progresses, investors could sour on healthcare stocks if they think there's a good chance these reforms could be implemented in the near future.

In addition, some of those same presidential candidates (specifically, Vermont's Sen. Bernie Sanders and Massachusetts' Sen. Elizabeth Warren) have advocated breaking up big technology companies such as Google parent Alphabet, Amazon.com, and Facebook. It's possible that fears about regulatory actions could depress the entire technology sector this year.

Also, tech stocks had their best year of the decade in 2019. As a result, the tech sector's valuation is now significantly higher than the S&P 500 index's valuation. This could lead to reluctance on the part of many investors to buy shares of tech stocks that are priced at a premium.

Mark Twain is frequently credited with saying that "history doesn't repeat itself, but it often rhymes." I'm not sure that the famous author actually said those words, but the sentiment does seem to be true. I wouldn't be surprised if the healthcare and tech sectors lag behind the S&P 500 in 2020, in part because of the presidential campaign.

But this should only matter if you focus on the short term. Long-term investors won't be concerned if healthcare and tech stocks trail the overall market in a particular year. The more important factor is how they perform over a span of many years. With that in mind, my view is that investing in stocks in 2020, including healthcare and tech stocks, is a good move. If history repeats itself or merely rhymes, you'll be able to buy these stocks at a discount.