If you're an investor, I probably don't have to explain that the last five weeks have been a bit challenging for your portfolio. After hitting an all-time closing high of roughly 2,946 on May 3, the benchmark S&P 500 (^GSPC -0.22%) wound up tumbling close to 7% in May. Officially, it was the second-worst May for the S&P 500 since the 1960s.

Unfortunately, this volatility hasn't stopped just because a new month has begun. Earlier this week, the stock market sat just one bad trading day away from plunging into official stock market correction territory. For those of you wondering, an "official" correction is when the major indexes (or in this instance, the S&P 500) decline by a full 10% from their recent highs.

An investor circling the bottom of a steep correction in a chart with a red felt-tip marker.

Image source: Getty Images.

Corrections have a way of working themselves out over time

Yet the interesting thing about corrections, as I've noted previously, is that buying during the dip is pretty much always a good idea. Of the 37 previous corrections in the S&P 500 since 1950, each and every one has been completely erased and put in the rearview mirror by a bull market rally. Although the length of time that it can take to retrace these declines will vary from correction to correction, the primary thesis is that long-term investors are batting 1.000.

Amazingly, though, this isn't the most impressive -- or craziest -- stock market correction statistic I could come up with. That's because any investor could look at a long-term chart of the S&P 500 over 20, 30, or 50 years and see that the general trend is up. As the U.S. and global economies expand, investors who own a diverse basket of high-quality businesses tend to do just fine.

Rather, if you want the craziest stock market correction statistic, just look at what the S&P 500 has done over the past 20 years during periods of correction.

A half-emptied hourglass on a table next to a calendar.

Image source: Getty Images.

The wildest stock correction statistic you'll see

Each year, J.P. Morgan Asset Management releases a report that details the benefits of staying invested during volatile markets. Although the rolling 20-year period being examined is different as time goes by, one general number tends to be about the same every year. This being that approximately 60% of the stock market's worst trading days on a nominal point or percentage basis over the trailing 20-year period were accompanied by a corresponding best trading day from a nominal point or percentage basis within two weeks. Or, to put that jumble of words into an easy-to-understand idea, really bad trading days usually happen within a few weeks of really good trading days.

Why is this important? Well, if you have the presumed-to-be bright idea to sell out of stocks in the short term because you foresee the stock market heading lower, it gives you an above-average chance of missing out on some of the market's best single-session performances. Making matters worse, since short-term moves in the market are impossible to predict, your chance of missing out on a substantive rally in stocks, or these top-performance days, is heightened.

According to J.P. Morgan Asset Management's multitude of reports, your 20-year gains are usually more than halved if you miss just 10 of the best single-session performances over this more than 5,000-day (20-year) period. Should you miss around 30 of the best trading days, your return, which has been higher than 500% on an aggregate basis over the trailing 20-year period in some of J.P. Morgan's annual reports, is completely wiped out.

A smiling woman holding the financial section of the newspaper while looking off into the distance.

Image source: Getty Images.

Furthermore, a separate study from J.P. Morgan found that despite an average intra-year decline of 14.2% in the S&P 500 between 1980 and 2015, the index wound up higher three-quarters of the time, with only nine years ending in the negative (three of which involved a decline of less than 2%). 

The point is simple: Staying invested in volatile markets is not only a smart idea in that it takes emotions out of the equation, but it's generally just a wise practice given that your long-term returns will be considerably higher than if you were to try to time the market.