Academic Performance and Territorial Patterns of Students With an Immigrant Background in the Lisbon Metropolitan Area

This paper focuses on the territorial distribution of students with an immigrant background enrolled in the 3rd cycle of basic education in Portugal and on the differences in the academic performance of students enrolled in the last year of this cycle based on their birthplace and immigrant background when compared to their native peers in the Lisbon Metropolitan Area. These differences are examined by estimating several linear regression models using as dependent variable three performance indicators – student’s results in the 9th grade national exams in the Maths and Portuguese Language subjects, as well as a binary indicator of a successful academic record during the 3rd cycle. The observed results confirm the hypothesis that there are significant differences in the students’ academic performance depending on their immigrant background and birthplace: (i) 2nd-generation and 1st-generation students perform worse than Native students; (ii) students from Brazil and PALOP countries have the most significant differences compared to students from Portugal. We also identify that a substantial part of these differences is already present in the end of the 2nd cycle of basic education. Furthermore, our results indicate that a considerable part of the differences is explained by factors inherent to the school and the class of the student, and not so much to the municipality, which might indicate the existence of some type of segregation experienced by these students, either at intra-municipality level (by the different schools) or intra-school level (by the different classes).


I. INTRODUCTION
Since the 1990s, migrations to Portugal have intensified: the immigrants that arrive in the country now come from many different origins, and the newcomers undertake a broader range of integration processes in the national territory (Esteves, Hortas & Fonseca, 2017;Fonseca, 2008;Malheiros & Esteves, 2013;Malheiros & Fonseca, 2011). Given the considerable number of children and adolescents included in these processes, education is considered one of the most important dimensions of integration because (i) children and adolescents have a universal right to education, and (ii) an educational response is necessary to improve performance in light of the challenges faced in a society where migrants are disadvantaged (Koehler & Schneider, 2019). According to Koehler & Schneider, 'Good quality education fosters social inclusion, economic growth and innovation.' (2019:1).
The admission of foreign students into the Portuguese education system is a reality that is now challenging schools, teachers and families alike in the search for new ways of promoting the integration of these students. National and international studies have confirmed that foreign students tend to have an unsuccessful academic record when compared to their native peers (Ferreira, Flores & Casas-Novas, 2017;Hortas, 2018;2013;Justino & Santos, 2017;Seabra, Carvalho & Ávila, 2019;Seabra et al., 2016). Multiple causes have been identified to justify this disadvantage -the students' language skills, their family's educational background, socioeconomic conditions, the territorial contexts where they live, and schools' responses. In 2016, PISA results ranked Portugal among the OECD countries that had most improved the school performance of immigrant students between 2006 and 2015. Therefore, it is important to understand to what extent national administrative data demonstrate this positive evolution towards the reduction of the disadvantages of immigrant students compared to their native peers.
Considering this challenging situation, the objectives of this study are to characterise the territorial distribution of students with an immigrant background in Portugal and quantify and explain the differences in the academic performance of students from different origins and immigrant backgrounds in the Lisbon Metropolitan Area (LMA). We have considered students enrolled in the 9 th grade 1 in public schools in the 2016/2017 school year for the analysis of performance differences. This paper is organised into six sections. After the introduction, we provide a brief review of the literature on the dynamics of migration and the challenges faced by students with an immigrant background in the host country. This section ends with the presentation of a brief overview of immigration in Portugal, contextualising the diversity of students with an immigrant background.
National and international studies on the school performance of immigrant students in Portugal are also taken into consideration. In the third section, the model of analysis and the variables used to assess the differences in performance between native students and students with an immigrant background in Portugal are presented, as well as their patterns of distribution across the territory and in the LMA, which are outlined in the fourth section. This is followed by an analysis of the differences in outcomes among native and non-native students based on linear regressions. Finally, the conclusion summarises the differences and explanatory factors of the school performance of students with different immigrant background and birthplaces.

II. MIGRATORY DYNAMICS AND STUDENTS WITH AN IMMIGRANT BACKGROUND
In a text published in 2008, Stephen Castles referred to the growth of human mobility across borders as one of the key dynamics of the ongoing global changes, viewing migration both as a result and an integral part of this process, a 'force' that challenges communities and societies. In this framework of global changes in which a 'new age of diversified mobilities' (King, 2020:8) is imperative, migrations within and into the European space have become more dynamic and complex, creating new socioeconomic and political frameworks and posing new challenges to integration (Trenz & Triandafyllidou, 2017). In a Europe of free movement, there are several groups of 'mobile citizens': (temporary) East-West migrations; the revival of old South-North movements; retired people migrating from the North to the South; young Europeans taking advantage of educational opportunities; and many migrant workers of various origins, with low-skilled or highskilled occupations, who are moving through the European labour market (Trenz & Triandafyllidou, 2017). In this complex network of increasing and diversified mobilities, the authors define the old continent as a 'natural laboratory' (p. 546) for the complexity of integration patterns of European and non-European citizens.
Although the relative weight of the foreign population in the Portuguese territory is small (4.7% of the total resident population in 2018 2 ), when compared to other European countries (Portugal ranked twenty-first in relative importance among 28 European countries in 2018 3 ), the Portuguese society today, particularly in large urban centres, has a 'complex diversity' (Kraus, 2012).
This 'complex diversity' is characterised, among other aspects, by a diversity of expectations that goes hand in hand with the decision to migrate. Migrants carry, for themselves and for their offspring, ambitions that intersect the economic and social sphere, where access to work, housing, health and education are the main arenas and challenges on which integration processes are based.
While for the first generation of migrants, access to work is the priority, the ambitions they have for the social mobility trajectories of their offspring challenge other sectors of society, often ranking education at the top (Hortas, 2018;2013).
In a complex framework of integration processes, the country has defined measures that seek to go beyond the traditional policies to obtain national citizenship and civic integration in a topdown model with an approach to the social process that essentially implies the existence of interactions. However, without undervaluing the efforts made so far and recognised in international evaluations 4 , the constant challenges of rethinking integration persist. New conceptualisations are required that extend beyond legal issues and related services in the host country, seeking to understand the dimensions of the social life of individuals with different backgrounds, the interaction and relationship networks they maintain in the host and home territories, and the transnational spaces they inhabit (Darieva, Schiller & Gruner-Domic, 2014). From this perspective, integration is more than a political project; it should be understood as an individual (family) project (McGarrigle & Ascension, 2017). In this project, education is a key variable that influences the present and future life scenarios of the offspring of immigrants (Crul & Mollenkopf, 2012;Portes, 2006;Portes & Rumbaut, 2001;Suárez-Orozco, Suarez-Orozco & Todorova, 2010).
Since the 1980s, a large body of international literature on the academic achievements of immigrant students has been growing. Confirming the importance of education in the life trajectories of immigrant students and also of the descendants of immigrants over the past twenty years, the scope of research has been extended to second generations: children of immigrants born in immigration territories. Regarding these students, the fact that they are admitted to the education system together with native students is under discussion, but the differences in academic results and trajectories are clear, raising questions about the ability of education systems to meet the challenges posed by newcomers, as well as by their descendants born in the national territory (Koehler & Schneider, 2019). According to the authors, some findings of these studies draw attention to: (i) the importance of immigrant children integrating the education system from an early age, preferably since kindergarten, coming into contact with the language and interacting with their peers; (ii) the negative effects of school segregation, in particular on social interactions and adult life; (iii) the importance of a more flexible/permeable education system that can accommodate the diversity of rhythms and paths and mitigate risks and early school leaving; (iv) the advantages of multiple opportunities for those who 'blossom' later on, thus allowing them to return to school and to resume and have a less fragmented academic record; (v) the opportunities arising from longer educational trajectories, in terms of the labour market and income, but also in social terms, attitudes towards diversity and resilience; (vi) the potential to follow vocational paths, which allow them their first access to the labour market, permanent training in connection with practice, without neglecting the possibilities of access to higher education; (vii) the potential of communication and involvement of families in school, influencing academic results; (viii) the negative effects of 'perceived' discrimination both for oneself and for others.

Immigrant students and academic performance
Studies on the academic performance of students from immigrant backgrounds, where this article is included, have confirmed that there is a negative association between the variablesimmigrant background and academic performance (Seabra & Cândido, 2020;Seabra, Carvalho & Ávila, 2019;Seabra, Roldão, Mateus & Albuquerque,2016;Seabra, Vieira, Castro & Baptista, 2016;Seabra, 2010;Hortas, 2013). This group of students tends to have a higher proportion of members enrolled in a cycle of studies for which they have already exceeded the expected age limit.
It is also among them that the failure rate or the dropout rate are more than twice as high as among their native peers (Hortas, 2013).
In 2016, PISA results reported that students from immigrant backgrounds were 70% more likely to have repeated a year than their non-immigrant peers of similar socioeconomic background (PISA, 2016: 259), further stressing that 'being male and from a 1st-generation immigrant background is a combination that negatively interferes with literacy performance in any of the PISA domains considered.' (Carvalho, Ávila, Nico & Pacheco, 2011: 81). However, the same authors state that, in relation to the European Union countries as a whole, this trend is less pronounced in Portugal. The results of PISA 2016 rank Portugal among the OECD countries that have most improved the academic performance of immigrant students in the last decade (2006)(2007)(2008)(2009)(2010)(2011)(2012)(2013)(2014)(2015). The authors explain this convergence based on the improvements in performance in science, mathematics and reading, the three areas assessed by PISA.
An analysis of national administrative data conducted by some recent studies on the admission of foreign students in the education system and on academic performance indicates the persistence of the behaviour already identified in the previous decade (Hortas, 2013), with continued lower levels of academic success compared to Portuguese students (Oliveira & Gomes, 2019, 2018 This trend is further confirmed by the analysis of the results obtained in the national exams, considering students of foreign nationality. In the study conducted by Justino and Santos (2017), the analysis of the results of the national exams (2013/14), based on the construction of a multiple linear regression model, considering two indicators of the presence of students with an immigrant background (% of students with foreign nationality and % of students with dual nationality), it was found that there are 'considerable effects in all cycles of basic education' associated with the immigrant background. 'Both indicators denote negative effects on exam classifications in the three cycles of basic education, but no longer in those of secondary education.' (Justino & Santos, 2017: 80). In addition, the 'percentage of students with foreign nationality is more penalising for results in the 1 st and 2 nd cycles than that of students with dual nationality, while the effects of both indicators on results in the 3 rd cycle are virtually identical' (Justino & Santos, 2017: 80). Among the explanatory effects for the behaviours identified in students of foreign nationality, particularly in the two initial cycles, the authors suggest language barriers, 'the most differentiating element and the most difficult to overcome in the early stages of schooling ' (2017:81).
Although PISA studies point to a significant reduction of the gap in academic achievement between immigrant and non-immigrant students, studies based on the analysis of national administrative data indicate the persistence of these disparities. According to Ferreira, Flores and Casas-Novas (2017), these differences depend fundamentally on household characteristics: education, employment status, material goods and some cultural indicators. The latter is visible in the cultural capital (Bourdieu, 2010) that children and young people bring to school and in the skills to communicate in the language of the host country, which is reflected on academic performance through the effects of ethnicity, as mentioned by Portes andMacLeod (1996, 1999). In addition to these family and individual aspects, there are the characteristics of schools (Portes, 2006;Kasinitz, Mollenkopf, Waters & Holdaway, 2008;Carvalho, Ávila, Nico & Pacheco, 2011;Crul & Mollenkopf, 2012;Crul & Schneider, 2012;Hortas, 2013Hortas, , 2018Koehler & Schneider, 2019) and the ability to open up to diversity, enhancing interethnic relationships and coexistence (Wessendorf, 2011). The influence of the school and the life frameworks in the territories where it is located on the students' academic record and on the behaviours they display is a variable to be considered (Hortas, 2013;2018;Carvalho, 2010).

Immigration and immigrant students in Portugal
From the mid-1970s, Portugal has become a host country for thousands of citizens coming from Portuguese-speaking African countries, and, later on, already in the late 1990s, the country became an important destination for labour migrants that arrive integrated into formal and informal networks. The traditional immigrants from the former colonies were followed by Brazilian and Eastern European citizens, namely Ukrainians, Moldavians and Romanians (Esteves, Hortas & Fonseca, 2017;Fonseca, 2008;Fonseca, 2001;Malheiros & Esteves, 2013), and some groups from South Asia, China, India, Pakistan and Bangladesh (McGarrigle & Ascensão, 2017).
The shift in the position of Portugal in the context of international migration resulted from a number of factors, especially the effects of a favourable economic context, after joining the EEC in 1986. The increase in foreign direct investment and the injection of structural and cohesion funds allowed the Portuguese GDP to grow above the European average until 1999, with the exception of the years 1992 and 1993 (Esteves, Hortas & Fonseca, 2017). The increase in the qualifications of Portuguese workers, combined with the maintenance of labour-intensive sectors with low wages, a highly segmented labour market, seasonal work associated with specific sectors of activity, a high informal economy 5 and the perception of Portugal as a country where it is easy to enter and stay in the EU context (Esteves, Hortas & Fonseca, 2017;Fonseca & McGarrigle, 2014).
The entry of immigrants into Portugal grew until 2004 but changed in the following ten years, with a decrease of almost 2% in 2010. This decline in the number of foreigners living in Portugal was due to the economic crisis, but also to the acquisition of Portuguese nationality by a significant number of immigrants already residing in Portugal (Fonseca & McGarrigle, 2014;Malheiros & Fonseca, 2011 (Table I). Both the flow from Eastern Europe and the flow from Brazil are more dispersed throughout the Portuguese territory than the previous flows. This internal mobility was facilitated by greater professional flexibility due to the higher levels of education of these migratory groups (Pires 2002). which gathers data on pre-school education and basic and secondary education in state schools in Mainland Portugal. First, we identified the students with an immigrant background using their parents' and the students' own birthplace. Before that, a review of the literature on the concept of students with an immigrant background was conducted, given that considering students with a foreign background based on the analysis of the students' and their parents' birthplace is the most consensual option, especially since it is considered that, even in the case of students who have not undergone a migration process, their conditions and experiences continue to be influenced by their parents' (Schnapper, 2007, Portes, 1996Portes & Rumbaut, 2001). Thus, in this study, students with an immigrant background are those who have a foreign nationality themselves or one of their parents does. Four groups are distinguished:  1 st generation: the parents and the student have foreign nationality;  2 nd generation: both parents are of foreign nationality, and the student is Portuguese;  Mixed-heritage students: one of the parents is Portuguese, and the other is foreign, while the student is Portuguese;  Returning foreign-born students: the student's nationality is foreign, and either the parents are Portuguese, or one of them is foreign and the other Portuguese.
Regarding the criteria for the constitution of groups based on birthplace, we chose, on the one hand, to create groups that combined countries, with the exception of Brazil, due to the variety of different birthplaces found in the school population. This option allowed us to focus the analysis on birthplace groups with some proximity from an economic, social and cultural point of view. On the other hand, these groups were intended to reflect the trend of immigration flows in Portugal.
Bearing this in mind, we formed the following birthplace groups:  To explain the differences in student performance, we use a linear regression model, which allows us to estimate the association between a given variable (often called an explanatory variable) and a variable of interest (called dependent variable), controlling for possible correlations between the variable of interest and other observed factors (called control variables and consisting of additional explanatory variables).
In this study, the variables of interest are three indicators of student performance: (a) the result obtained in the national Maths Exam; (b) the result obtained in the national Portuguese Language Exam; and (c) a binary indicator that indicates whether the student has had a successful academic record, which consists of completing the 3 rd cycle of basic education 7 without failing any year, and passing the 9 th grade national exams (DGEEC, 2016). Several linear regression models have been estimated using each of these performance indicators as dependent variables.
The first group of regressions includes as explanatory variables only those that identify the different immigrant backgrounds and the birthplace of the students. The coefficients obtained in these regressions measure the differences in average performance among students from different backgrounds. However, these differences in averages also capture differences in performance related to gaps in other sociodemographic factors of the students, their families, their schools and regions.
In the linear regression models, we considered control variables such as the gender of the student and a vector relating to the student's socioeconomic status that includes an indicator of whether the student has internet at home or not, an indicator of whether the student is a SASE beneficiary (with the following levels: non-beneficiary, A bracket and B bracket), the mother's academic background and the father's academic background (with the following levels: no education, 4 th grade completed, 6 th grade completed, 9 th grade completed, 12 th grade completed, bachelor's degree, master's degree, PhD), and the employment status of the parents. A set of additional control variables capturing the performance of the student immediately before starting the 3 rd cycle is also considered: an indicator of whether the student started the 3 rd cycle without having been held back in the past, and the results obtained in the Portuguese and Maths 6 th grade national exams. With the inclusion of these control variables in the regression models, the results obtained reflect the relationships between the various explanatory variables and the evolution in student performance throughout the 3 rd cycle.
The regression models also include a set of fixed effects at the level of each student's class, school and municipality. In other words, we included dummy variables for each class, school and municipality as additional control variables. In these models, the estimates obtained capture the differences in performance between students of different immigrant backgrounds and birthplaces within the same class, the same school, or the same municipality. Thus, the estimates of differences in performance between students from different immigrant backgrounds and birthplaces obtained with this approach are isolated from all the factors associated with differences between classes, schools, or municipalities, such as having different teachers or different socioeconomic backgrounds.
For more details on the variables used in the study, descriptive statistics for the LMA are presented in Tables II and III.

IV. STUDENTS WITH AN IMMIGRANT BACKGROUND: TERRITORIAL DISTRIBUTION
The first data analysis sought to understand who the students with an immigrant background enrolled in basic and secondary education 8 in Portugal were. The territorial distribution of students by immigrant background and birthplace in Portugal and in the LMA focuses on the 3 rd cycle of basic education since it includes the 9 th grade, which is the object of this paper. Finally, we analysed the territorial distribution of students by origin and birthplace in the 9 th grade in the LMA.

Students with an immigrant background in Portugal
In the 2016/2017 school year, there were 145,917 students with an immigrant background enrolled in basic and secondary education in Portugal, i.e., 14.62% of the students enrolled in these cycles of studies (Table IV).
Among the groups of students with an immigrant background, the most represented in basic and secondary education were Mixed-heritage students (69,646), followed by 1 st -generation students (29,912), 2 nd -generation students (28,428) and Returning foreign-born students (17,931). Looking at the number of students with an immigrant background enrolled in the 3 rd cycle of basic education in mainland Portugal -where the 9 th grade, the object of this study, is included -they represent 15.20% of the population enrolled in that cycle of studies. Their distribution in the territory is heterogeneous, fitting in with the distribution patterns of the immigrant population in the country (Fig. 1). As recorded in recent data regarding the trend of foreign population distribution in the country (Oliveira & Gomes, 2018), students with an immigrant background are mainly concentrated in the districts of Lisbon (34.63%), Setúbal (15.05%), Porto (8.80%) and Faro (8.60%).
The over-representation of the foreign population residing in urban areas and consequently the over-representation of students with an immigrant background, mainly in metropolitan areas and in the Algarve region, is due to the perception by immigrants of more employment opportunities and faster integration into the labour market in these regions. As a result, stronger social networks of mutual help are formed in these places and thus attract more immigrants (family, friends, acquaintances), as seen in most OECD countries (Oliveira & Gomes, 2018, p. 65).  Regarding the LMA, the municipality of Sintra stands out as the area where the proportion of students with an immigrant background in relation to non-native students is the highest (16-23.3%), followed by the municipality of Lisbon (10-15.9%) (Fig. 3). The municipalities bordering the city, Loures, Odivelas, Amadora and Oeiras, along with Cascais (on the northern edge), are in the third position in terms of the proportion of students with an immigrant background enrolled in the 3 rd cycle of basic education in the group of non-native students. In the South, the municipalities of Almada and Seixal occupy this position (5.0 to 9.9% of students with an immigrant background).
Looking at the map depicting the proportion of students enrolled in the 3 rd cycle of basic education in each municipality in the region of the LMA with an immigrant background in relation to the total number of students in the municipality (Fig. 4), we can see the great impact that the proportion of students with an immigrant background has in virtually every municipality. We have found that every municipality has more than 5% of students with an immigrant background in relation to the total school population and, with the exception of Mafra and Alcochete, every municipality has between 15 and 39.1% of students with an immigrant background. Amadora and Seixal have the highest relative weight of immigrant students, and the area with the highest proportion of immigrant students is concentrated on the north bank (Amadora, Loures, Odivelas, Sintra, Cascais and Oeiras). On the south bank, most municipalities have between 15 and 21.9 % immigrant students among the total school population. After Seixal, the municipalities of Almada and Moita have the highest percentages of immigrant students in their school population (22.9-29.1%).  Amadora, Cascais and Alcochete, due to their greater relative weight. The 2 nd -generation students have a greater weight in the municipalities of Loures, Sintra and Amadora. The group of Returning foreign-born students has the lowest relative weight in the metropolitan territory (5.9%) -only in the municipalities of Montijo, Alcochete, Cascais, and Mafra is this percentage higher.
Considering the birthplace of these 9 th grade students, Figure 6 illustrates that in ten of the eighteen municipalities in the LMA, Brazilian students have the highest relative weight and are present in every municipality. PALOP students, who are in the first place in the LMA as a whole, stand out in five municipalities -Sintra, Loures, Seixal, Moita and Alcochete -with a relative weight above 50%.
In third place, in terms of relative position in the whole LMA, we find the students from Eastern European countries (9.8%). The municipalities of Alcochete, Montijo, Mafra, Palmela and Sesimbra have the highest percentages of students from these countries. These municipalities are also those with the highest relative weight of students from the EU-15 countries.

V. ANALYSIS OF DIFFERENCES IN STUDENTS' ACADEMIC PERFORMANCE
In this section, we consider the students of the LMA, who comprise approximately 25% of the total number of students of the national sample. First, we examine whether there are significant differences in the students' academic performance, namely in the 9 th grade exams, depending on the student's immigrant background. The analysis then focuses on the differences between students of different nationalities.

Considering the immigrant background of the student
We begin by analysing the results presented in column (1) of Tables V, VI and VII. These focus on estimating the average difference in academic achievement between students from different immigrant backgrounds and Native students.
The first point to note in these figures is that the Mixed-heritage students group is the only one associated with better results, on average, compared to Native students. In fact, Mixed-heritage students are associated with 2 and 1 more points in the Maths and Portuguese 9 th grade exams, respectively, as well as a higher probability (3 p.p.) of finishing the 3 rd cycle of basic education with a successful academic record. With very similar results, on average, to the Native students are the Returning foreign-born students, who have no statistically significant differences in any of the indicators used. Larger differences are estimated for 2 nd -generation students and, in particular, 1 stgeneration students, who had worse performances in comparison to their Native peers in all three indicators used. Regarding the results in the 9 th grade exams, the widest gaps are found in Maths, with 2 nd -generation students scoring, on average, 8 points less than Native students, while for 1 stgeneration students, the estimated difference is 15 points. In the Portuguese Language Exam, 2 ndgeneration students have, on average, 4 points less than Native students, a value which is only exceeded by 1 st -generation students -6 points. Regarding the probability of having a successful academic record, 2 nd -generation students have a 13 p.p. lower probability compared to Native students, while for 1 st -generation students, this difference is 24 percentage points.
In column (2) of Tables V, VI and VII, we estimate the differences between students of similar socioeconomic conditions but with different immigrant backgrounds, and one can see that part of the differences found previously in column (1) can be explained by such conditions (such as the educational level of the parents or whether the student is a beneficiary of a government grant (SASE), among others).
The first result to notice here is that controlling for socioeconomic variables, Mixed-heritage students are no longer associated with better performances compared to Native students, but rather with similar performance levels. Similar performances are also obtained by Returning foreign-born students. Regarding 2 nd -generation and 1 st -generation students, these continue to be associated with significantly worse performances in comparison to Native students of similar socioeconomic conditions. However, the coefficients presented in this column are smaller than in the previous one, which indicates that part of the results of column (1) is explained by the socioeconomic conditions of the students. In fact, in the case of Maths, we can see that, on average, 2 nd and 1 st -generation students perform 3 and 9 points lower, respectively, than Native students of similar socioeconomic backgrounds. Regarding the Portuguese Language exam, the coefficients decreased to approximately half the magnitude presented in column (1), with 2 nd and 1 st -generation students exhibiting significantly lower performances of 2 and 4 points, respectively, relative to Native students. As for the probability of having a successful academic record, 2 nd -generation students are associated with a probability of approximately 4 p.p. lower vis-à-vis Native students of similar socioeconomic backgrounds, while 1 st -generation students are associated with a probability approximately 13 p.p. lower. The next step was to introduce class fixed effects in the regressions in column (3) to examine whether the differences found in column (1) still hold when comparing students from different immigrant backgrounds but controlling for the average performance obtained by their classmates.
Being that the case, whereas in column (1) we analysed the disparities between students from different immigrant backgrounds on average, we now only compare the performance of these students with the ones obtained by Native students in their class.
The first noteworthy aspect in column (3) of Tables V, VI and VII is that, as seen in column (1), Mixed-heritage students are associated with significantly higher performances compared to Native students in the same class, even if the differences are small (about 2 points in the Maths Exam, and a 3 p.p. higher probability of having a successful academic record). Returning foreign-born students have very similar results to Native students across all indicators, regardless of whether they are classmates or not.
The largest differences found in column (3) are for 2 nd -generation students and, in particular, for 1 st -generation students, both of whom are associated with significantly lower performances across all indicators compared to the Native students in their class. However, students from these two groups have lower coefficients (approximately half) compared to column (1), which indicates that these students are in classes where their Native peers perform below the LMA average.
In column (4) of Tables V, VI and VII, we compare students from different immigrant backgrounds but of similar socioeconomic characteristics and from the same class. Therefore, this column is similar to column (2) but with the addition of class fixed effects.
On the one hand, we have found that Mixed-heritage students and Returning foreign-born students have coefficients in column (4) that are very similar to those in column (2), i.e., it makes no difference if we compare their academic performance to the performance of Native students of similar socioeconomic background from the whole LMA, or only from their class. In other words, the performance obtained by their classmates does not differ from the LMA average, controlling for socioeconomic characteristics.
On the other hand, 2 nd -generation and 1 st -generation students display different coefficients, and with smaller differences in column (4), compared to what is estimated in column (2). This implies that these students are associated with lower performances, on average, when compared to Native students of similar socioeconomic background, but when compared to Native students of the same class, who also have a similar socioeconomic background, the estimated differences are much smaller.
In the case of 2 nd -generation students, we can see that when class fixed effects are introduced in the regression comparing students of similar socioeconomic backgrounds, the negative coefficients presented in column (2) (3 and 2 points less in the Maths and Portuguese Language Exams, respectively, as well as a 4 p.p. lower probability of having a successful academic record) are no longer statistically significant. In other words, 2 nd -generation students obtain statistically indistinguishable results from Native students in column (4), i.e., when compared to their Native classmates with the same socioeconomic background. Regarding 1st-generation students, we can see that they still have lower results than Native students with the same socioeconomic background, even after controlling for factors inherent to the students' class. However, we have found that the coefficients in column (4) are lower in magnitude than those presented in column (2). Indeed, while column (2) reports differences of 8 and 3 points in the Maths and Portuguese Language Exams, respectively, as well as a 13 p.p. difference in the probability of having a successful academic record, in column (4), the magnitude of these coefficients decreases to 6 and 2 points, in the case of the Maths and Portuguese Language Exams, and to 9 p.p. in the case of the probability of having a successful academic record. It should be noted that the differences, compared to column (2), are significant and indicate that these students are in classes where their Native peers, on average, perform worse than the LMA average. However, it is also important to note that the difference in the magnitude of the coefficients presented between column (2) and (4) is lower than the difference between columns (1) and (3), which indicates that, in part, the worse performance obtained by Native students in the same class as the 1 st -generation students seems to be explained by the socioeconomic background of these students.
Thus, the results shown in this column complement those presented in column (3), exhibiting not only that students from certain immigrant backgrounds (in particular, 2 nd -generation and 1 st -generation students) are, generally, enrolled in classes where their Native peers perform below average, but also that this difference in academic performance is only partially explained by socioeconomic factors and is therefore also the result of other factors related to the student's school or class.
Subsequently, we introduce in the regressions the performance of students at the end of the 2 nd cycle of studies, presented in column (5) of Tables V, VI and VII. Here, the aim is to understand which part of the differences observed initially in column (1) can be explained by disparities prior to the beginning of the 3 rd cycle.
Looking at the results presented in column (5), we have found that, in fact, most of the inequalities between students from different immigrant backgrounds in the 3 rd cycle are no longer statistically significant when controlling for the students' academic performance at the end of the 2 nd cycle. Mixed-heritage students no longer have significantly positive coefficients (albeit low) and show coefficients that are almost indistinguishable from zero, a sign of a similar evolution throughout the 3 rd cycle to that of Native students. As for 1 st -generation students, they are no longer associated with significantly negative coefficients, and present in column (5) coefficients very close to zero, indicating that, although these students are associated with much lower results when compared to Native students at the end of the 3 rd cycle, the inequalities in academic performance seem to be mostly explained by factors prior to their entry into this cycle of studies.
Returning foreign-born students and 2 nd -generation students exhibit a negative evolution throughout the 3 rd cycle in comparison to Native students. In the case of Returning foreign-born students, this evolution is only found in the Maths Exam, where Returning foreign-born students obtain, on average, 3 points less in comparison to Native students with a similar performance at the end of the 2 nd cycle. For 2 nd -generation students, we estimate that this negative evolution is seen across the three indicators used and that these students are associated with lower performance (of 1 point in both exams and 2 p.p. in the probability of having a successful academic record) in comparison to Native students with similar performance at the end of the 2 nd cycle.
We also sought to understand how some of the disparities observed between students from different immigrant backgrounds persist after controlling simultaneously for the different socioeconomic conditions of the students and their academic performance prior to entering the 3 rd cycle of basic education. Column (6) of Tables V, VI and VII highlights that the disparities between students from different immigrant backgrounds are considerably lower when controlling simultaneously for socioeconomic factors and for the student's academic performance when they start the 3 rd cycle of studies. In fact, Returning foreign-born students are the only ones associated with significantly lower performances (of 3 points in Maths) compared to Native students of similar socioeconomic background and academic performance at the end of the 2 nd cycle.
Finally, in column (7) of Tables V, VI and VII, we also introduced class fixed effects in the regression. By doing so, we wanted to determine whether students from different immigrant backgrounds but of similar socioeconomic characteristics and academic performance at the end of the 2 nd cycle and from the same class performed differently at the end of the 3 rd cycle. In general, it can be observed that the differences found in the academic performance of students in the 3 rd cycle are no longer statistically significant when controlling for all the variables described above (except for Returning foreign-born students, who have a statistically significant coefficient of negative 3 points in Maths). The dep. var. is the 9 th grade Maths Exam result (0 to 100); Parents' education level includes the following categories for both parents: no level of education completed, 4 th grade, 6 th grade, 9 th grade, 12 th grade, bachelor's degree, master's degree and PhD; Socioeconomic control variables include variables accounting for whether the student has access to the internet at home, whether s/he has, at least, a parent unemployed, and whether s/he receives a government grant; Robust standard errors are presented in parenthesis; Significance level at which the null hypothesis is rejected: *** 1%, ** 5%, * 10%.  The dep. var. is the 9 th grade Maths Exam result (0 to 100); Parents' education level includes the following categories for both parents: no level of education completed, 4 th grade, 6 th grade, 9 th grade, 12 th grade, bachelor's degree, master's degree and PhD; Socioeconomic control variables include variables accounting for whether the student has access to the internet at home, whether s/he has, at least, a parent unemployed, and whether s/he receives a government grant; Robust standard errors are presented in parenthesis; Significance level at which the null hypothesis is rejected: *** 1%, ** 5%, * 10%.

Considering the birthplace of the student
The previous analysis is replicated, but now with the purpose of assessing whether there are, on average, significantly different academic performances between students of different nationalities.
We start by examining the results presented in column (1) of Tables VIII, IX and X, where one can identify two major groups of students: on the one hand, Brazilian students and students from the PALOP countries, who are associated with lower performances than their Portuguese peers across all indicators used; on the other hand, students from the EU-15, Eastern Europe and the category Other, whose outcomes are statistically indistinguishable from those of Native students. For students of Brazilian or PALOP nationality, the biggest differences, on average, vis-à-vis students of Portuguese nationality, are estimated in Maths (minus 16 and 19 points, respectively), and in the probability of having a successful academic record (minus 25 and 28 p.p., respectively), although significant differences are also estimated in the Portuguese Language Exam (of 3 and 8 points, respectively).
In column (2) of Tables VIII, IX and X, we present the results controlling for the socioeconomic factors described above. Again, students of Brazilian and PALOP nationality are those associated with the worst performances. In fact, students from these groups perform below students of Portuguese nationality of similar socioeconomic background, on average, particularly in the Maths Exam (with 12 and 8 points less, respectively), and in the probability of having a successful academic record (19 and 10 p.p. less, respectively). It is important to note that the socioeconomic background of the student seems to explain approximately half the inequalities of PALOP students vis-à-vis Portuguese students; however, in the case of Brazilian students, it seems to explain only a small part of the gap, since the coefficients presented in column (2) for these students are not very different from those presented in column (1). For the Portuguese Language Exam, Brazilian and PALOP students are associated with lower performances, of 2 and 4 points respectively, than their Portuguese peers, the difference being statistically significant only in the latter.
In column (3) of Tables VIII, IX and X, we add class fixed effects to the initial regression. In this manner, we sought to understand whether the estimated disparities between students of different birthplaces, on average, hold when comparing students from the same class.
Here we can distinguish two large groups of students: on the one hand, students from the EU-15, Eastern Europe, and the Other category, who show very similar coefficients in column (3) to the initial column. This suggests that these are students who are enrolled in classes in which Portuguese students display academic performances similar to the average of Portuguese students in the LMA as a whole. The only exception found in these three groups concerns EU-15 students in the case of Maths. In fact, when comparing these students with Portuguese students in their class, we found that EU-15 students perform significantly lower (minus 6 points), something that was not estimated when comparing with the Portuguese LMA students in general. Therefore, students from the EU-15 seem to be enrolled in classes where Portuguese students tend to perform above the average in the LMA in the subject of Maths.
On the other hand, students of Brazilian and, especially, PALOP origin have considerably smaller differences in this column than in the initial column. This indicates that the performance obtained, on average, by the remaining Portuguese students in these students' classes is lower than the one obtained by Portuguese students in the LMA. This seems to be particularly the case of PALOP students who, on average, score 19 points less in the Maths Exam and are associated with a 28 p.p.
lower probability of having a successful academic record than a Portuguese student, but the differences drop to 9 points and 10 p.p., respectively, when comparing with Portuguese students in the same class. For Brazilian students, the difference shrinks from 16 to 11 points in the Maths Exam and from 26 p.p. to 18 p.p. regarding the probability of having a successful academic record when comparing with Portuguese students in the same class.
Thus, the results presented in column (3) suggest that students of certain nationalities (Brazilian and, especially, PALOP) are usually enrolled in classes where the academic performance of the remaining Portuguese students is below the average of the LMA.
Afterwards, in column (4) of Tables VIII, IX and X, we examine which part of the estimated differences when comparing students from different backgrounds and with the same socioeconomic status are eliminated when only comparing students from the same class. Thus, this column is identical to column (2), additionally introducing class fixed effects.
We identify two distinct effects in this column: on the one hand, we find that students from the EU-15, Eastern Europe and the category Other are associated with similar coefficients as in column (2), indicating that the school performance of the remaining students in their class does not differ significantly from the LMA average, controlling for students' socioeconomic characteristics.
On the other hand, for students from Brazil and the PALOP countries, we observed large disparities between the coefficients presented in column (2) and column (4). Given that we are controlling for socioeconomic factors, this considerable difference between the coefficients shown in column (2) and (4) indicates that students of Brazilian and PALOP origin are enrolled in classes where the performance of their Portuguese peers is lower than the performance of Portuguese students in the LMA on average, even after taking into account differences in socioeconomic status.
We also intended to ascertain whether part of the differences initially found was explained by factors prior to the 3 rd cycle. For that purpose, we introduced in column (5) of Tables VIII, IX and X control variables concerning the performance of students at the end of the 2 nd cycle, namely regarding the marks obtained in the 6 th grade exams and the number of years they had been held back before entering the 3 rd cycle.
We also were able to see, when analysing column (5), that most of the disparities found in the initial column seem to be explained by factors prior to the student's entry into the 3 rd cycle. In fact, students from the EU-15, Eastern Europe and the category Other display a similar evolution throughout the 3 rd cycle as Portuguese students across all the indicators used. The only exception is for students from the EU-15 in the Maths Exam, where they have a negative and significant coefficient (even if only for a confidence interval of 90% or less) of almost 5 points.
Regarding Brazilian and PALOP students, we found a different evolution over the 3 rd cycle for students from each of the groups: in the case of PALOP students, despite being associated with much lower performances in the 3 rd cycle than Portuguese students, when compared to students who had obtained a similar performance at the end of the 2 nd cycle of education, these inequalities cease to be statistically significant. In other words, the inequalities presented by PALOP students enrolled in the 3 rd cycle in the LMA vis-à-vis Portuguese students seem to be mostly explained by factors preceding their entry into the 3rd cycle. As regards Brazilian students, we can see that they exhibit a negative evolution throughout the 3 rd cycle, compared to Portuguese students with similar performance at the end of the 2 nd cycle. In fact, Brazilian students show, on average, 4 points fewer in the Maths Exam and an 8 p.p. lower probability of having a successful academic record than Portuguese students with similar academic performance at the end of the 2 nd cycle.
In column (6) of Tables VIII, IX and X, we estimate which part of the disparities observed between students of different birthplaces persist after controlling for the different socioeconomic backgrounds of the students and their academic performance prior to entering the 3 rd cycle of basic education, simultaneously. In general, we find that students of similar socioeconomic characteristics and academic performances in the 2 nd cycle tend to have similar performances in the 3 rd cycle, regardless of their nationality. One of the exceptions is for Brazilian students, who are associated with a 4-point lower performance in the Maths Exam and an 8 p.p. lower probability of having a successful academic record than Portuguese students of similar socioeconomic characteristics and academic performance in the 2 nd cycle. Thus, the results presented in column (6) complement those of column (5), indicating not only that Brazilian students display particular difficulties in the 3 rd cycle of studies (particularly in Maths), but also that this negative development in this period does not seem to be explained by the socioeconomic background of the student. The other exception is EU-15 students, who also display a negative evolution along the 3 rd cycle in Maths when compared to Portuguese students of the same socioeconomic background and with similar academic performances at the end of the 2 nd cycle.
Finally, in column (7) of Tables VIII, IX and X, we also introduce class fixed effects in the regression. By doing so, we assess whether students with different birthplaces but of similar socioeconomic characteristics, similar academic performance at the end of the 2 nd cycle, and from the same class perform differently at the end of the 3 rd cycle. In general, the estimated coefficients in this column are similar to those in the previous column, so the class fixed effect does not seem to have had a considerable impact on most groups of students. However, the performance of PALOP students should be highlighted with respect to the probability of having a successful academic record. In fact, we estimate that these students have a 6 p.p. higher probability of having a successful academic record than Portuguese students of similar socioeconomic characteristics, from the same class, and with identical academic performance at the end of the 2 nd cycle. Since this result was not found in the previous column, it may be due to the fact that these students tend to be in classes with Portuguese students who perform below the LMA average. The dep. var. is the 9 th grade Maths Exam result (0 to 100); Parents' education level includes the following categories for both parents: no level of education completed, 4 th grade, 6 th grade, 9 th grade, 12 th grade, bachelor's degree, master's degree and PhD; Socioeconomic control variables include variables accounting for whether the student has access to the internet at home, whether s/he has, at least, an unemployed parent, and whether s/he receives a government grant; Robust standard errors are presented in parenthesis; Significance level at which the null hypothesis is rejected: *** 1%, ** 5%, * 10%. The dep. var. is the 9 th grade Maths Exam result (0 to 100); Parents' education level includes the following categories for both parents: no level of education completed, 4 th grade, 6 th grade, 9 th grade, 12 th grade, bachelor's degree, master's degree and PhD; Socioeconomic control variables include variables accounting for whether the student has access to the internet at home, whether s/he has, at least, an unemployed parent, and whether s/he receives a government grant; Robust standard errors are presented in parenthesis; Significance level at which the null hypothesis is rejected: *** 1%, ** 5%, * 10%. The dep. var. is the 9 th grade Maths Exam result (0 to 100); Parents' education level includes the following categories for both parents: no level of education completed, 4 th grade, 6 th grade, 9 th grade, 12 th grade, bachelor's degree, master's degree and PhD; Socioeconomic control variables include variables accounting for whether the student has access to the internet at home, whether s/he has, at least, an unemployed parent, and whether s/he receives a government grant; Robust standard errors are presented in parenthesis; Significance level at which the null hypothesis is rejected: *** 1%, ** 5%, * 10%.

RELATING TO MUNICIPALITY, SCHOOL AND CLASS
Another aim of this study is to explore in more detail the previously estimated inequalities among students of different immigrant backgrounds and birthplaces and to determine whether some of them can be explained by factors related to the municipality, the school and the class of the student. Indeed, one of the main findings from the previous tables was that when comparing students of different backgrounds, but from the same class, the difference between them was considerably smaller than the estimated difference between students from different classes. This is an indication that students from certain immigrant backgrounds and of certain birthplaces generally seem to be in classes where their Native peers perform below average in the LMA. We now want to see if this can be explained by the characteristics of the municipality, the school, or the different classes of these students.

Considering the immigrant background of the student
We start by looking at Tables XI, XII and XIII, where we estimate the differences between students from different immigrant backgrounds. In these tables, we compare the academic performance of students from a given immigrant background with that of Native students from the LMA (column 1), with Native students from the same municipality (column 2), with Native students from the same school (column 3), and with Native students from the same class (column 4). We can thus state that if the coefficients do not change significantly between the different columns, as is the case for Mixed-heritage students and Returning foreign-born students, then these students, on average, are in classes with Native students whose performance is within the average of the school, the municipality and the LMA.
However, this is not the case for all immigrant backgrounds. In fact, 2 nd and 1st-generation students perform worse when compared to Native students in general (column 1), but much of this difference (about half) is not found when we compare with students of the same class (column 4).
In the case of 2 nd -generation students, we can see that this is related to factors inherent to the class, and mainly to the student's school, since the coefficients presented in column (1) of Tables XI,   XII and XIII are similar to those in column (2) (i.e., the performance obtained by Native students from the municipality of these 2 nd -generation students is within the average of the performance obtained by Native students in the LMA in general). Regarding the results in column (3) and (4), we should point out that their magnitude is much lower compared to the initial columns, indicating that students from this immigrant background are generally in schools where the average performance of Native students is lower than the average performance of Native students in the municipality, and in classes with an average performance lower than the school's average.
Regarding 1 st -generation students, we also observed that the differences vis-à-vis Native students decrease as the granularity of the fixed effect increases. This indicates that Native students in the same class as 1 st -generation students have, in general, lower performances in comparison to the average of Native students in their school; Native students from the same school as 1 st -generation students have, on average, lower performances in comparison to the average of Native students in that municipality; and Native students from the same municipality of 1 st -generation students have, in general, lower performances in comparison to the average of Native students in the remaining municipalities of the LMA. However, we should point out that the biggest differences seem to be explained by factors inherent to the class and, in particular, to the school of the student. In other words, 1 st -generation students seem to be in classes whose students' performance is below the school's average and in schools whose students' performance is well below the municipality's average. The results estimated in Tables XI, XII and XIII may be an indicator of the presence of some sort of segregation experienced by 2 nd and 1 st -generation students, both at intra-municipality and intra-school level. Significance level at which the null hypothesis is rejected: *** 1%, ** 5%, * 10%.  The dep. var. is a binary indicator which takes the value of one when a student has not been retained during the 3 rd cycle of primary education and has passed both 9 th grade national exams; Robust standard errors are presented in parenthesis; Significance level at which the null hypothesis is rejected: *** 1%, ** 5%, * 10%.

Considering the birthplace of the student
In Tables XIV, XV and XVI, we have replicated the previous analysis but now taking into account the inequalities between students from different birthplaces.
Here, once again, we can distinguish two large groups of students: on the one hand, students from the EU-15, Eastern Europe, and the category Other, who are not associated with significant changes in the coefficients across the different columns, thus indicating that these students are in classes where Native students perform similarly to the average of the Native students in their school, in their municipality, and in the LMA as a whole. The only exception that we find in these three groups refers to students from the EU-15 in the case of Maths. In fact, when comparing these students to the Native students in their class, we demonstrate that EU-15 students perform significantly worse (minus 6 points), something that we do not find when comparing them to Native students from the LMA as a whole. Therefore, EU-15 students seem to be in classes where Native students perform above the average of Native students in their school, municipality, and the LMA as a whole, in the Maths Exam.
On the other hand, Brazilian students, and in particular students from the PALOP countries, show considerably lower differences compared to Native students when comparing only with students in their own class. This indicates that the performance obtained by the Native students in the classes of these students is lower than the average obtained by Native students in the LMA.
We should, however, highlight two aspects. The first is that students from the PALOP countries, in particular, seem to be enrolled in classes with considerably lower than average performance -e.g., on average, a PALOP student scores 19 points less in the Maths Exam and is associated with a 28 p.p. lower probability of having a successful academic record than a Native student, but the differences fall to 9 points and 10 p.p., respectively, when comparing them to Native students in the same class. For Brazilian students, the difference drops from 16 to 11 points in the Maths Exam and from 26 p.p. to 18 p.p. less in the probability of having a successful academic record.
The second aspect is that these differences are largely explained by factors inherent to the school and class of the student, rather than to the municipality (in the tables, we have seen that the differences between column (1) and (2) are much smaller than in columns (3) and (4)). This indicates that these students born in Brazil and, in particular, in the PALOP countries are in classes where the average performance obtained by their Native classmates is below the average performance obtained by Native students in the school, and in schools where the average performance obtained by their Native peers is below the municipality's average. Significance level at which the null hypothesis is rejected: *** 1%, ** 5%, * 10%.  The dep. var. is a binary indicator which takes the value of one when a student has not been retained during the third cycle of primary education and has passed both 9 th grade national exams; Robust standard errors are presented in parenthesis; Significance level at which the null hypothesis is rejected: *** 1%, ** 5%, * 10%.

VII. CONCLUSION
The distribution of students with an immigrant background in the national territory follows the territorial patterns of immigration in the country: higher concentrations are found in the metropolitan areas of Lisbon and Porto and in the district of Faro. In the Metropolitan Area of Lisbon, the municipalities of the north bank have the highest relative weight of students with an immigrant background in the school population, particularly in the municipality of Amadora.
Nevertheless, we should stress the greater dispersion of students from Eastern Europe and Brazil throughout the Portuguese territory, explained by the greater labour flexibility of their parents in contrast with the traditional profile of immigration in Portugal.
The findings of this study confirm the hypothesis that there are significant differences in the academic performance of students according to their immigrant background and birthplace. In fact, 2 nd -generation and 1 st -generation students perform worse than Native students across all the indicators used, particularly in the Maths Exam (on average, 8 and 15 points less, respectively), and in the probability of having a successful academic record (on average, 13 percentage points and 24 p.p. less, respectively).

Regarding birthplaces, Brazilian and PALOP students show the greatest differences vis-à-vis
Portuguese students, particularly in Maths (on average 16 and 19 points less, respectively) and in the probability of having a successful academic record (25 p.p. and 28 p.p. less, respectively).
In addition to analysing the average differences between students from different immigrant backgrounds and birthplaces, we investigated the impact of different explanatory factors on these inequalities. We started by analysing students of the same socioeconomic status, and found that the differences between students from different immigrant backgrounds and birthplaces decreased; however, the above-mentioned groups (2 nd -generation, 1 st -generation, Brazilian and PALOP students) continued to perform significantly lower, compared to Native students with the same socioeconomic status.
We have also found that students from different birthplaces and immigrant backgrounds but from the same class show much smaller differences between them, which indicates that students from the above-mentioned groups are assigned to classes where the average performance of the Native students is lower than the average in the LMA. Moreover, we found that this inequality is only partially explained by socioeconomic factors and is thus also the result of other factors related to the student's school or class.
When controlling for the academic performance of the students at the end of the 2 nd cycle, we demonstrated that a large part of the inequalities presented are no longer statistically significant (Brazilian and 2 nd -generation students are exceptions, exhibiting a negative evolution throughout the 3 rd cycle when compared to Native students with similar performances at the end of the 2 nd cycle). This means that part of the estimated inequalities is explained by factors prior to admittance to the 3 rd cycle.
Regarding the impact of the municipality, school and class factors on the estimated inequalities, we have observed that a considerable part of the differences is explained by these factors. We have found that 2 nd -generation, 1 st -generation, Brazilian and, in particular, PALOP students are in classes where the average performance of their Native peers is below the school's average and attend schools where the average performance of their Native peers is below the municipality's average. This might be an indicator of some sort of segregation experienced by these students, either at the intra-municipality level (by school) or at the intra-school level (by class).