This is more of a statistics/probability question but the implications for personal finance are obvious.
Let's say you have extra cash (assume tax-advantaged space is already maxed out) and are weighing investing versus paying down debt at some interest rate. I am interested in a formula that predicts the probability of investing outperforming paying down debt over a given length of time. Variables would be average annual investing return and standard deviation (e.g. 11.4% and 13.2%, respectively, via this article), debt interest rate, and number of years. Let's assume investing returns are normally distributed.
Of course the pure mathematical answer is you should always invest if your investment rate of return is higher than your interest rate. But if your rate of return is only slightly higher than your interest, and paying off debt has a standard deviation of 0% versus much higher for investments, the probability of investing coming out ahead might be just over 50% and one would deem it not worth the risk.