The Effect of the Stock Market on Investment: A Comparative Study