Endogenous Timing in the Switching of Technology with Marshallian Externalities.