Being a health technology company has been extremely lucrative over the past 20 years. As we create more machines and drugs to help us live longer, the companies behind them (and their shareholders) have been big winners.

The two stocks facing off today -- Illumina (NASDAQ:ILMN), a maker of genetic analysis machines, and Roche (NASDAQOTH:RHHBY), an international drug and diagnostic giant -- are no exceptions. But while Roche pulled in over $55 billion in sales last year, its stock has consistently lagged the S&P 500 over the past 10 years. Illumina, while much smaller, has been a huge winner for shareholders, returning 650% over the same time frame.

Medical doctor's hand touching computer interface as medical network connection with modern virtual screen appears

Image source: Getty Images.

But which of these two stocks is a better buy at today's prices? Let's compare them in three categories:

1. Financial fortitude

Financial fortitude is based on a simple premise: What would happen if something unexpected and chaotic happened tomorrow? Would the company's balance sheet and cash flow position leave it vulnerable in such a scenario, likely to remain the same, or in a position to actually benefit?

Keeping in mind that Roche is valued at over four times the size of Illumina, here's how the two stack up.

Company Cash Debt Free Cash Flow (FCF)
Illumina $2.8 billion $0.7 billion $0.8 billion
Roche $11.6 billion $16 billion $15 billion

Data source: Yahoo! Finance, Roche IR. Cash includes short- and long-term investments. Free cash flow presented on a trailing 12-month basis.

Normally, when one company (Illumina) has a positive net cash position and solid free cash flow versus another (Roche) with a negative net cash position, I believe the former to have more financial fortitude. In this case, however, I'm willing to make an exception for a simple reason: Roche's annual free cash flow is enormous -- and almost outstrips its entire debt load altogether.

While I wish Roche didn't have a negative net cash position of over $4 billion, its strong free cash flow convinces me that these two companies are about the same: An economic crisis wouldn't kill either one. At the same time, neither has the net cash position to benefit from a downturn -- by buying back stock, acquiring rivals, or undercutting the competition on price.

Winner: It's a tie.

Valuation

Next we have valuation, which can be tricky to pin down. This is doubly true when one company (Illumina) is growing revenue by almost 14% per year while the other (Roche) is growing at 4% per year while offering a hefty dividend.

To help disentangle all the variables, here are five metrics I like to consult:

Company P/E P/FCF PEG Ratio Dividend FCF Payout Ratio
Illumina 60 64 2.8 N/A N/A
Roche 20 14 1.3 3.8% 95%

Data source: E*Trade, Yahoo! Finance, Morningstar. Non-GAAP EPS used when applicable for price-to-earnings (P/E). PEG = price/earnings to growth. 

Here I believe we have a clear winner. It's not surprising that Roche is cheaper based on earnings and free cash flow ratios -- that's normally the case when slow growers are pitted against growth companies. But Roche's PEG ratio, which factors growth into the equation, is also less than half that of Illumina.

Not only that, investors get a very appealing 3.8% dividend yield when investing with Roche. While some may be concerned that the dividend eats up almost all of Roche's free cash flow, there's a notable caveat here: European companies like Roche don't feel beholden to maintain a steady dividend year by year. Instead, they look at free cash flow anew each year to assess what's reasonable to pay out. As such, the dividend may go down, but it's very unlikely to go away.

Winner: Roche.

Sustainable competitive advantages

Finally, we have what I consider to be the most important aspect of investing: evaluating a company's moat, or sustainable competitive advantage. 

Roche has two main divisions to evaluation: pharmaceuticals and diagnostics. The pharmaceutical arm is by far the most important, as it provided 78% of sales in the first half of 2018. 

It is also solid enough that it was named "best international biotech stock" by our Motley Fool contributors earlier this year. For Roche, the division is buoyed by Rituxan (a treatment for cancer and autoimmune diseases) and Herceptin (for breast and gastric cancers). As with all drug companies, the key moat comes in the form of patents -- though those patents don't last forever. 

For Illumina, its bread and butter is selling gene sequencing machines. The company has been -- and continues to be -- at the forefront of the technology, and there's a growing market for it right now. 

While the competition tries to come out with sequencing machines that can splice our DNA at a lower cost, there are a few major factors working in Illumina's favor. First and foremost, Illumina's installed base of machines (currently over 11,500) translates into high switching costs: Once hospitals shell out for a next-generation sequencer, their investment commits them to continue using the machines and ordering consumables that they require.

There is always the threat that when the next product-upgrade cycle arises, Illumina won't have the best option available. Investors need to keep an eye on that, but it doesn't appear to be hampering the company at all right now.

As far as who has the wider moat, I'll give a slight edge to Illumina.

Winner: Illumina

And my winner is...

So there you have it, a tie. Each company came out ahead in one category. Illumina has a slightly wider moat; Roche comes out ahead on valuation; and both companies have solid -- though not spectacular -- balance sheets and cash flow statements. 

On the whole, both are high quality investments, but when such a close call arises, I give the edge to the company with the wider moat. In this case, that means Illumina.

Brian Stoffel has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Illumina. The Motley Fool has a disclosure policy.