Formulating an education production function and using estimates of student and class discipline levels, this paper seeks to identify the relations between discipline, class size, teaching quality and scholastic outcomes. The data shows both individual and class-level discipline to be a powerful predictor of the PISA math score, while variance in discipline among classmates has a strongly negative effect. Furthermore, class discipline is correlated with larger classes. As a structural simulation demonstrates, the correlations observed in the data can be well explained by how schools allocate students and teachers to classes. This analysis allows for a break-down of the contribution of educational production factors and highlights the role of individual and class discipline to student achievements.