This paper studies the impact of collaboration on research output. First, we build a micro founded model for scientific knowledge production, where collaboration between researchers is represented by a bipartite network. The equilibrium of the game incorporates both the complementarity effect between collaborating researchers and the substitutability effect between concurrent projects of the same researcher. Next, we develop a Bayesian MCMC procedure to estimate the structural parameters, taking into account the endogenous matching of researchers and projects. Finally, we illustrate the empirical relevance of the model by analyzing the coauthorship network of economists registered in the RePEc Author Service.