Economic theory suggests that it is optimal to reward teachers depending on therelative performance of their students. We develop an econometric approach, based onstochastic frontier analysis, to construct a fair ranking that accounts for the socio-economicbackground of students and schools and the imprecision inherent in achievement data. UsingGerman PIRLS (IGLU) data, we exploit the hierarchical structure of the data to estimate theefficiency of each teacher. A parsimonious set of control variables suffices to get a "fair"estimate of unobserved teacher quality. A Hausman-Taylor type estimator is the preferredestimator because teacher efficiency and some exogenous variables may be correlated...