Recessions come in all shapes and sizes, so it's a good idea to think about buying stocks to deal with different types of recessions.

If you are worried about a deep and lasting recession, auto parts retailer O'Reilly Automotive (NASDAQ:ORLY) is a good place to start looking. Meanwhile, beverage-can maker Ball Corporation (NYSE:BLL) will thrive in a mild recession accompanied by a fall in raw material prices such as aluminum. Life sciences and diagnostics company Danaher (NYSE:DHR) could also do well in a recessionary environment where governments decide to support the economy with spending on healthcare.

Let's take a look at the investment case for all three.

A declining red arrow over 100-dollar bills.

Image source: Getty Images.

O'Reilly Automotive

When a recession occurs and consumers start feeling the pinch, they tend to hold back on making high-ticket purchases of discretionary items like automobiles. Instead, they have a tendency to run existing cars longer, and since older cars tend to need more servicing it means more demand for auto parts -- great news for O'Reilly.

Here's a chart showing how light-vehicle sales fall during recessions. Moreover, note how the revenue of the largest listed auto parts retailers tends to increase during recessions.

ORLY Revenue (TTM) Chart

ORLY Revenue (TTM) data by YCharts

In a sense, O'Reilly is a kind of stock that can thrive in economic adversity and for that reason alone it's worth consideration for investors worried about a protracted recession. That said, the stock's valuation isn't particularly attractive and there are question marks around the sector's long-term margin outlook given's entry into the market


ORLY EV to EBITDA data by YCharts

Ball Corp

The case for buying Ball Corp rests on the idea that end demand for beverage cans and personal care product containers will hold its own in an economic slowdown. Ball's core end demand is definitely in the consumer staples camp, and there's also the secular trend toward the use of more environmentally friendly aluminum rather than plastics for packaging. In fact, the latter is largely behind CEO John Hayes' belief that the long-term growth rate of beverage-can unit volume will now be closer to 4% rather than the previously assumed 2%.

In addition, Ball has customers on multi-year supply contracts -- Coca-Cola, Anheuser-Busch InBev, Molson, and Unilever are significant customers -- so its competitive positioning is sound.

In the last recession, Ball demonstrated that it could grow earnings, as its revenue held up while costs dropped thanks to lower aluminum costs.

A lasting recession would obviously hurt Ball Corp -- there's always going to be some cyclical element to packaging demand -- but the company can do well in normal recessionary environment.

Danaher keeps growing

Last year was a great one for the life sciences and diagnostic-focused company Danaher, and 2020 looks like it's starting off in the same vein. The company's growth exceeded its own expectations in 2019 and it continues to churn out mid-single-digit revenue growth.

Danaher's core revenue growth.

Data source: Danaher.

CEO Tom Joyce recently spoke at the J.P.Morgan Healthcare Conference and told investors that the company's fourth-quarter core revenue growth would come in at 5.5% or above -- previous guidance was for just 4.5%. He also predicted that earnings per share (EPS) would come in at or above the high end of the guidance range of $4.74 to $4.77.

Moreover, the deal to buy GE's biopharma business looks like a great value. Especially as that business segment appears to be growing faster than Danaher expected at the time the deal was announced. The completion of the acquisition in 2020 will add a complementary and highly cash generative business to Danaher's portfolio.

The impressive growth in Danaher's core businesses comes in a year when other industrial companies have felt the chill winds of the trade conflict and declining end demand. It's a fact that speaks to the relatively defensive nature of Danaher's revenue. Indeed, governments may elect to support healthcare research and development in times of economic uncertainty.

Stocks to buy

All told, none of these stocks are particularly cheap right now, but they will add balance to a portfolio that might be overloaded with cyclical names. They can all be bought by investors who are looking for stocks that actually improve earnings growth in a slowdown, rather than just preserve it.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.