Are hot IPOs like Shake Shack really worth it?

Investors watched with awe and envy as shares of Shake Shack recently went public at an offering price of $21 a share, then closed that day at $45.90, better than a double. If you had the good fortune to buy shares at the offering price, you were a happy investor, indeed. But chances are you weren't offered stock at the IPO price, unless you were a favored client, a hedge fund, or some other kind of preferred customer of the brokerage firms who participated in the offering. Which raises the question: does it make sense to buy a hot IPO in the aftermarket on its offering day?

We wondered, too.

Shake Shack workers prepare orders on August 18, 2014 in Madison Square Park in New York City. Shake Shack is allegedly considering going public and holding an initial price offering (IPO).
Getty Images
Shake Shack workers prepare orders on August 18, 2014 in Madison Square Park in New York City. Shake Shack is allegedly considering going public and holding an initial price offering (IPO).

There have been countless studies of IPOs and how their share prices fared in the aftermath, one, two, or three years later. But we thought it would be interesting to see if it paid, historically, to buy the stocks of hot IPOs on the day of offering. Would the enthusiasm and lofty price be sustained when the euphoria died down? Or would the enthusiasm of the initial offering fade away with time, along with the dollars you invested when it came out?

Read MoreFour reasons why Shake Shack is a 'sell'

To test this theory, we did a survey (admittedly unscientific) of recent "hot" IPOs, to see if it paid to buy them on the day of offering. We assumed the purchase price was the closing price on the day of the offering. We defined a hot IPO as one where the stock closed on the offering date at least 25 percent above the offering price. We also limited the survey to U.S. companies with at least $250 million in market capitalization. We wanted the analysis to include companies that had been on the market for at least a year, so we could determine how well the stock had done a year or more later.

We know what you're thinking: Suckers buy IPOs on the day of offering, drawn in by the euphoria of the moment. Best to wait and try to buy after the enthusiasm and hoopla quiet down. Really? Let's look at the results.

Read MoreCramer on SHAK: Good burgers, bad money?

Going back five years, we found only 26 IPOs that met both our criteria out of a universe of 268 that met the market capitalization limit. If anything, this finding confirms that it is rare for an IPO to rise 25 percent or more on its offering day. Our IPOs ranged from the very well know, such as Groupon, to many others where memories might be challenged recalling their names. Of the 26 IPOs we tracked having a one-year record, only 13 had a two-year performance record.

So how did they do?

Of the 26 qualifying IPOs, 17, or two-thirds, were higher a year later than the closing price on the day of offering. Of the 13 with a two-year record, 11 were higher than the close on their offering date two years or more prior. The two-year results are eye-popping, showing that the vast majority of these hot IPOs turned out to be good investments. The dispersion of results was also interesting, ranging, on a one-year basis, from a staggering loss of 80 percent (Groupon) after one year, to a gain of 134 percent if you were lucky enough to buy Phillips 66 Partners on offering day. For two years — same thing. Biggest loser: Groupon again — down 50 percent. Best gain: Norwegian Cruise Line — up 136 percent in two years. Happy sailing!

Read MoreAlready time to short the Shack?

As interesting as these results might be, they may not help you buy a winning IPO. But let's dispel the notion that buying hot IPOs at a premium on offering day is a bad idea. Recent history suggests that if you go with your instincts and a company you like, the odds of doing well are in your favor.

Commentary by Peter J.Tanous, chairman of Lynx Investment Advisory in Washington, DC. He is also the co-author with Jeff Cox of "Debt, Deficits, and the Demise of the American Economy." Follow him on Twitter @petelx60.