Conditions for prosperity and depression of a stochastic R&D model under regime switching