The economic outlook is bleak. Businesses aren't hiring and the economy has lost 400,000 jobs since May. Unemployment has remained at least at 9.5 percent for 14 months, A record length of high unemployment not encountered since the Great Depression. GDP is growing but the growth is slowing. Consumer confidence is falling; the dollar is falling; the real estate market remains in a slump. And the Obama administration has overseen the 2009 and 2010 deficits at unprecedented levels, accumulating over $2.7 trillion during just two years.

Still, investors sense a glimmer of hope, reflected in rising stock prices. Stock prices have much more to do with long-term expectations of profitability than short-run results. This new optimism likely reflects the rapidly changing political outlook. Stockholders have already been anticipating higher taxes and health care regulations under an Obama administration with basically free rein to adopt whatever economic policy that they want. Now, with Republican victories likely on Tuesday, particularly in the House, predictions are for a more favorable business environment and better economy.

While it is all very intuitively plausible, hard numbers also back up this discussion. The probability of a Republican majority in Congress is provided daily by Intrade -- which is basically a betting market that has proven to be remarkably accurate in predicting past election outcomes.

Another measure of political sentiments comes from the Rasmussen Daily Tracking Poll, which , reports on the percentage of Americans who disapprove of Mr. Obama's job as president. -- The ups and downs in the stock market do coincide quite well with these measures.

Take the stock market low in March 2009 and then the high back in March 2009, Mr. Obama had just been in office for two short months and was extremely popular, the prospect that Republicans gaining control of the House had been falling and reached its bottom the same month. This was also when the Dow Jones Industrial Average hit bottom on March 5, 2009.

Conversely, this year anti-Democratic sentiment was peaking and the stock market reached a peak of 11,205. Over the next few months things did not look quite as good for a Republican takeover of congress, and the stock market fell along with the probability of a Republican takeover.

Obviously other factors influence stock prices, too. I ran regressions that looked at changes in the Dow Jones Industrial Average closing prices from January 20, 2009 to October 15, 2010 that accounted for the unemployment and inflation rates, the change in GDP, and the University of Michigan's consumer confidence survey. The Wall Street Journal's Survey of forecasting economists were used for the yet to be reported values of unemployment and inflation rates and the change in GDP for October.

What I found was that each one-percentage point increase in the probability that Republicans would take control of the House increased the DJIA by 27 points (for results see here). Each one-percentage point increase in the percent of likely voters who strongly disapprove of the job President Obama is doing increased the DJIA by 30 points. The probability that the Republicans would reach 50 seats in the Senate or take control never rose above 30 percent and it didn't have much of a statistically significant impact of stock prices. Altogether, the probability that the Republicans can take control of the House and Mr. Obama's disapproval rate explains about half the increase in stock prices from the minimum reached on March 5, 2009 to prices from the second to the last Friday in October.

Here is a prediction: If Republicans do surprisingly well on November 2, stock prices will rise significantly. If Democrats do much better than people currently expect, stock prices will plunge.

John R. Lott, Jr. is a FoxNews.com contributor. He is an economist and author of "More Guns, Less Crime."(University of Chicago Press, 2010), the third edition of which was published in May.