Research and development (R&D) is a key determinant of long run productivity and welfare. A central issue is whether a decentralized economy undertakes too little or too much R&D. We develop an endogenous growth model that incorporates parametrically four important distortions to R&D: the surplus appropriability problem, knowledge spillovers, creative destruction, and congestion externalities. We show that our model is consistent with the available evidence on R&D, growth, and markups. Calibrating the model to micro and macro data, we find that the decentralized economy typically underinvests in R&D relative to what is socially optimal. The only exceptions to this conclusion occur when both the congestion externality is extremely strong and the equilibrium real interest rate is very high. These results are robust to reasonable variations in model parameters.