This paper develops and estimates a strategic model of the joint effort decisions of students and teachers in a classroom setting to better understand the reasons for the low mathematics performance of students on curriculum-based examinations administered in Mexican high schools. The model allows for student heterogeneity in preferences for knowledge and in initial mathematics preparation, and for teacher heterogeneity in preferences for student knowledge and in instructional ability. Survey data of students and teachers, collected as part of a randomized controlled experiment (the ALI project), include multiple measures of student and teacher effort, student and teacher preferences, student initial knowledge and teacher ability, all of which are treated as latent variables with an underlying factor structure. A simulation-based maximum likelihood estimation procedure is used to recover the parameters of the knowledge production function and the parameters pertaining to the latent variables and measurement structure. Estimation results, based on a sample of 10th grade students, indicate that the most significant factor accounting for low mathematics performance is the lack of sufficient prior preparation and not the lack of student or teacher effort. Our results suggest a mismatch between the content of the curriculum and student prior preparation.