Advancing the Knowledge of Spaniards’ Attitudes Towards Immigration

This study aims to assist Spanish authorities in enhancing the prevention of negative attitudes towards immigrants by addressing two key questions derived from prior research by the authors: (1) Which variables consistently influence attitudes towards migration over time? (2) What are the distinct attitudinal differences among various groups? Thus, the study delves into the evolution of attitudes towards migration in Spain from 2015 to 2017. It employs a dynamic perspective and advanced machine learning (ML) techniques recognized for their superior predictive capacity in social sciences. It identifies key variables influencing attitudes within diverse groups, including Multicultural and Non-Multicultural, and traces their changes over time. The research addresses the persistence of specific variables tied to subtle biases and distinctions among attitudinal segments. Despite an overall positive trend towards welcoming differences, the study unveils enduring ambivalence, elements of aversive racism, and subtle prejudice, highlighting the intricate factors contributing to the non-acceptance of immigration. Notably, self-perception emerges as a determinant, with optimism and professional attributes correlating with heightened tolerance. In conclusion, the study provides nuanced insights into the multifaceted nature of attitudes towards migration, offering valuable perspectives for more informed policy development.


Introduction
Over the past two decades, perceptions towards immigrants in Spain have undergone a multifaceted evolution influenced by various socioeconomic and political factors.At the turn of the 21st century, Spain experienced a significant influx of immigrants (Cacho´n Rodrı´guez, 2009), primarily driven by economic opportunities, initially shaping a relatively positive view towards newcomers (Alekseev, 2023).The global financial crisis 2008 marked a turning point, leading to increased unemployment rates and economic instability (Aja et al., 2011).Although in the first phase, this downturn did not imply a shift in public sentiment, some segments of the population expressed concerns about competition for jobs and strain on social services, fostering a more skeptical attitude towards immigrants (Arango et al., 2014;Arroyo et al., 2021).
In recent years, there has been a growing awareness of the contributions made by immigrants to the Spanish economy and society, leading to a more nuanced understanding of their role.As Spain grappled with demographic challenges, including an ageing population and declining birth rates, discussions around immigration shifted towards recognizing the demographic and economic benefits immigrants bring (Franzke & Fuente, 2021).Government policies, public discourse, and grassroots initiatives aimed at fostering integration have also played a role in shaping a more inclusive perspective (Fierro & Parella, 2023;Va´squez-Gonza´lez, 2021).
Since 2011, the Spanish authorities have been explicitly involved in the fight against racism.In this respect, the Spanish Government (Ministry of Social Security and Migration)-currently updating its anti-racism strategy-has provided researchers with a useful tool, the ''Attitudes towards Immigration '' survey, yearly between 2007 and 2017. 2017 is the last year when the survey was conducted, so this is the most recent dataset available for research.
For the reports corresponding to the last 3 years of the series, a research team (Ferna´ndez et al., 2017(Ferna´ndez et al., , 2018(Ferna´ndez et al., , 2019) ) elaborated on several factors describing Spaniards' attitudes towards immigrants.These researchers also classified respondents into three groups (Multicultural, Distant, and Distrustful) based on these attitudes (their scores on the factors).
To help the Spanish authorities improve the prevention of negative attitudes toward immigrants, the present analysis builds on the results of the studies mentioned above by posing two research questions.
1. What variables persist in attitudes towards migration over time? 2. What are the attitudinal dissimilarities between different groups?
To answer these questions, we developed a predictive model through an algorithm that weights the importance of the variables that explain the citizens' attitudes towards migration and the evolution of these variables during three different periods.We applied this model to two distinct groups, the so-called Multicultural and the Non-Multicultural.Furthermore, the importance of the variables will be analyzed when classifying respondents into Multicultural and Non-Multicultural categories.This article first offers a theoretical section that analyses the concepts underlying negative attitudes towards immigration, that is, racism, prejudice, and xenophobia; the leading indicators used to measure them; and the variables used to define groups in the so-called attitudinal segmentation.This theoretical background underpins the topics and items of the questionnaire on attitudes towards immigration used to produce our empirical results.Next, the methodology section provides details of the variables selected to build our predictive model and the mathematical techniques used to develop the algorithm.The results section analyses, firstly, in a static way, the dimensions of discriminatory attitudes and, secondly, from a dynamic perspective, the evolution of these attitudinal determinants and the differences found within groups.In the discussion section, we highlight our main findings, dialogue with the existing literature, state the opportunities for further research and provide recommendations for public authorities.
Our main conclusion is that a better understanding of those determinants of attitudes that persist systematically over time and of the contradictory reactions of the various segments of the native population could be a powerful tool to design and refine public programs and strategies to change attitudes and values towards immigration.

Racism, Prejudice, and Xenophobia
Racism is a complex concept summarized as ''not accepting difference'' (Sibony, 1997), either focusing on a thought, attitude, or both.Thus, racism could be categorized into three dimensions: ideology, opinions and attitudes, and behaviors or practices (Taguieff, 1988).
On the other hand, racism can be analyzed from an individual (Adorno et al., 1950;Alport, 1954) and group perspectives.In this latter case, internal behavior within the group-the ingroup- (Tajfel & Turner, 2004) or the group's relationship with society-the outgroup-can, in turn, be studied.Within the group explanation of racism, the so-called conflict theory (Sherif, 1966) is especially applicable to our current context; this theory explains hostility and prejudices towards foreigners, ethnic minorities, etc., by (real or perceived) competition for scarce resources.These scarce resources can be material goods (such as employment or access to social benefits) and non-material goods, such as power.
In sum, racism is an ideological interpretation that confers on a particular race or ethnic group a position of power over others based on physical or cultural attributes and economic resources.Racism implies hierarchical relationships in which the ''superior'' race exercises dominance and control over the others (Grossi, 1999;Kleinpenning & Hagendoorn, 1993).
Prejudice, also a construct, could be defined as a negative attitude towards members of an ethnic or social group (Ashmore, 1970) and can be split into three components: cognitive, affective, and behavioral (Breckler, 1984;Eagly & Chaiken, 1993).
The cognitive component is based on opinions or stereotypes about the outgroup based on their ideology, beliefs, economic situation, social class, or family situation.The affective component consists of positive (admiration, sympathy, and respect) and negative (mistrust, discomfort, insecurity, and indifference) emotions towards the outgroup; such emotions are considered subtle by the researchers of modern, subtle, latent, or aversive prejudice.Finally, the behavioral component of prejudice is measured through the attitude of maintaining or avoiding possible relationships with members of the outgroup, that is, setting the preferred social distance.
The issue of xenophobia incorporates nuances regarding racism, as it refers to attitudes, prejudices and behaviors that reject, exclude and often denigrate people based on the perception that they are outsiders or foreigners alien to the community, society or national identity (ACNUR, 2020).However, manifestations of xenophobia could be directed against people with identical physical characteristics, even with kinship affinity, when they are considered foreigners in those places where they arrive, return or emigrate (ILO, IOM, OHCHF, & UNHCR, 2001).In other words, xenophobia is about stereotypes, and prejudice is about ideology.

Indicators
It should be noted that given the increasing social censorship against racism or its open expressions, people have stopped expressing racism directly and manifestly (Cacho´n, 2006;Rinken, 2015;Rinken & Pe´rez Yruela, 2007).Still, they have not been able to change their negative representation of various ethnic minorities.Therefore, new forms of racism have been generated, capable of avoiding the social cost of overt racism.In this vein, research (Aguilar & Castellano, 2016;Cea D'Ancona, 2009) has highlighted the importance of producing indicators for more precise detection of racist or xenophobic attitudes.Especially relevant are those indicators aimed at measuring the most subtle forms of discrimination: symbolic racism, aversive racism, and subtle prejudice.
Symbolic racism (Kinder & Sears, 1981;Sears & Kinder, 1971;Tarman & Sears, 2005) is a form of racial prejudice characterized by individuals' opposition to policies designed to address (racial) inequality, often framed by traditional values and principles.It reflects a subtle and symbolic expression of racial prejudice, in which individuals may endorse color-blind ideologies but harbor negative feelings towards policies perceived as beneficial to minority groups.The term has been used to explain how deep-seated racial prejudice can manifest itself in seemingly non-racial contexts.Aversive racism (Dovidio & Gaertner, 1986, 2004;Dovidio et al., 2016) refers to a subtle, often unintentional form of racial bias in which individuals who consciously endorse egalitarian values may still harbor unconscious negative attitudes towards racial or ethnic outgroups.Aversive racists may unknowingly display discriminatory behavior or make biased decisions in situations where their egalitarian beliefs conflict with implicit biases.Aversive racists manifest discomfort, anxiety or fear rather than overt hostility or hatred.This concept highlights the complex interplay between explicit beliefs and implicit biases.Subtle prejudice (Pettigrew & Meertens, 1995) encompasses a variety of indirect discriminatory behaviors rooted in social stereotypes and cultural narratives.These are subtle expressions of prejudice, such as microaggressions or implicit biases, which individuals may not recognize but contribute to systemic inequalities in various social contexts such as work, housing, finance or consumption (Pager & Shepherd, 2008).
These indirect forms of discrimination have common denominators, stemming mainly from their implicit nature: Subtle forms of racism or discrimination imply that individuals may harbor prejudices that operate subconsciously, making them difficult to recognize and confront directly (Greenwald & Krieger, 2006).Secondly, they are underpinned by negative attitudes rooted in historical, cultural, and social factors, significantly influencing perceptions of particular social groups.Furthermore, these three forms of bias cause differences (real or perceived) to influence individuals' thoughts, feelings and actions towards others; the impact on behavior is often subtle, with implicit biases influencing decision-making processes and more overt discriminatory actions (Richeson & Shelton, 2007).Finally, as highlighted by intersectionality theory (Crenshaw, 1989;Murrell, 2020), all three biases can come together; that is, discrimination can overlap across a range of factors such as race, gender, socioeconomic status, etc., which intersect to create unique and compounded situations of oppression, contributing to a complex web of systemic inequalities (Bowleg, 2012;Collins, 2015).
Moreover, there are divergences between these three forms of modern prejudice.In terms of their nature and focus, while symbolic racism focuses on the rejection of policies that benefit disadvantaged minorities (Sears & Henry, 2005), aversive racism, outlined by Dovidio and Gaertner, revolves around the individual's internal struggle rather than the outright rejection of policies; subtle prejudice represents a broader range of indirect discriminatory behaviors rooted in social stereotypes (Pager & Shepherd, 2008).They also differ in terms of their context of expression: Symbolic racism focuses on political attitudes and beliefs regarding social policies; aversion is expressed in interpersonal interactions and emotional responses that may manifest as discomfort, anxiety or avoidance in the presence of members of particular social groups; while subtle prejudice can be expressed in a variety of contexts (interpersonal interactions, workplace dynamics or decision-making processes) that influence everyday interactions.Finally, there are also some differences in their measurement methods: Symbolic racism (Henry & Sears, 2002;McConahay, 1983;Tarman & Sears, 2005) is usually assessed by self-reported items on individuals' attitudes towards policies or issues aimed at promoting minority rights or equal opportunities; Dovidio and Gaertner's (1986) Aversive Racism Scale and its subsequent revisions and implementations (Dovidio et al., 2016;Murrell et al., 1994) target on capturing the subtle and ambivalent nature of aversive racism by assessing individuals' conflicting feelings and behaviors; then, the subtle part of the Pettigrew and Meertens' (1995) Prejudice scale and its subsequent updates (Arancibia-Martini et al., 2016;Gattino et al., 2008;Ungaretti et al., 2020) unveil the indirect side of prejudice in the form of the defense of traditional values, the exaggeration of cultural differences and the denial of positive emotions towards the stigmatized group.Examples of items used in these scales are: for symbolic racism, ''Immigrants have more benefits than natives''; ''they have achieved more than they deserve''; for aversive bias, ''The presence of immigrants decreases the quality of health care'' or ''The presence of the migrant children decreases the quality of education''; and for subtle prejudice ''I believe in preserving traditional values, even if it means resisting changes that might benefit minority groups'' (in negative) or ''Recognizing the similarities between cultures can strengthen our connections and understanding'' (in positive).

Segmenting Attitudes Towards Migration
Attitudes to migration are not only driven by psychosocial factors; other individual or contextual circumstances can lead subjects to more pro-immigration attitudes (Dennison & Drazanova, 2018).There is a difference between early life socialization effects (such as education, having taken part in religious activities or having lived in a multicultural environment) and later life and contextual effects (such as living in a country with a restrictive migration policy, having family and children or being linked to determined political parties).So, bettereducated people who have gone to university, have been living abroad or enjoy white-collar jobs are more tolerant than worse-positioned ones (Hainmueller & Hiscox, 2007).People connected to right-wing parties, with numerous families and strong religious beliefs, tend to be more intolerant (Laythe et al., 2001).
Nonetheless, these socio-demographic classifications are not the only predictor of discriminatory postures; in fact, political-contextual factors have also been used to segment attitudes towards immigration.In this vein, Ceobanu and Escandell (2010) introduce a systemic approach, assessing macro, meso, and micro complementary predictors of attitudes towards immigrants.They also use the Intergroup Threat Theory to develop typologies that categorize individuals under varying levels of perceived economic, cultural, or political threats posed by immigrants.For their part, Reeskens and van Oorschot's (2012) research on migration deservingness within the welfare state differentiates between groups based on their views on the entitlement of immigrants to welfare resources, providing insights into how welfare considerations shape diverse attitudes toward migration.Green (2007) analyses attitudes in light of the degree of endorsement of countries' immigrant admission and expulsion standards.These studies offer, in turn, a comparative analysis among countries, allowing for the identification of shared typologies across diverse cultural and political contexts.
Recent research has also used the so-called ''attitudinal segmentation'' to map out population segments based on interlinked attitudes (Dempster & Hargrave, 2017).This approach has been used in the UK, where the Fear and Hope report series has segmented the public into different ''identity tribes'' since 2011.In the same vein, some social consultancy firms have used the same methodology to analyze attitudes on migration in Germany (IPSOS, 2018), France (More_in_Common, 2018), Italy (Dixon et al., 2019), The Netherlands (Dixon & Juan-Torres, 2018), and Greece (Dixon et al., 2019).In all the countries mentioned above arise at least three categories or segments: the ''Tolerant'' (i.e., multicultural groups that accept and enjoy diverse societies), the ''Traditionalists'' or ''Opponents'' (those nationalists that are against foreigners), and the ''Middle'' or ''Contradictory'' clusters (that include some elements of empathy and some others of rejection towards migrants and refugees).In most countries, the most significant part of the public appears to fall within a ''conflicted'' or ''anxious'' middle, showing the complexity of the formation process of attitudes towards immigration.
In Spain, this approach has been used by most researchers analyzing racist or xenophobic attitudes with similar results.Thus, between 2008 and 2014, Cea D'Ancona and Valle´s elaborated a typology in which Spaniards are divided into three groups based on their attitudes towards immigration: ''Tolerant' ', ''Ambivalent,'' and''Reluctant'' (Cea D'ancona &Valles Martı´nez, 2008-2014).In this same direction, some Spanish regional studies go as those conducted in the Basque Country-IKUSPEGI, the Basque Observatory for Racism and Xenophobia, uses the same categories for the years 2007 to 2021 (IKUSPEGI-Observatorio Vasco de Inmigracio´n, n.d.)-and in Andalusia (Junta de Andalucı´a, n.d.) in the studies carried out between 2005 and 2021 in the OPIA, the Andalusian Permanent Observatory of Attitudes on Migration.Recently, the Ferna´ndez et al. (2017Ferna´ndez et al. ( , 2018Ferna´ndez et al. ( , 2019) ) coined three categories at the national level: ''Multicultural'', ''Distant,'' and ''Distrustful''.Historically, the most tolerant position hardly gathers one-third of the interviewees.

Data
Although data from the survey have been available since 2007, this article only considers data from the last 3 years available (2015,2016,2017) as it is built on the methodology applied in the analyses developed by the Ferna´ndez et al. (2017Ferna´ndez et al. ( , 2018Ferna´ndez et al. ( , 2019) ) for these years-the surveys were aimed at the Spanish population aged 18 and over, residents in the country.The samples comprised 2, 470, 2,460, and 2,455 people, respectively, in 2015, 2016, and 2017.The interviewees were randomly selected from 46 provinces and 255 municipalities.
Scholars such as Cea D'Ancona (2009), De Rafael andPrados (2017), andDı´ez Nicola´s (2009) have shown the difficulty in measuring the underlying attitudes towards migration through the use of surveys, as (1) the respondents' attitudes to a complex issue are oversimplified, and the ability of respondents to express nuances is limited; (2) social desirability seems to affect the responses, distancing them from the actual attitude; (3) the questions on behavior, not on attitude, show a pronounced gap between attitude and behavior; and (4) the traditional indicators used serve more to capture the ''manifest'' than the ''latent''.
In this vein, extensive research (Aguilar & Castellano, 2016;Cea D'Ancona, 2009) has highlighted the importance of producing indicators to detect racist or xenophobic attitudes precisely.Especially relevant are those indicators aimed at measuring the most subtle forms of discrimination: symbolic racism, aversive racism, and subtle prejudice.Although the questionnaire utilized in the analysis does not technically measure any of the constructs used in this paper (i.e., it does not include the original, validated scales used to measure aversive racism, symbolic racism, prejudice, or xenophobia), it does include, systematically over many years, questions adapted from these original scales that measure subtle forms of bias.
Additionally, the stability of attitudes towards immigration over time has been proven by using different panel surveys and various methodological approaches for accounting for measurement error (Kustov et al., 2021).So, surveys of representative samples provide a general understanding of the natives' views on immigration and immigrants and become especially useful when comparing data over time.

The Groups and the Variables Used in the Algorithm
The Groups.In the analyses produced by Ferna´ndez et al. (2017Ferna´ndez et al. ( , 2018Ferna´ndez et al. ( , 2019)), the cluster technique reveals three profiles: Multicultural, Distant, and Distrustful, representing an unbalanced data set.
Table 1 shows the original three categories and the two new groups.The Annex can be consulted for mapping these original profiles.
Although adequate validation must support any clustering approach, ML algorithms can automatically explore relationships between variables without requiring detailed hypothesis specifications.This facilitates the identification of emerging patterns without predefined biases.In this regard, a strategic decision was made to address this imbalance following the approach suggested by Chawla et al. (2002).Consequently, to simplify the analysis, the three identified profiles have been consolidated into two overarching groups: Multicultural and Non-multicultural.The Non-Multicultural group, encompassing individuals characterized as less tolerant, specifically, those falling within the Distant and Distrustful profiles, serves as a collective category representing individuals with attitudes less inclined towards multiculturalism.This group may express reservations or skepticism towards immigration.The decision to consolidate these profiles into the Non-multicultural category allows for a simplified yet meaningful categorization, providing a clearer understanding of the dynamics between more and less inclusive attitudes in the context of migration.
In contrast, the Multicultural group comprises respondents with higher self-confidence, self-assurance, and more open attitudes towards immigration.These respondents typically exhibit a positive attitude towards cultural diversity and may support policies promoting inclusivity.This grouping strategy aims to streamline the analysis while retaining meaningful distinctions, ultimately enhancing the clarity and interpretability of the findings in the context of attitudes towards migration.
Contrasting the more tolerant (Multicultural) group's attitudes with those of the less tolerant group allows us to identify which attitudes endure over time and differentiate the two groups.These groups are permeable, and their knowledge allows for a deeper understanding of attitudes towards migration, making it possible to design more specific and better-focused social cohesion policies.Multicultural amounted to 29% in 2015, 55% in 2016, and dropped to 20% in 2017.This way, a ''back and forth'' evolution in the profiles describing attitudes towards immigration can be observed.Between 2015 and 2016, a leakage of more intolerant attitudes towards the multicultural group was detected; on the contrary, comparing 2017 with 2016, the transfer to more intolerant attitudes (Multicultural to Distant and Distant to Distrustful) occurs.This move implies that groups receiving members from other categories inherit the socio-demographic and attitudinal characteristics of the new individuals who join them, except for the remaining Multicultural group, whose original features persist.For this reason, when analyzing the evolution of the variables that explain the attitudes of Spaniards towards immigration (i.e., the latency of stereotype, racism, and xenophobia over time), we have considered it appropriate to divide the sample between the ''pure multiculturalists'' and the rest.
We would also like to point out that in 2016, the questionnaire was passed at Christmas.It is scientifically proven that people are more predisposed to express good wishes at that time of the year, and therefore, there is a bias towards positive answers (Hougaard et al., 2015).Furthermore, these (better) results for the year 2016, in comparison to 2015 and 2017, are in line with those obtained in Spain at the regional level (in Andalusia or the Basque Country) in surveys conducted at other times of the year.
The Variables.The questionnaire collects 61 items about attitudes and perceptions about immigration through 31 related topics (Ferna´ndez et al., 2017(Ferna´ndez et al., , 2018(Ferna´ndez et al., , 2019) ) (see Table 1).The variables are qualitative nominal or ordinal and quantitative interval variables with a Likert scale from 0 to 10.
It is worth noticing that the level of measurement for conceptual constructs is generally considered ordinal.The indicators are a part of abstract psychological constructs representing social attitudes and beliefs.Although the scales used to measure these variables may have ordered categories, the distance or difference between these categories can be subjective and not necessarily uniform.

Hybrid Wrapper Algorithm to Analyze the Importance of Variables
The analysis of explanatory variables by applying machine learning (ML) tools is typical in data analysis.We could define ML as a class of flexible algorithmic and statistical techniques for prediction and dimension reduction capable of extracting knowledge from data, automatically detecting patterns in data (Murphy, 2012), and continuously improving their capabilities by learning from experience (i.e., from data accumulating over time).
The efficiency of a predictive model is directly related to how explanatory its variables are and the minimum absence of noise present in the sample.As pointed out by Guyon and Eliseff (2003), there are filtering methods (Sa´nchez-Maron˜o et al., 2007), variable selection methods based on regularization and model penalization for complexity (Pereira et al., 2016), and wrapper methods (Hastie et al., 2021;Kohavi & John, 1997).The latter has been the basis of the algorithm presented in this article for selecting explanatory variables.This variable selection is carried out by comparing the predictive ability of a model trained with different data sets.For each variable considered most relevant, a value indicating its true explanatory character is obtained independently of its correlation with the rest of the variables.In real-world datasets, relationships can be highly complex and nonlinear.ML models can better adapt to these complexities, leading to more accurate and robust representations of the underlying data structure.ML models are often better suited to handle high-dimensional data where the number of variables is large.Classical factor analysis can become computationally demanding and less reliable as the number of variables increases.
Furthermore, ML techniques can automatically learn meaningful features from the data through the training process.In classical factor analysis, the features or latent factors are typically predefined or specified by the analyst, which might not always capture the most informative representations of the data.In addition, ML models, particularly ensemble methods like Random Forests, are generally more robust to outliers and noisy data than classical regression models.Then, the ability to automatically learn features, scalability to big data and adaptability to various data types make ML techniques a powerful choice for a wide range of data analysis and modelling tasks.However, it is essential to consider the data's specific characteristics and the analysis's goals when selecting the appropriate approach.
The open-source code required to replicate all analyses in this article is available at Ferna´ndez et al. (2023).

Results
The predictive model that has been carried out is displayed in Table 2.The table identifies the most relevant explanatory variables of attitudes towards immigration and provides a value of the importance (weight) of how explanatory a variable is and the evolution of each variable over time (the model is provided for 3 years).In addition, the table also details the percentage of those in the Multicultural group that answered the questions ''correctly'' (i.e., showed tolerant attitudes).The difference up to 100% corresponds to the responses of the Non-Multicultural group.
The model can be analyzed from a dual perspective: on the one hand, the explanatory variables and their weights (static perspective); on the other hand, the evolution of attitudes over time for the two groups (dynamic perspective).
In Ferna´ndez et al. (2017Ferna´ndez et al. ( , 2018Ferna´ndez et al. ( , 2019)), the dimensions that measure the more or less tolerant attitudes of respondents are maintained over time and are (1) Competition for scarce resources, (2) Personal relations with immigrants and Roma, (3) Empathy with disadvantaged groups, (4) Desirable immigrants, and (5) Public externalization of racist or xenophobic attitudes towards immigration.We found that 38% of the variables related to dimension (1) coincide with those identified in this article with aversive racism.Regarding dimension (3), 80% of these variables coincide with those related to symbolic racism in this study.The variables representing subtle prejudice in the present article correspond to 75% of the variables identified in dimension (4), and 26.6% of the variables in dimension (2) are present in our Xenophobia due to the coexistence dimension.Finally, 75% of the variables in dimension (5) are present in Xenophobia by public attitudes of this article.

The Statics: Explaining the Predictors of Attitudes to Immigration
Every item (every question) in our model is associated with a specific questionnaire topic and, in turn, to an explanatory dimension of discriminatory attitudes: aversive racism, symbolic racism, subtle prejudice, and xenophobia.Table 2 summarizes the weights produced by the algorithm for each item analyzed.
The following items describe the dimension of aversive racism: Topic 9 (Access to healthcare) is related to the perception of abuse of free healthcare by migrants (P14_2) and that Spaniards should have a preference when accessing healthcare (P14_3).That is, with their perception of misuse of access to health care by immigrants and their opinion that it should be a priority right for natives about immigrants, giving rise to the idea of abuse of resources that do not correspond to them.Topic 10 (Access to education) is related to the perception that more school grants are given to immigrants than to Spaniards, although the former have the same income (P15_4).That is the perception of an imbalance in access to educational resources favoring immigrants and disadvantaging Spaniards.Finally, topic 16 is related to preferences to hire a Spaniard rather than an immigrant (P22_1), to people protesting against the building of a mosque in their neighborhood (P22_3), to expel from the country legally settled immigrants who have committed a crime (P22_4).These characteristics indicate that the immigrant is seen as an abusive recipient and debtor of labor, educational and state resources.The migrant is conceived as a resource that should be expelled from the country when it is no longer profitable because it is not producing enough or requires too much effort from the public sector.
Symbolic racism is described by topics 1 and 15.
Topic 1 relates to the perception of the quality of state protection provided to older adults living alone (P1_1), pensioners (P1_2), and the unemployed (P1_3).That is, how the state is protecting disadvantaged groups who are not immigrants.Topic 15 deals with the perception that immigrants do jobs that Spaniards do not want to do (P21_1).Therefore, if migrants do not occupy these jobs, they would not be occupied by anyone; therefore, they are necessary.
The subtle prejudice dimension consists of only one topic, 4 (Important aspects of the foreign population valued by nationals), the presence or absence of characteristics considered by Spaniards'''appropriate'' for good coexistence.These characteristics are the following: (P5_1) high level of education; (P5_2) close relatives living here; (P5_3) speaking Spanish; (P5_5) being white; (P5_7) being skilled enough to fit Spanish labor market needs; and (P5_8) be willing to adopt the country's way of life.The dimension of xenophobia by the public expression of opinion includes topics 25 and 26.Topic 25 relates to the idea that the justice system should punish people who utter xenophobic or racist insults in public (P32) or publicly express opinions inciting xenophobia or racism (P33).Topic 26 relates to the perceived degree of acceptance of a political party with a racist or xenophobic ideology (P34).
The xenophobia/coexistence dimension is represented by Topic 18, Tolerance to relations with immigrants, that is, the degree of acceptance or rejection of (P24_1) living in the same neighborhood where many immigrants live; (P24_2) living the same block where immigrants live; (P24_4) working/studying with immigrants); and (P24_5) having an immigrant as a boss at work.In other words, variables related to interacting with immigrants personally or at work.
The personal dimension corresponds to topic 31 (Personal, social or demographic characteristics.These variables are the self-definition of the individual economic situation (P51), the social class of belonging (P52), and the current/last job (P56).

The Dynamics: Different Groups and Evolving Attitudes
Graph 1 shows the internal composition of attitudes towards migration during the 3 years according to weights.Elements of racism and problems of coexistence persist, although different behaviors are detected between Multicultural and Non-multicultural groups.All values are provided in Table 2.

The Competition for Scarce Resources: Elements of Latent and Symbolic Racism
Latent Racism.The feeling that immigrants compete for scarce resources is maintained for 3 years and explains about 20% of the attitudes towards migration.
The variables with greater explanatory power refer to access to the public health system, either the possibility of preferential access for Spaniards or immigrants' abuse of the system.In this respect, the Multicultural group turns out to be more tolerant towards the distribution of resources (in fact, this group represents between 25% and 41% of extreme positions of rejection).The highest percentages (from 75% to 59%) of rejection are represented by Non-Multicultural.
Concerning the aid/resources received by immigrants-in 2015 and 2016 (school aid), and 2017 (aid in general)-lower percentages of the Multicultural group think that migrants receive more than Spaniards (36% and 46% are multicultural respectively vs. 64% and 54% non-multicultural) or receive more than they contribute (21% of multicultural vs. 79% non-multicultural).In 2017, also in the area of resources-concretely regarding the construction of a mosque in their neighborhood-the Multicultural showed themselves to be much more tolerant (only 28% of Multicultural would oppose it, compared to 72% of the Non-Multicultural) Another source of differences lies in considering migrants as ''free riders'' (if they are unemployed, they should be fired): in 2015, 42% of those who agreed with this statement were Multicultural (so 58% were Non-Multicultural).In 2016 and 2017, these variables were not significant.
Finally, two aversive variables appeared in 2016 that show a rapprochement between both groups: Among those who defend a ''reserve'' of jobs for Spaniards, 46% are Multicultural, and 54% are Non-Multicultural (although it is true that, among those who disagree with this position, 68% are Multicultural).Regarding immigrants who commit crimes, most of those who consider it acceptable to expel them from the country, 52%, are Multicultural.
Symbolic racism explains 38% of attitudes in 2015, disappeared in 2016, and emerged in 2017, explaining 11% of that year's perspectives.
Modern racism is characterized by greater empathy for disadvantaged groups other than immigrants.For this reason, one way to make this type of racism emerge would be to consider that these groups do not have aid, compared to the many aids that foreigners enjoy.
In any case, for the years where these variables are relevant, most of those who consider that other disadvantaged groups are not mistreated compared to immigrants belong to the Multicultural group: only 30% of those think immigrants to be positively discriminated against other unfavored groups are Multicultural.

The Problems of Coexistence: Xenophobia and Subtle Prejudice
The Subtle Prejudice.As commented before, in 2017, subtle prejudice substitutes those variables representative of xenophobia in explaining attitudes towards migration.
This dimension measures respondents' importance to their values and preferences when they feel comfortable with people from other cultures or countries.
The questions that most concern the respondents are (in this order): (1) the need for foreigners to adapt to our lifestyle; (2) whether they have a job qualification appropriate to the needs of our labor market; and (3) whether they have a high educational level.In these three cases, the concern is much less for the Multicultural: less than a third of the people who consider these variables necessary belong to the Multicultural group.
Xenophobic Attitudes.In 2015, no explanatory variables referred to xenophobic attitudes.They skyrocketed for Multicultural in 2016 (explaining 73% of the total) and by far from Non-Multicultural.Multicultural became very radical in not supporting racist attitudes in 2016.Source.Own elaboration (data extracted from Table 2).
Although this category hardly presents 6% of the total attitudes in 2017, it should be pointed out that for this year, only 20% of Multicultural are openly in favor of punishing racist attitudes.
Xenophobia in Coexistence.Questions related to xenophobia in coexistence only appeared in 2015 and 2016.In 2017, this variable disappeared, giving way to the emergence of subtle prejudice.
In 2015, the variables of coexistence in the neighborhood or work presented worse values for Multicultural than Non-Multicultural.Remarkably, only 25% of those who would accept living in areas with a high percentage of immigrants or have foreign work colleagues are Multicultural.In 2016, however, 62% of those who agreed to work with migrants or have an immigrant boss were Multicultural.It should be noted that Multicultural drastically changed their attitudes, referring to xenophobia between 2015 and 2016.
This fact has already been explained: in 2016, the Multicultural group seemed to borrow several membersand features-from the other categories, so adopting the patterns of their behavior.As, paradoxically, those from the Non-Multicultural group traditionally show better acceptance for migrants when interacting in the neighborhood, the better score obtained by Multicultural on this variable in 2016 may come from the Non-Multicultural who slipped into this category that year.

Personal Features
Multicultural respondents belong to higher-skilled professions (58% of directors, health professionals, and university teachers).They also have a better self-perception of their economic situation (58% of those who define it as good or very good are Multicultural) and a lower awareness of belonging to a particular social class (in all the possible self-perceptions of social classes, around one-third of the members were Multicultural).

Conclusions and Discussion
In this work, using ML techniques, we have proposed a predictive model through a sophisticated algorithm that identifies explanatory variables for the attitudes towards migration among different groups (Multicultural and Non-Multicultural) and provides a value of importance on how explanatory a variable is.This provides a deeper understanding of which factors have a more significant impact on attitudes towards migration.Moreover, it traces these variables' evolution over three different years, providing a dynamic perspective.Then, this algorithm enables a more automated and detailed analysis beyond traditional approaches since the primary goal of ML is to allow computers to learn from data and improve their performance over time.
In this regard, ML techniques are currently used in weather or traffic prediction (Mueler, 2001), anti-spam detection (Subramaniam et al., 2010), DNA sequence classification (Stranneheim et al., 2010); keyboard autocorrection (Turner et al., 2017) or autonomous vehicles or robots (Zhou et al., 2020).In social sciences, the interest in prediction has led researchers to stop using substantially complex models and opt for more classical techniques, such as traditional and generalized linear models.However, the use of ML can provide much better predictive performance (Grimmer et al., 2021), as demonstrated by its application in political science (Kaufman et al., 2019;Montgomery & Olivella, 2018), in the analysis of consumer behavior, or the identification of potential customers (Choudhury & Nur, 2019).
Unlike classical statistical methods, which generally present problems with very unbalanced samples, the methods used here allow the precise analysis of groups that are very different in size and with good properties.This type of analysis is robust and suitable for studying nationals' attitudes towards migration.This is a complex, dynamic, living and changing phenomenon, and a sign of this is the permeability of the profiles that embody it.Although three profiles were previously identified, the analysis of the Multicultural ones as opposed to the rest makes it possible to deepen our understanding of this profile and design policies that allow for more open stances towards migration.The intermediate profile (which exists in all the countries, as demonstrated in the theoretical background section of this article, and that we have linked to the least tolerant) is affected in the different countries by their cultural environment, which means that it differs from country to country.The considerable size of this group would not have made the analyses feasible due to the large number of observations we would have had to give up.
In this sense, by applying these techniques to attitudes towards migration, we sought to answer two research questions: (1) What variables persist in attitudes towards migration over time?Moreover, (2) What are the distinctive variables between different attitudinal segments?
Recent studies and empirical developments on attitudes towards migration suggest that such attitudes remain persistent and do not change even during economic or political crises.Furthermore, attitudes towards migration would remain more stable than other economic and social attitudes, such as party identification (Kustov et al., 2021).Further analyses in the European arena have corroborated this fact.Though attitudes in some countries have shown small shifts in a more positive direction, the overall pattern in public attitudes remains stable (Drazˇanova´, 2022;Heath et al., 2016).
The tendency in Spain tepidly seems to be the inverse: so, the empirical studies about the evolution of racism and xenophobia in Spain conducted since 2007 (Ferna´ndez et al., 2017(Ferna´ndez et al., , 2018(Ferna´ndez et al., , 2019;;Cea D'ancona & Valles Martı´nez, 2008-2014;IKUSPEGI-Observatorio Vasco de Inmigracio´n, n.d.;Junta de Andalucı´a, n.d.) show that between 2008 and 2022 attitudes towards acceptance of diversity and tolerance towards the number of immigrants present in the country improved markedly.
That said, volatility has proven to be a common thread among profiles, as demonstrated by Cea D'ancona and Valles Martı´nez (2014) in their study about attitudes towards migration in Spain.The authors analyze the evolution of the three attitudinal profiles between 1993 and 2014, where a maximum of 45% tolerants in 2001 and a minimum of 24% in 2004 can be observed.The series starts in 1993 with 32% tolerants and end in 2014 with 35%.
The evolution of attitudinal profiles remains dynamic, shaped by ongoing economic conditions, political discourse, and efforts to balance maintaining national identity and embracing the diversity that immigration brings.Before 2015, rejection of immigration remained high at times of significant economic growth (especially between 2004 and 2007).This may have been due to the rapid growth in the number of immigrants, which increased the perception of threat.On the other hand, a low representation of the tolerant group was also perceived in 2010 and 2011, which is attributed to the influence of elections on the radicalization of discourses towards immigration.
Regarding the 3 years analyzed in this article, the refugee crisis in Europe, especially from 2015 onwards, sparked discussions about asylum policies and refugee reception and unquestionably influenced attitudes toward migration in Spain, although to a lesser extent than in some other European countries.Furthermore, this period includes general elections in Spain (in December 2015 and June 2016), which led to changes in administration and policies related to immigration.In addition, discussions on national and regional identity, particularly in Catalonia, were prominent during those years, and these debates could have also impacted the shifts among attitudinal profiles.
Nevertheless, some harmful elements persist over time.Concretely, it could be said that aversive racism (unconsciously discriminating on factors other than race and connected to the competition for scarce resources) remains an explanatory variable in the three-year analysis period.Compassion towards less favored social groups other than immigrants manifests itself in the post-crisis environment, disappears in 2016 and reemerges in 2017, although with less force.Finally, xenophobia (in both senses, coexistence and reaction to racist attitudes) gives way to subtle prejudice (in other words, the need for foreigners to adapt to our lifestyle).
The prevalence of elements of aversive racism and subtle prejudice-that is, as a threat of cultural or material nature-turn out to be the best predictors in our study, in line with the most recent empirical developments (Cidalia, 2021;Gualda et al., 2021;Moldes-Anaya et al., 2018).It is worth noting, nevertheless, that migrants and refugees turned out to be less valued in the peak moments of the crisis, so it could be inferred that the non-acceptance of immigration was based more on economic grounds than on racist or xenophobic aspects (Rinken, 2021) As stated by Shershneva and Fouassier (2022).However, people are generally tolerant; ''situational xenophobia'' arises when the local population competes with foreigners for the same spaces in the social structure.Likewise, self-perceived vulnerability magnifies the threat of immigrants competing for scarce resources.
Regarding the second research question, existing differences among groups, in general, the Multicultural show better behavior than the Non-Multicultural: regarding the aversive behavior, Multicultural are more tolerant towards the distribution of resources of the welfare state.In the symbolic approach, Multicultural tend to equate migrants to a greater extent with other disadvantaged groups.Finally, regarding subtle prejudice, this group is more prepared to accept different lifestyles or qualifications than society expects or requires.This aligns with literature findings showing how more open, secure and attached people are more inclined to get people from different social or racial backgrounds (Mikulincer & Shaver, 2021;Wolf et al., 2019).
There are, however, two positions in which Multicultural behave worse than No Multicultural: Firstly, in the labor market approach: they have reserves to accept migrants in the labor market, or they would perceive migrants as labor competitors.Moreover, secondly, in the coexistence chapter (only 25% of Multicultural would accept living in the same neighborhood or working with migrants).This can be explained through the ''warmth vs. competence'' binomial (Reyna et al., 2013).Hybrid and ambivalent attitudes, apparently willing to compassionate migrants from poorer countries but to show attitudes related to their suitability for our labor market, have been highlighted by the literature (Bansak et al., 2016;De Coninck & Matthijs, 2020;Gualda et al., 2021;Rinken, 2015Rinken, , 2021)).
Finally, the relevant personal variables included in our algorithm have mainly to do with self-perception.In this sense, Multicultural are more optimistic, being more present in percentage terms among those who perceive themselves well economically and relativizing their self-perception of class.In professional preparation, Multicultural are more present in more skilled or technical jobs.These attributes have systematically been related to higher tolerance levels (Gonza´lez Estepa et al., 2021;Heath & Richards, 2020;IKUSPEGI-Observatorio Vasco de Inmigracio´n, n.d.).
In summary, justifying the incorporation of ML techniques, this paper has demonstrated the power of these advanced analytical tools to handle non-linear relationships and identify intricate patterns within large datasets within the complex landscape of attitudes towards migration.The enhanced results obtained from the ML application to the temporal evolution of attitudes towards migration can be crucial for developing more informed and effective social cohesion policies.

Opportunities for Future Research
Despite the underlying and unavoidable social desirability bias (Rinken, 2021), it could be affirmed that a positive evolution of attitudes towards migration can be observed in Spain.Migrants are perceived as a complementary labor force and awaken the solidarity of the native population.However, aversive racism underlies over time as the common denominator of the three periods analyzed.In line with other recent empirical research in Spain, these findings allow us to call for some ''political pedagogy'' to avoid imbalances in future social cohesion (Rinken, 2021).
Moreover, the existence of different ''attitudinal'' groups that hold ambiguous and sometimes conflicting views towards migration could help the media, civil society organizations and policymakers to identify particular perceptions towards migration and to produce narratives, discourses and conceptualizations that are closer and friendlier to the perceptions of the native population (Juan-Torres, 2019) and more focused and adapted to the different segments that make up the host community (Dempster et al., 2020).
Finally, it would be of great interest to analyze attitudes towards immigration through other holistic methodologies, such as the one developed by Dennison and Drazanova (2018).This methodology describes in an integrated but sequential way the attitude formation process towards migrants, taking into account the most distant triggers, such as the subject's personality, to the closest ones, such as coexistence or competition for work.

Policy Implications
In 2020, the Spanish Ministry of Social Security and Migration started elaborating the ''Strategic Framework for Citizenship and Inclusion; against Racism and Xenophobia, 2021-2027'' to update the ''Comprehensive Strategy against Racism, Racial Discrimination, Xenophobia, and Related Intolerance'' (Government of Spain, 2011a) and the Strategic Plans for Citizenship andIntegration (Government of Spain, 2008, 2011b).The strategic framework aims to adapt them to the changing migratory situation and to incorporate the recommended actions made to Spain by international and European organizations about the integration of immigrants and asylum seekers, the prevention of racism, racial discrimination, xenophobia, and other related forms of intolerance (Government of Spain, 2022).The EU Action Plan against Racism (2020-2025); the New EU Cohesion Policy 2021 to 2027; the Action Plan on Integration and Inclusion for 2021 to 2027; and the Pact on Migration and Asylum (September 2020) and the Global Compact on Migration (2018) must be highlighted here.
The block of policies against xenophobia, racism and intolerance, approached cross-cuttingly, includes mechanisms for monitoring, prevention, detection and elimination of xenophobia, racism and intolerance; training and awareness-raising actions; and work with the media, the internet and social networks.
The findings obtained in this article (i.e., the persistence of elements of aversive racism, considering that migrants are competing against nationals for public services) will help the public administration optimize these measures.Furthermore, knowing the contradictory reactions of the different segments that conform to the native population could be a powerful tool to design programs to shift attitudes and values towards immigration.
Public interventions against aversive racism may include targeted initiatives such as anti-bias training for professionals in critical sectors (law, healthcare, and education), community dialogues to foster understanding, media literacy campaigns to challenge stereotypes, and workplace diversity and inclusion programs.As for the ambivalence of society regarding migration, our suggestion is the promotion of public programs that create opportunities for positive interactions, dispelling myths and highlighting the tangible benefits of a diverse and inclusive society.

Limitations
The analysis presented in this study builds on work and methodology previously developed by the research team writing this article in 2015, 2016, and 2017.Although the CIS survey has been published since 2007, other authors carried out its analysis using different methodological approaches.Applying the algorithm developed in this paper to the complete time series would have entailed a workload that the authors do not have the financial and human resources to tackle.
The lack of up-to-date national-level survey data on attitudes towards migration is connected to this.The latest year available is 2017, and a lot has happened since then, including a pandemic in 2020, the ultimate consequences of which cannot yet be known.When more up-to-date data become available, it will be exciting to use this methodology again to learn about new developments in attitudes towards migration over a longer time horizon.
Another limitation is the difficulty in measuring xenophobia and racism through surveys and the inexistence of specific constructs for measuring attitudes towards migration, as pointed out in the methodology section.
We have also thoroughly examined any demographic skew that might exist within our sample.In this regard, our survey respondents predominantly comprised individuals with higher educational backgrounds.This could potentially introduce a bias towards more educated perspectives on immigration attitudes.Our study sample might be subject to certain limitations, such as the overrepresentation of urban residents and the potential underrepresentation of rural populations.This could influence the generalizability of our findings to a broader demographic.In addition, respondents might be affected by the context in which the survey was administered.
In addition, while ML techniques offer powerful predictive capabilities, their lack of interpretability can be a limitation, especially in domains like social sciences.When dealing with sensitive issues such as immigration and public anti-racism strategy, it is crucial to invest in data quality and preprocessing to mitigate biases in the training data and conduct fairness-aware evaluations to ensure the model's outputs do not disproportionately impact any racial or ethnic group.
Finally, the algorithm used is derived mainly from the number of computational resources it consumes when studying the explanatory nature of numerous variables.However, this hybrid wrapper algorithm has been chosen due to its limited sensitivity to the correlation between variables.

Annex: Original Profiles and Their Dimensions
As stated in Table 3, the original profiles were grouped under five dimensions: (1) Competition for scarce resources, (2) Personal relations with immigrants and Roma, (3) Empathy with disadvantaged groups, (4) Desirable immigrants, and (5) Public externalization of racist or xenophobic attitudes towards immigration.We found that 38% of the variables related to dimension (1) coincide with those identified in this article with aversive racism.Regarding dimension (3), 80% of these variables coincide with those related to symbolic racism in this study.The variables representing subtle prejudice in the present article correspond to 75% of the variables identified in dimension (4), and 26.6% of the variables in dimension (2) are current in our xenophobia due to the coexistence dimension.Finally, 75% of the variables in dimension ( 5) are present in xenophobia by public attitudes of this article.
Table 4 shows the factors and dimensions of each profile.In cases where the responses to the factors show negative attitudes towards immigration, the corresponding box is marked in grey with a negative sign.Conversely, if the attitude towards that factor implies a positive predisposition towards immigration, a positive sign and no color appear in the corresponding box.The number of signs means the intensity of the response.Thus, a single positive sign indicates low intensity, two imply medium intensity, and three indicate high intensity.
Attitudes towards discrimination over time.

Table 2 .
Relationship Between the Topics and Items of the Questionnaire on Attitudes Towards Immigration.

Table 3 .
Attitudes Towards Immigrants: Weights for the Different Variables and Multicultural Behavior.
Source.Attitudes towards migration Questionnaire and own elaboration.

Table 4 .
Dimensions and Scores of the Factors Describing Racism and Xenophobia in Each of the Three Proposed Profiles(Distrustful, Distant, and Multicultural) in 2015, 2016, and 2017.