Endogenous Animal Spirits and Investment: An Agent-based Model