President Trump's supporters are grasping at straws when they say the stock market's recent strength points to his winning re-election.

To be sure, there's no denying that the stock market has been on a tear since the beginning of the year, with the Dow Jones Industrial Average turning in a first-half gain of 22.8%. That's better than 95% of comparable returns back to 1940.

But if you think that translates into a second term for President Trump, consider the presidential election in 1976, in which the incumbent Gerald Ford was up against Jimmy Carter. In the first half of the prior calendar year (the period comparable to this year's first half), the Dow Industrials gained 42.6% -- nearly double its first-half return this year. And, yet, Carter won.

You might dismiss that long-ago example as irrelevant today, since the 1976 election came in the wake of historically unique and momentous events such as Nixon's 1974 resignation and his subsequent pardon by Ford. But an analysis of past elections shows that 1976's experience was more the rule than the exception.

Consider first those elections since 1940 in which an incumbent president ran for re-election and won. In the first halves of the calendar years prior to those elections, the Dow gained an average of 11.1%. That contrasts with an average gain of 16.5% prior to those elections in which a first-term President lost his bid for a second term. (See accompanying chart.)

Don't conclude from this that, because of the strong stock market, Trump's reelection chances are now lower. The proper conclusion is that there is no detectable correlation one way or the other between a president's re-election chances and the stock market's performance in the first half of the prior calendar year.

By the way, I chose to extend my analysis only back to 1940, since I didn't want my conclusions to be skewed by the Great Depression. But I would have reached the same conclusion if I had extended it back to the Dow's creation in the late 1800s.

Surprised that there is no statistical significance to the alleged correlation between a president's re-election chances and the stock market's performance in the first half of the prior year?

You shouldn't be, for several reasons. First, there haven't been that many elections in which an incumbent president was running for reelection -- just eight since 1940, for example. Given this small sample size, it would be extremely unlikely at the 95% confidence level to find a pattern that is statistically significant.

Another hurdle making it difficult to jump over the 95% confidence hurdle is the large number of possible correlations that were undoubtedly analyzed in the process of "discovering" the one that works. This data mining process markedly reduces the significance of any results that otherwise would emerge.

Think about it this way: Let's imagine that you (and others) collectively analyze 100 hypotheses about the correlation between the stock market and a president's reelection chances, each focusing on a different slice of the stock market's prior performance. Even if none of those correlations is significant, you still would expect to find, at the 95% confidence level, that five of them appear to be meaningful -- false positives, if you will.

Overcoming data mining biases is beyond the scope of this column, but if you're interested, I refer you to Duke University finance professor Campbell Harvey's Presidential address to the American Finance Association in 2017.)

The broader investment lesson? Most of what you read and hear about stock market patterns is not statistically significant, and therefore noise. Be skeptical. Until and unless you're convinced that an alleged pattern is significant, you should ignore it.  

Introducing TheStreet Courses: Financial titans Jim Cramer and Robert Powell are bringing their market savvy and investing strategies to you. Learn how to create tax-efficient income, avoid top mistakes, reduce risk and more. With our courses, you will have the tools and knowledge needed to achieve your financial goals. Learn more about TheStreet Courses on investing and personal finance here.