School Composition Effects in Spain : Accounting for Intercept and Slope Effects *

Drawing on PISA 2012 data, in this paper we study the impact of school’s socio-economic composition on the science test scores for Spanish lower-secondary education students. We adopt a semi-parametric methodology that enables spillovers to affect all the parameters in the educational production function. We also deal with the issue of endogenous students’ sorting into schools with better socioeconomic composition. The positive effect of school’s socio-economic composition is stronger when computed using the semi-parametric approach, suggesting the relevance of slope effects of school composition. However, the spillovers are substantially reduced when the endogenous sorting of students is controlled for.


Introduction
It is well known that parental socioeconomic background, especially schooling attainments of the parents, represents the most important determinant of academic performance.Parental education not only operates directly by fostering children's schooling achievements, as there are several indirect channels through which parents' education may intervene in the schooling process of the next generations.One of these is the so-called school composition effect -i.e. the spillovers generated by school-average parental schooling or socioeconomic level-which appears to be one of the most important 'school' characteristics in determining academic performance (Sacerdote, 2011).In fact, schools' (or classrooms ') composition has been commonly considered as additional input of the education production function (Hanushek, 2008).This paper quantifies school composition effects on Spain's lower-secondary schools (Educación Secundaria Obligatoria, ESO) using the Programme for International Student Assessment (PISA) data from 2012 and, as such, is the first study that has examined this issue forthe Spanish case.
Investigating the relevance of school composition in Spain is especially important because, when the number of applications for being admitted at a given school exceeds the number of available places (as is common in large cities), the admission process in public and public-funded private schools (i.e.escuelas concertadas) is ruled by zoning laws and school district policies (see Alegre et al., 2008;Robert, 2010).Therefore, given that the school admission criteria assigns the greatest weight to the proximity of the student's home to the school, these educational policies are inextricably linked to the effects of the schools' socioeconomic mix.This means that the school admission process may result in the direct transfer of the existing socioeconomic and ethnic residential segregation into the schools (Hoxby, 2003;Gorard et al., 2003).Moreover, school composition effects might have gained additional relevance in Spain as a result of the significant increase in the number of immigrant students from less affluent social backgrounds in recent years.They tend to reside within ethnic enclaves (Bosch et al., 2011) and, as a consequence, their children are inevitably more likely to be concentrated in schools characterised by a low socioeconomic composition.At the same time, although legally prohibited, some public and public-funded private schools have been using informal student selection criteria (Salinas and Santín, 2012).Therefore, analysing the existence and the extent of school composition effects is crucial for addressing policies aimed at reducing educational inequalities and their perpetuation across generations 1 .The existing contributions from economic literature have recognised many channels via which the features of an individual's schoolmates (or classmates) -namely, the peer effectmight influence individual attainment.In the general framework proposed by Manski (1993;2000), the overall effect of the peer group on individual outcomes primarily involves elements of social interaction that include both endogenous and contextual (or exogenous) effects.The former are the direct effects that peer behaviour or outcomes (i.e.test scores of schooling performance) can have on individual outcomes; that is, students may well learn more because their school/classmates learn more.The latter is the impact that certain exogenous or predetermined characteristics of the peer group can have on a student's achievement -i.e.individual performance depends on the socioeconomic composition of his/her group.In addition, the extent of peer effects might be confounded by the presence of shared environmental/school elements or individual characteristics (e.g.cognitive and non-cognitive skills) that go unobserved by the researcher; the so-called correlated effects.These correlated effects act as omitted relevant variables, as they are not captured by the econometric specification of the educational production function, and might bias the coefficients of interest-in our case, the impact of peer effects on academic achievement.
Obtaining separate estimates of endogenous and contextual effects is fraught with empirical complications 2 and, moreover, is highly data-demanding.Thus, this study concerns 58 ANTONIO DI PAOLO AND ÁLVARO CHOI itself solely with contextual effects, which has been a fairly common approach in the empirical literature to date (Willms, 2010).More specifically, this paper uses a broad measure of the socioeconomic composition of schools, based on the average parental educational background (defined as the highest educational level completed by either one of the two parents) for each school.Its main contribution to the existing literature consists in the implementation of a semi-parametric methodology that allows school-contextual effects to influence all parameters in the educational production function (as such, adapting the original proposal made by Raymond and Roig, 2011).Standard analyses quantified the impact of school composition spillovers on academic achievement by a linear change in the intercept term (i.e. a level effect).Nevertheless, contextual peer effects may also affect academic performance through their impact on the coefficients of other variables included in the education production function (i.e. a slope effect).This paper is aimed at capturing these additional effects of socioeconomic composition and show that students of better endowed schools obtain a higher test score not only because of a change in the intercept of the education production function, but also because of the changes in the returns to other individual, family and school characteristics that affect academic achievements 3 .
Finally, this paper also seeks to deal with the most common problem encountered in the estimation of school composition effects, namely the non-random selection of students into different schools.This specific type of correlated effect might indeed bias the estimated effect of school-average parental education.In fact, the presence of a sorting mechanism that allocates those students that are better endowed with unobserved characteristics into schools with higher average parental education might generate a spurious spillover effect.Therefore, we propose an alternative sorting mechanism that can be assumed to be unrelated to an individual student's unobserved characteristics.Such reordering is based on the predicted linear score, obtained from an ordered probit model that estimates the probability of membership in each quintile of the schools' average parental education.This artificial sorting is then used to reduce this specific kind of selection bias in the estimates of school composition effects.Thus, this study was able to provide a measure of a school's composition effect that should arguably be less affected by correlated effects.
With these purposes in mind, the rest of the paper is organised as follows: Section 2 contains a brief review of selected papers examining peer effects, focusing on the various estimation strategies adopted to eliminate correlated effects.Section 3 describes the empirical methodology that was used in this study and Section 4 is dedicated to a description of the data.Section 5 contains the empirical results and Section 6 concludes.

Selected Contributions
Previous studies from the economic literature about peer effects on scholastic achievement present quite mixed findings and, to date, there is no unified evidence as to the existence or to the actual form that these effects might take 4 .This line of research has sought to capture these potential spillovers at several points in the educational process (from primary 59 School Composition Effects in Spain: Accounting for Intercept and Slope Effects to tertiary stages), and by considering different peer features (actual or lagged peers' test scores, ethnic and socioeconomic composition of the peer group, etc.).This points to the fact that the resulting externalities could be either positive or negative (or even zero), while dependent at all times on the nature of the peer variables, and as such the final net effects become an empirical question.Furthermore, governed primarily by data availability, the definition of these peer groups has been markedly heterogeneous, ranging from school, school-by-grade and classroom to other social peers such as roommates or friends.As a result, the findings tend to be highly case-specific and not always strictly comparable.In general, this lack of explicit comparability is attributable to: (i) the specific characteristics of the sample used; and (ii) the (subsequent) econometric technique adopted for identifying peer effects other than the correlated effects.
Interestingly, some studies are based on special samples in which students are assigned randomly into peer groups, thereby possibly eliminating the bias attributable to correlated effects.More specifically, such quasi-experimental studies exploit the randomised trials generated by the chance matching of students with first-year roommates in college accommodation (see, among others, Sacerdote, 2001;Foster, 2006;Brunello, De Paola and Scoppa, 2010), changes in student distribution criteria (Hoxby and Weingrath, 2006) or class assignment on the basis of surname during first-year university courses (De Paola and Scoppa, 2010).Albeit randomised trials based evidence appear to be the most convincing in terms of internal validity, these experiences are relatively scarce and some authors pointed out the lack of external validity of such estimates because of the peculiarity of the samples used (and the different realities they reflect).Therefore, alternative strategies to reduce the selection bias have been developed.For example, several other papers, such as Hanushek et al. (2003) or Lavy et al. (2011), adopt fixed effect frameworks in order to control for any potential bias in peer effect estimates.
The present study is most closely related to those undertaken by Fertig (2003), Schneeweis and Winter-Ebmer (2007) and Rangvid (2007), which also drew on PISA data.Fertig (2003) investigated the effect of reading achievement heterogeneity in US schools applying an Instrumental Variables (IV) estimation 5 , which indicates that attending a heterogeneous school in terms of student achievement undermines individual performance.Schneeweis and Winter-Ebmer (2007) explored the effect of socioeconomic composition at the school-by-grade level in Austria.They argue that, when accounting for school type, -given the marked track system in Austrian lower and upper-secondary schoolsschool-fixed effects reduce the selection bias in the estimation of peer effects.Their results highlight a significant asymmetry in the peer effects on reading 6 , which seems to have a more beneficial effect in the case of students of a low socioeconomic background.Moreover, their findings are buttressed by the results they also obtained using a quantile regression strategy.Rangvid (2007) analysed the effect of the socioeconomic composition of a school in terms of the three PISA subjects (reading, maths and science) drawing on Danish data, 60 ANTONIO DI PAOLO AND ÁLVARO CHOI which were complemented with administrative registers to overcome the potential problems caused by the limited sampling of students within each school 7 .The author cannot rely on the school-fixed effect estimation as was the case in Schneeweis and Winter-Ebmer (2007), because assuming that individuals (and their families) who are placed in a given school of a certain track share similar unobserved characteristics is unlikely to be valid in the Danish context, due to the comprehensive nature of the Danish secondary school education system 8 .Her identification strategy was instead based on controlling for a large set of individual, family and school variables, without explicitly considering the role of selection on unobservable features.The results in this study suggest a clear positive effect of attending a school with a higher socioeconomic composition in the middle of the test-score distribution, whereas no significant effect is found for the socioeconomic heterogeneity at the school level.Moreover, the quantile estimation reveals that school composition effects vary among the competences assessed and the ability level of students.It is worth mentioning that Ding and Lehrer (2007) and Carman and Zhang (2012) obtained opposite results, using Chinese panel data, highlighting that: (a) peer effects are heterogeneous; and (b) the exact shape of peer effects remains undetermined (as also Sacerdote, 2011 points out).
Finally, some recent studies have dealt with this issue for the Spanish case.On the one hand, Mora and Oreopoulos (2011) analysed peer effects for one of the Spanish regions, Catalonia, using information which allowed them to distinguish reciprocating from non-reciprocating friends inside a class.On the other hand, Crespo-Cebada et al. (2014) compared the efficiency of public and private government-dependent Spanish secondary education schools using PISA 2006 data.Their non-parametric strategy was preceded by a propensity score matching approach in order to tackle the selection bias.In this study, as in ours, the extent to which this bias is reduced depends on the variables introduced in the analysis for explaining school selection processes in Spain -by schools and by families.

Empirical Framework
The estimation strategy proposed in this paper represents a step forward in terms of the measurement of peer effects.Indeed, the main innovation with respect to previous studies consists, as briefly commented in the introduction, in the idea that the spillovers produced by an improvement in a school's socioeconomic composition may affect not only the intercept, but all the parameters of the educational production function.On the contrary, the existing evidence relies on linear-in-mean models, which only consider the level changes in the predicted test score generated by school composition.This original proposal has been taken (and adapted) from the paper by Raymond and Roig (2011), in which they estimate the externality produced by the average human capital of workers in the same firm 9 .In keeping with the externality produced by schools' socioeconomic composition, our empirical strategy took as its starting point the standard educational production function, in school depends on a set of individual and family characteristics (X i ) as well as on a set of school characteristics (Z s ), plus a composite error term (ε i,s ).Usually, exogenous/contextual peer effects are simply estimated by considering that the intercept term (α s ) is not fixed, but instead dependent on a certain average characteristic of the peer group 10 -in this case, the average parental education of students in each school s --(PE s ).This means that the intercept term in (1) could be rewritten as, which indicated that a unit increase in the average parental education in the school modified the mean test score by µ points, through a shift in the intercept term.We could also adopt a non-linear specification, where the impact of the school's composition in terms of parental schooling is allowed to vary for each successive quintile of school-average parental educa--tion (Q j (PE s ), j=1,...,5).In this case, the intercept term in (1) couldbe expressed as, where the contextual peer effects were now α j (j=1,..,5) and allowed to be different for each quin--tile of average parental education (Q j (PE s )).Even in this case, the impact of the peer group's characteristics was only produced by a level effect, which operated through a modification of the educational production function's intercept.In fact, once the expression (1b) was substituted into equation (1) we obtained,

ANTONIO DI PAOLO AND ÁLVARO CHOI
This corresponded to the standard equation used in the peer effects literature, except for the non-linear specification of the contextual peer effects.Equation (2) clearly specified that the standard approach constrained school composition spillovers so as to affect only the intercept term and no other parameter in the educational production function (even allowing for a non-linear effect).However, there is no theoretical reason to believe that the contextual peer effects consist only of a simple level effect.For example, an improvement in the socioeconomic composition of the peer group might modify the effect of students' family background and home environment on their test score (i.e. the β coefficients).Additionally, belonging to a 'good' peer group in terms of average parental human capital might either relax or reinforce the relationship between other school characteristics and an individual's achievements (i.e. the δ coefficients).
In order to capture any potential shape effect of school composition, we firstly considered a reference group, which consisted of all the students who belonged to the least-advantaged schools in terms of average parental educational background.In the present application, the least-advantaged schools weredefined as those schools that appeared in the first ---quintile of the average parental education 11 (i.e.(Q (PE s )=(Q j 1 (PE s )).Therefore, the educational production function was separately estimated for the reference category, including in-dividual (X i ) and school (Z s ) characteristics of the least-advantaged group, plus an error term (e ).Defining as W the matrix of individual and school controls (i.e.W = (1, X , Z i,s, i i i s )), the estimation of this model allowed us to obtain the estimates of the educational production function's parameters for this specific group of students, specifically where the subscript '1' indicated that the coefficient j ^' have been estimated only for indi--viduals belonging to the first quintile of school-average parental education (Q 1 ( PE s )).We then proceeded to forecast the test score (T is ) for all the individuals who did not belong to the reference group (i.e.j >1), using the estimated parameters from eq. ( 3), that is, 3) Finally, for each successive quintile j of the school-average parental education, we defined the measure of school composition spillovers (IEX j ) as the average difference between -the actual (T is ) and the forecasted test score ( T |Q i,s j (PE s ); ĵ1 ) within each quintile (each composed of n j observations): School Composition Effects in Spain: Accounting for Intercept and Slope Effects In words, this measure of contextual peer effects (IEX j ) was based on counter factual evidence, which is defined as the ceteris paribus within-quintile average differential between the observed and the predicted test score, where the latter is obtained by using the parameters estimated for students in the least-advantaged schools.More intuitively, this methodology represented a semi-parametric approach to capture the ceteris paribus changes in the test score, produced by moving a representative student from the first quintile to successive quintiles of the school-average parental education.Note that this measure of the effects of school composition captured in a semi-parametric way the change in each parameter making up the whole educational production function (i.e. it captured both level and slope effects), produced by incrementing average parental schooling from the first to the higher quintiles.Under the assumption of a correct specification of the educational production function 12 [eq.( 3)], this approach would provide more compelling and complete evidence about the effect of school's composition on individual test scores -obtained without constraining these potential spillovers of the peer group's socioeconomic background to operate only through a shift in the intercept term.

School Composition and Selection Bias
The semi-parametric methodology proposed in the last section is not, however, exempt from the most relevant empirical problem in the estimation of contextual peer effects, represented by the self-selection of students into schools and peer groups (i.e. a specific kind of correlated effect).In this paper we seek to reduce the bias produced by the sorting mech anism that allocates those students with a greater (lesser) endowment of unobserved abili ties into better (worse) peer groups, which may bias our measure of school composition ef fects.Indeed, was this to be the case, the forecasted test score for non-reference group students from eq. ( 3) would present a downward bias, pointing to an overestimation of the effects of school composition.In other words, even if we tried to account for selection on observable variables by conditioning for a large set of individual and school controls (sim ilar to Rangvid, 2007, see Section 4), we would not be particularly confident about the con ditional zero mean of the error term in the test-score equation estimated for the reference group (eq.3).
In line once more with Raymond and Roig (2011), rather than using a classification of reference and non-reference groups based on actual school-average parental education, we allocated students to reference and non-reference groups on the basis of the predicted linear score obtained from an ordered probit model.This ordered probit model estimated the prob ability of membership in each of the five quintiles of the average parental education at school level, as a function of variables that predicts average parental schooling and are (presum ably) conditionally unrelated to students' unobserved abilities (i.e. the error term of the ed ucation production function).Specifically, from the ordered probit estimates we computed the predicted linear score that represents a proxy of the (latent) parental schooling in each school, obtained from the following equation: --In equation 6, school-average parental education (PE s * ) depends of a set of variables i (R i ) and an error term (µ i ).Subsequently, the observations were sorted according to the quin tiles of the predicted linear score (γ ~'R i ).This proxy of the schoolmates' parental human cap ital would be correlated to the school-average parental education, but at the same time it might be considered as independent of students' unobserved abilities.Therefore, we took as the reference group those students in the first quintile of the predicted parental schooling and we estimated the test-score equation (eq.7) for this subsample: It was then possible to re-compute the index of school composition spillovers (IEX * j ) in the same fashion as above, but now without such a marked effect from the self-selection of students into peer groups, as students in eq. ( 8) were assigned to the j quintiles by the pre --~ dicted (school-average) parental schooling PE s * instead of the observed average parental i -schooling in each school (PE s , see eq. 5 above), * being n j the number of observations in each quintile of the predicted linear score γ' W i .
As mentioned before, sorting students according to the predicted school-average parental schooling instead of using the observed variable would clean (at least in part) the measure of school composition spillovers from correlated peer effects -i.e.students enrolled in better schools in terms of parental education would share higher unobserved abilitiesonly in the case the right-hand-side variables in eq. ( 6) actually produce some (conditionally) exogenous variation in predicted parental schooling.Finding such 'exclusion restrictions'(borrowing from IV terminology) is always a challenge in studies based on observational data.
In this work, apart from the same individual and school controls included in the original educational production function, the vector R i in eq. ( 6) contained a set of dummies for school availability (one and more than one school's available respectively -relative to no other school available), as well as dummies for municipality size.Additionally, we included the average years of schooling of the adult population by region and municipality size for 2008, which would approximate the schooling endowment of 'potential parents' of students in our sample.The information that we used to construct this last variable was taken from the nationally-representative Spanish '2008 Survey of Household Budget', carried out by the Spanish National Statistical Institute (INE).We took the data from 2008, given that this would represent the year of access to lower-secondary education for most of the students in our sample.We then matched the computed average of adult schooling by region and municipality size (only cities and big cities against smaller agglomerations) to the 2012 PISA data.
These variables are significant predictors of the likelihood of being in a school with a certain socioeconomic composition (as we show below).Moreover, we considered that the resulting linear index (g' R i ) constituted a proxy of school-average parental schooling that is unrelated to students' unobserved abilities-which represent the main confounding factor in the school composition effect captured by eq. ( 5).This is because, once controlling for parental education, socioeconomic status, other family characteristics and the large set of school controls in the test-score equation (see the next section for details), we can reasonably assume that the only channel through which school availability, municipality size and the local schooling endowment of the adult population in 2008 might affect a student's test score is via their effect on school selection (i.e. they are independent of unobserved student characteristics).If this is true, eq. ( 7) is correctly estimated and the measure of socioeconomic school composition obtained from ( 8) is now presumably 'cleaned' by the potential endogenous selection of students into schools.In order to 'informally' gauge the validity of this statement, we tried to perform a Two Stage Least Squares (2SLS) estimation 13 considering school-average parental education to be an endogenous variable, to be instrumented using the above-variables.Therefore, we tested for over identification (Hansen J-test) and the obtained evidence was in favour of our assumption, since we did not reject the null hypothesis of conditional orthogonality between the considered variables and the test-score residual.The estimated school composition effect from the linear IV was also in line with the average results from our methodological proposal, supporting again the validity of our results.

65
School Composition Effects in Spain: Accounting for Intercept and Slope Effects However, it also seems worth noting that the composite error term in eq. ( 1) may assume the general form ε = η + ν + ς i,s i s i,s , which means that apart from individual unobserved ability (η i ), unobserved school characteristics (ν s ) may also cause some bias in the results.However, we are not able to deal explicitly with this problem using the PISA database.We are therefore forced to assume that the correlated school effects are zero once conditioned by a school's characteristics and regional fixed effects, at least in the case of the reference group.It should be borne in mind that, should this assumption prove invalid, the results presented in what follows may still be affected by the presence of some unobserved correlated school effect.Of course, the extent to which this last statement is true depends on the predictive power of the individual and school introduced both in equations 5 and 7 and their capacity to minimise the impact of unobserved school characteristics that are likely to correlate with average parental schooling.Nevertheless, given the data available for Spain, the alternative approaches that could be applied to reduce this potential source of bias (such as the one suggested by Crespo et al., 2014) would still rely on non-trivial assumptions (e.g.selection-onobservables for propensity score matching).
We therefore acknowledge that, although the application of the methodology suggested by Raymond and Roig (2011) has the potential to reduce the existing bias due to endogenous students sorting -and, consequently, would allow us to provide more realistic estimations of the magnitude of school composition effects-we cannot fully exclude the possibility that some residual bias (or other simultaneous confounding factors) could still be affecting our results.If this was the case, the resulting estimates of socioeconomic school composition effects would represent an upper bound, since it could be argued that students endowed withhigher unobserved ability would be more likely to enrol in schools with better (unobserved or unobservable) characteristics.Ruling out this possibility will be the objective of future research, when more detailed and adequate data will be available for Spain.

Data description
As discussed above, the empirical analysis is based on Spanish data from the 2012 PISA, undertaken by the OECD (see OECD, 2012, for details).The PISA focuses on the acquisition of skills among a target population of students aged 15 to 16.The 2012 assessment was specifically concerned with the testing of mathematics skills and as such is the only skill considered in this study 14 .In the specific case of Spain, the students interviewed were drawn from a cohort of individuals enrolled in lower-secondary schools (Educación Secundaria Obligatoria, ESO) during the survey year.As outlined earlier, Spanish lower-secondary education is completely comprehensive and compulsory until the age of 16.Normally, 15-yearold pupils will be enrolled in the 4 th grade of lower-secondary education; however, the sample contains students from lower grades as well (3 rd , 2 nd and 1 st grade), representing those who have repeated one or more grades.The original Spanish sample comprised 25,313 students enrolled at 902 different schools 15 .In order to take into account the specific statistical properties of the PISA sample, all the statistics and estimations that we present in this study have been carried out (applying individual and replication weights) using the STATA rou-66 ANTONIO DI PAOLO AND ÁLVARO CHOI tine 'pv', specifically designed for PISA and similar surveys (see Lauzon, 2004;Macdonald, 2008 for additional details).
The empirical analysis has been conditioned to the information drawn from a large subset of relevant questions so as to limit the role of the unobservable variables (following Rangvid, 2007 and the OLS specification of Schneeweis and Winter-Ebmer, 2007, given the available variables).The whole set of control variables are reported in table 1, together with the exact definition of each variable, its mean and standard deviation.In summary, the conditioning variables were divided into individual controls (sex, grade attended, age, migration status and the language spoken at home), family controls (paternal and maternal education, family socioeconomic status, maternal working situation, number of books at home and educational resources), school controls (prevalence of immigrants, girls and part-time teachers, lack of qualified teachers, school autonomy, student/teacher ratio, school size, school ownership, streaming processes, and presence of computers for instruction) and regional fixed effects (capturing unobserved school and other contextual characteristics that are constant within each region).
As usual, we also generated indicator functions for observations with missing information for the explanatory variables, which were included in the regression model(s) in order to control for the non-randomness of the missing values.In the case of missing information, the explanatory variables were fixed as being equal to zero for discrete variables and equal to the sample average in the case of continuous variables.As a measure of the socioeconomic composition of the school we considered the school-average parental education, taking the highest educational level completed by one or other of the two parents 16 .Observations with missing information about the highest parental education were discarded from the sample (1.96% of the total sample).Since our school composition measure consisted of school-average values, we also discarded the observations of students that are enrolled in schools with fewer than eight students.In the end, the sample used in the empirical analysis was formed by 24,741 students at 881 different schools.

Level Effects of School Composition
The starting point for this empirical analysis consisted in the estimation of the educational production function as described by eq. ( 2), in which the school composition measure was allowed to be non-linear (dummies for school-average parental education quintiles), but constrained so as to produce only a level effect.As reported in table 2, the results indicate that moving from the first quintile to the second quintile of average parental schooling does not produce any significant improvement in the mathematics test score (3 points with an associated t-Statistic of 0.888).However, the ceteris paribus comparison between students in the first quintile and those in the third reveals that students in the latter group performed significantly better than the reference group, showing a positive score gap of about 9.1 points.This positive level effect of school composition is just slightly higher when moving to the fourth quintile (10 points).Finally, the test score for students in the most advantaged group in terms of school composition (fifth quintile) is, on average, 19.2 points higher than the score for students in the least-advantaged group.This means that an improvement in the school's socioeconomic composition had a substantial level effect on individual test scores, and that this appears to be non-linear in the quintiles of average parental human capital at school level.Ref.
3   The estimates for the remaining control variables were of independent interest, and it is worth briefly commenting on the main findings.The increase in student age is not associated with the test score, whereas females seem to obtain worse results than males in mathematics.The effect of the grade attended was as expected, given that students from lower grades than that of the 4th grade (the standard grade at ages 15 and 16) performed significantly worse.Even accounting for the language spoken at home and other family characteristics, first-generation immigrant students performed significantly worse than natives and second-generation immigrants (negative gap of 8.2 points).An improvement in a family's socioeconomic status had a positive effect on the mathematics test score, while only the father's education showed a significant and positive effect on a student's competence for mathematics.In addition, the number of books and a home's endowment of educational resources also had a significant positive effect on the test score.
An analysis of school control variables revealed the usual results for PISA data -i.e.school characteristic control variables are hardly significant when explaining students' test scores.Therefore, we shall only describe in brief the few variables that displayed statistically significant coefficients.We detected a negative effect of the percentage of girls attending a school on performance in maths.After accounting for family characteristics, school's socioeconomic composition and other school characteristics, we found that the differences in performance between public and private and public-funded private schoolsdisappeared.Finally, students enrolled at schools that disposed of budget autonomy seemed to achieve better results than their counterparts.The evidence obtained from the regional control variables indicated (not shown here) suggested that Castilla y León, La Rioja, Navarra, Aragón and Madrid performed significantly better than the rest of Spain's regions.

Accounting for Shape Effects and for Selection Bias
The results obtained from the estimation of eq. ( 2) suggested a significant and positive effect of the school's socioeconomic composition.However, as previously highlighted, this result may merely represent partial or incomplete evidence, given that we implicitly constrained the impact of the school-average parental education so as to affect only average attainments (i.e. the intercept of the educational production function).In order to capture any other potential slope effect produced by an improvement in the school endowment of parental human capital, we implemented the innovative methodology described above in Section 3 17 .Panel A of table 3 contains the estimated value of our measure of school composition spillovers (eq.5).We computed IEX j separately for each quintile of the school-average parental education and we also calculated the average value for all the quintiles (except that of the first quintile, which is the reference category).The results from the semi-parametric methodology confirmed that the effect of the parental education of the peer group was substantial and clearly non-linear.As in the previous case, moving from the least-advantaged group to the second and third quintiles of the school's socioeconomic composition had virtually no effect on individual test scores (about 1.6 points and 5.3 points, respectively, and not statistically different from zero).However, the movement to higher quintiles generated positive slope effects, which were hidden by the implicit constrains of eq. ( 2).Indeed, school composition effects could be quantified into 7.7 additional test score points for students in the fourth quintile of the average parental schooling, and up to 15.6 points for students in the highest quintile.Additionally, the mean value for all the non-reference groups was also statistically significant, approaching 7 test score points.However, these results may well be biased by the fact that students with a better endowment of unobserved abilities are more likely to enrol in better schools (in terms, that is, of their socioeconomic composition).In order to reduce this potential selection bias, we first estimated eq. ( 6) using an ordered probit model explaining the probability of being in each of the five quintiles of the actual school-average parental education.The estimates (table 4 18 ) indicate that, conditional on municipality size, the likelihood of being in better schools is higher for those who reside closer to other schools.Keeping fixed school availability and average years of schooling in the region, the size of the municipality appeared to be relevant.Finally, the increase of the average schooling endowment of adult population in the geographical area or residence (region and municipality size) in 2008 -which represented the starting year of lower-secondary school for most of the pupils in the sample-made being in a school with a more favourable socioeconomic composition more likely.In general, the variables included in the ordered probit model provided a satisfactory prediction of the probability of being in each of the quintiles of the school-average parental education.Subsequently, we used the predicted linear score (g'R i ) as a proxy for the school-average parental human capital that was considered to be independent of the students' unobserved characteristics.When students were sorted into reference and non-reference groups according to the predicted linear score, the evidence concerning school composition spillovers were markedly different.As reported in the lower panel (B) of table 3, the average effect for the upper quintiles is reduced, while it increases for the lower (relative to the results reported in the upper panel of the same table), which is the result of a significant endoge- nous sorting of more able students into schools characterised by a more favourable socioeconomic composition (the same information is depicted in figure 1).More specifically, also accounting for endogenous selection, students from the third quintile of the proxied average parental education performed better than pupils at the least-advantaged schools (i.e. the reference group).The results regarding students in the third and in the fourth quintiles of school-average parental education appeared to be unaffected by correlated school composition effects (i.e. were virtually the same when endogenous selection wastaken into account).However, when the selective sorting of pupils into schools was accounted for, the effect of school composition was strongly reduced for students enrolled in the better endowed schools.Indeed, the value of our index of school composition effect for students in the fifth quintile fell from 15.6 to about 9.0 test score points (relative to students enrolled in schools placed in the first quintile).This evidence suggests that, especially for students in the highest quintile of average parental schooling, there was a considerable sorting process in their favour with respect to less-advantaged students.Summing up, a significant contextual peer effect was still detected even when controlling for the endogenous sorting of more able students into schools characterised by better socioeconomic composition, but it decreased for students enrolled in schools placed in the highest quintile of the school-average of parental education.Indeed, among these groups of students, the process of student sorting would seem to be nearly as important as the externality produced by the socioeconomic origins of an individual's schoolmates.
The above mentioned results have policy implications, as they provide evidence about the existence of a 'triple jeopardy' hypothesis (Willms, 2010) linked to socioeconomic status: first, the direct negative impact of a low family socioeconomic level on academic performance.Second, the negative direct and indirect effect of being enrolled into schools with a lower mean socioeconomic level, and third, the fact that positive peer effects increase the higher the mean parental education of the school.Our results showed that some schools were effective at selecting students with a higher socioeconomic status, thus enabling them, ceteris paribus, to outperform other centres.However, student segregation by socioeconomic status seemed to be especially damaging for students with a low socioeconomic background, who do not only fare worse at school because their family characteristics and the mean characteristics of their peers, but because, at the same time, the impact of the latter is non-linear.These results highlight the existence of equity reasons for increasing the control of school selection -in public and private publicly-funded schools-and studying new ways of allocating students among schools.This would mitigate the polarising impact of peer effects.In this respect, the two largest Spanish cities, Madrid and Barcelona, introduced new student distribution criteria in year 2013, both systems having in common a modification of zoning laws.These changes could, on the one hand, reduce residence-based segregation -if sufficient information and economic means are provided to the families-but, on the other, increase school segregation based on other criteria than residence, especially if school inspection mechanisms remain slack.
Finally, our results also provided compelling evidence to support the introduction of mechanisms that correct the mean scores of school rankings which are published in some Spanish regions per school composition, as part of the achievement premium/disadvantage of schools being solely explained by school composition effects and student selection.

Conclusions
Drawing on PISA 2012 data, this paper investigated the effects of socioeconomic school composition on Spanish secondary schools.A novel methodology was implemented to measure the spillovers produced by one specific exogenous characteristic of a student's schoolmates.Namely, we treated the (school-average) highest level of education completed by the parents as a measure of the school's socioeconomic composition.The proposed methodology relaxes the implicit constraint -common to any peer effect study-whereby the contextual element can only affect the average outcome through an intercept shift (i.e. a level effect).
When accounting for all the changes in the educational production function parameters generated by an improvement in the school's socioeconomic composition (level and slope effects), we found that school composition effects are substantial.More specifically, the results indicated that the effect of moving from the least-advantaged schools (those in the first quintile of the school-average parental education) to better endowed schools improved the mathematics test score in a non-linear way, with the positive effect being particularly pro-nounced for pupils from top schools -i.e.those enrolled in schools where most of the parents had completed upper-secondary or tertiary education (fifth quintile of the school-average parental education).
However, this preliminary evidence should not be understood as being the pure contextual effect of a school's socioeconomic composition, given that it might be confounded by the presence of correlated effects.In this paper we explicitly attempted to deal with the endogenous selection process whereby students endowed with higher unobserved abilities are allocated to better schools (in terms of their socioeconomic composition).This was achieved by re-sorting students according to a predicted linear score obtained from an ordered probit model, which estimated the probability of membership of each quintile of school-average parental education.It is argued that, by proxying school-average parental schooling, students could be re-sorted in a way that is uncorrelated with unobserved individual characteristics.When school composition spillovers are re-computed on the basis of this artificial re-sorting, the evidence is significantly different.Indeed, the average effect school socioeconomic composition was reduced once self-selection into schools of better socioeconomic composition was accounted for.This reduction was mostly produced by the decrease in the effect found for students in the most advantaged schools (i.e.those in the highest quintile of school-average parental education), given that their strong test-score differential compared with students in the least-advantaged schools (i.e. the reference group of students in the first quintile) appeared to be driven by a combination of the endogenous students' sorting and the pure contextual effect of socioeconomic school composition.Nevertheless, our results also highlighted that a general positive effect of school composition on test scores was still present, even when students' self-selection based on unobserved abilities was controlled for.
Having said this, it is important to bear in mind the potential pitfalls of this study, which are linked primarily to the limitations of the database drawn upon.First, it is quite likely that the reported effects of school composition are a lower bound of the true impact, given that the limited sampling of students in PISA might cause some attenuation bias in our estimate (compare Micklewright et al., 2012).Second, in the case where selection is made on the basis of a school's unobserved characteristics (i.e., those that are not captured by the extensive list of school controls included here), the measure of school composition effects might still contain some bias.Third, if the variables used as predictors of school-average parental education are in some way correlated with unobserved student abilities, the methodology adhered to here for reducing the bias generated by endogenous sorting would not be effective at all.Whatever the case, and even taking these potential limitations into consideration, the evidence presented above makes important contributions to the ongoing public debate concerning school laws and the (re)allocation of certain types of student into (other) schools.First of all, the evidence of positive and significant school composition effects -which even persists when we control for the endogenous sorting of students into schools-highlights that the well-documented achievement gap between students from different socioeconomic background is implicitly exacerbated by this contextual effect of school's socioeconomic compo-76 ANTONIO DI PAOLO AND ÁLVARO CHOI sition.Moreover, the relevance of endogenous students' sorting points out that more able students from less-advantaged socioeconomic backgrounds are unable to obtain the beneficial effect of attending schools with a more favourable socioeconomic composition.This is especially true for the most advantaged schools, for which the effect of endogenous sorting appears to be extremely relevant.Finally, the overall results, together with the relevance of endogenous student sorting raise the question as to just how equitable and efficient the zoning laws regulating access to Spain's secondary schools are.In fact, the joint effect of the existing residential segregation according to socioeconomic status and its interaction with zoning laws are probably the main mechanisms behind endogenous pupils' sorting, which should be taken into account by policymakers.
Whatever the case, a more detailed examination of the relationship between school enrolment laws, school segregation and the effects of school composition is essential in order to provide more influential policy recommendations.These represent interesting questions for future research, particularly if more exhaustive data can be drawn upon.

78
ANTONIO DI PAOLO AND ÁLVARO CHOI notes 1.Another parallel discussion concerns the so-called optimal school-mix, which seeks to establish the optimal school system design for overall and individual school performance in terms socioeconomic segregation/integration schemes.Willms (2010) or Söderström and Uusitalo (2010), provide interesting insights into the issue.
Entering into this discussion is, however, out of the purposes of this paper, given that it would require a deep analysis of different counterfactual school-mix policies, which is unfeasible with the available data for the Spanish reality.

Specifically
, what is commonly referred to as reflection problems, which involve the simultaneous determination of achievement for all students within a peer group (i.e. a simultaneity bias problem).
3. Put in other words, as we explain below, simply including a measure of school composition in the test-score equation would solely introduce, if any, a change in the intercept of the education production function.However, changes in the socioeconomic composition at school level could also generate changes in the impact (i.e. the coefficients) of other inputs of the education production function -such as family and school characteristics, which are neglected in the typical linear-in-mean models of educational spillovers.
4. Sacerdote (2011) provides an updated review on the State of the Art.
5. Other papers in which the identification of peer effects relies on IV strategies include those by Feinstein and Symons (1999) and Robertson and Symons (2003), where the instruments consist of location variables and teacher assessment of a student's previous ability combined with region of birth dummies, respectively.
6.By contrast, they also suggest that the apparent peer effects in mathematics, as estimated by OLS, are due only to selection effects, given that their fixed-effect estimates are not statistically significant.Additionally, in this case, peer group heterogeneity seems to play a very limited role in explaining test score attainment.
7. As argued by Micklewright et al. (2012), the limited student sampling made by PISA can result in a measurement error in the estimation of peer effects.This would bias the effect of school composition towards zero.Unfortunately, such administrative data are not available for public use in the Spanish case; therefore, it should be borne in mind that the estimates reported in this study represent a lower boundary of the true impact of school-average parental education.
8. Notice that since the LOGSE reform of 1990, the Spanish secondary education system has been compulsory and comprehensive until the age of sixteen, which (as in the case of Denmark) makes the school-fixed effect framework unfeasible for controlling endogenous peer group selection.See Section 3 for details as to how such a problem is addressed in this paper.9.While Raymond and Roig (2011) estimate the externality produced by the average human capital of workers, a clearly endogenous variable (since completed education is a choice variable and high ability workers might sort into firms with higher endowment of human capital), we study the impact of mean parental education, which would be exogenous if students were randomly assigned across schools.In both cases, average schooling (of individuals or parents, respectively) represents a contextual or composition variable in the unit of analysis (firms or schools), which can be treated using the novel methodology proposed by the above mentioned authors.
10. Calero and Escardíbul (2007) or Mancebón et al. (2012) are examples of the application of this strategy to the Spanish case.
11.As noted by Raymond and Roig (2010), the definition of the reference group is always subject to some degree of arbitrariness; in their case, they define the reference group as those productive establishments in which the average workers' human capital is equal to or less than eight years of schooling.This definition follows the logic that eight years of education corresponds to the compulsory length of education under the institutional framework that was then valid for individuals in their sample; moreover, it should represent those firms that chiefly employ unskilled workers.In our case, we consider it better to define the reference group in an endogenous way -i.e.dividing the sample into quintiles and taking the first one as the reference group.This definition allows us: (i) to consider schools as being more heterogeneous units than firms; and (ii) to maintain a sufficient number of observations in the reference and non-reference groups.Notice also that we consider school 79 School Composition Effects in Spain: Accounting for Intercept and Slope Effects socioeconomic composition rather than classroom's composition because our analysis draws on PISA data, which does not allow identifying the classroom.However, since the results from this methodology might be sensitive to the choice of the reference group (we thank an anonymous referee for this suggestion), we also checked the robustness of results using the fifth quintile of school-average parental education as a reference.
The results appear to be qualitatively unaffected by the alternative choice of the reference group (details are available upon request).
12.This is because if the education production function for the least-advantaged group is miss-specified, the proposed index would be affected by spurious statistical relationships.Notice that the correct specification in terms of observable variables can be reasonably assumed because of the large set of student, family and school controls included in the empirical specification which mainly follows the existing literature based on PISA data.Moreover, similar results are obtained using a more parsimonious model, confirming the above-mentioned assumption.However, miss-specification due to unobservable variables related to non-random students' sorting remains an important issue, which is specifically treated in the next section.
13.The estimates are not reported here for space reasons, but are available upon request.Also the 2SLS model was estimated using students' weights.Moreover, the standard errors were clustered at the school level.
14. Despite this, the 2012 PISA survey also contains information about reading and science skills.Attention is limited here to the mathematics domain for reasons of space.The results for the other two skills are qualitatively similar, and are available upon request from the author.
15.The PISA survey has several statistical peculiarities that must be taken into account in the estimation phase.First of all, the skills assessment was carried out using five plausible values for each field, which are then normalised to obtain a global average of 500 and a standard deviation of 100.Moreover, the structure of the final sample must also be taken into account, given that it is the product of a complex two-stage stratification procedure used to ensure that the entire population is represented.Specifically, the first step consists in the stratified selection of schools with 15-to 16-year-olds enrolled in their classes, with sampling probabilities that are proportional to the number of eligible students enrolled; in the second step, a given number of students are randomly selected within each sampled school (up to 35).
16.The final student weight provided in the PISA database has been used in the computation of the school composition variable.This should reduce the imprecision in the school composition measure obtained from PISA data, where (as commented above) not all the students from every school are sampled.Notice also that the mean peer characteristic is usually computed without the contribution of the individual (because this might cause a reflection problem when the average value of the peer group is used as an explanatory variable).In this case, where school-average parental education is only used to define reference and non-reference groups, this complication is not necessary.In any case, the results are virtually unchanged when the average parental education is not computed using weight and/or does not include the individual's contribution (the results are available upon request).See Table 1A in the Annex for more details about the school composition variable.17.The estimates of the educational production functions for the reference group (eq.7) are reported in Table 2A (Annex).
18.The ordered probit specification was chosen with the aim of obtaining the estimates linear index (g'R i ) consistent with the fact that the dependent variable (quintiles of school-average parental education) is defined over the 1-5 interval.This comes at the cost of imposing functional form assumptions (i.e.normality of the latent index's error term).However, our results are insensitive to such assumptions, given that the results are robust also when ẽquation (6) (and the resulting linear index (g'R ) is estimated using OLS (the results are available upon request). i
language at Native-born or second generation migrant student speaking a national language at home (0-1) a national language at home (0-1) with school-clusters (881 schools).Results computed with the final student weight.* Average years of schooling of adult population by region and urban/rural areas in 2008.

Figure 1 .
Figure 1.School composition spillovers with and without self-selection correction Clasificación JEL: I20, I21, I29.83School Composition Effects in Spain: Accounting for Intercept and Slope Effects

67
School Composition Effects in Spain: Accounting for Intercept and Slope Effects

Table 2 (Continued) Eq. (2) ESTImATIon RESuLTS Plausible Dependent variable: Values for the Mathematics Test Score
Plausible Values Regression for PISA data; dummies for missing values included (not shown).Results computed with the final student weights.

Table 3 SCHooL CompoSITIon SpILLovERS (LEvEL+SHApE EFFECTS) panel A School Composition Spillovers -Baseline (eq. 5) School-Average parental Education IEX j t-Statistic
Note: the test score equations for the reference groups contain the same control variables as those included in table 2 and have been estimated with the STATA command "pv", which means the characteristics of the PISA sample can be taken into account, see Section 4. Results computed with the final student weight.