We study university projects and research collaboration projects with industry that are supported by government grants. First, we propose a theoretical model to analyze optimal decisions in these ventures. Second, we test our theoretical results with a unique dataset containing academic publications and collaborative research funds for all the academics at the major engineering departments in the UK.We find that universities focus on more basic ventures when they develop projects alone and that the collaboration with firms increases the quantity and quality of the research output only when the firms' characteristics make them valuable partners.