The effect of early automation on the wage distribution with endogenous occupational choices

While the literature demonstrated that automation reduces employment in routine jobs (job polarization), its impact on wages is still unclear and the debate open. By applying Counterfactual Quantile Regressions to historical data, this paper analyzes the channels through which automation affected wage inequality in the U.S. labor market during the 1990s. Contrary to conventional wisdom, we find that the observed decline in wage inequality among low earners was not due to lower prices paid for technology-substitute occupational tasks, but instead due to more homogeneous wages of workers performing these tasks. This evidence is consistent with a model of directed (routine-biased) technical change in which skill-heterogeneous workers face endogenous occupational choices and learning costs in connection with operating new technology. In this model, directed technical change reduces wage inequality among low earners by shrinking the skill distribution of routine workers, thus making their wages more homogenous as observed in data.


Introduction
During the postwar period, wage inequality in the U.S. remained relatively stable until the end of the 1970s, when it began to rise noticeably. [See (Juhn et al., 1993) for wage inequality during the 1980s, (Acemoglu, 2002) and (Lemieux, 2006) during the 1990s, and (Acemoglu & Autor, 2011) during the 2000s.] This evidence stimulated a substantial debate on the concurrent causes that might have led to such an increase, including institutional factors such as declining minimum wages and de-unionization [ (Freeman & Katz, 1995), (DiNardo et al., 1996)], greater commercial openness and trade [Acemoglu (2003)], and technological progress biased toward skilled employment [(Juhn et al., 1993)]. 1 Although the latter became the mainstream explanation in the literature, several empirical studies questioned its role as the key determinant of wage inequality by highlighting several aspects of labor market data that appear inconsistent with the theory or that the theory is unable to rationalize. [Freeman and Katz (1995), DiNardo et al. (1996), Buchinsky (1998), Piketty and Saez (2003), Lemieux (2006).] In response to previous criticism, a more nuanced version of skill-biased technical change has been proposed to reappraise the relationship between technology and the labor market. By studying the effects of computers, ICT (Information and Communication Technologies), and automated machines on business practice, (Autor et al., 2003)argued that technical change is not generally biased toward any skill but rather is complementary, i.e. directed, to some skills and substitute to others. In particular, technical change creates a comparative advantage for skills complementary to technology (e.g. cognitive skills) with respect to skills substitute to technology (e.g. routine skills), eventually increasing the price of occupational tasks performed with former skills versus those performed with the latter skills. 2 Later, (Atalay et al., 2018) confirmed that the arrival of ICT in business practice shifted workers away from routine tasks, given that ICT technologies were associated with an increase in nonroutine analytic tasks and a decrease in routine cognitive and routine manual tasks. (Caines et al., 2017)built an index of complex tasks that better captured the degree of substitutability between human labor and automated machines. Conditional on their refined indicator, they established some empirical facts for the U.S. 1 Skill-biased technical change is intended as the effects of continuously growing technological progress-such as that generated by computers, ICT, and electronically controlled machines-on the demand for skilled workers who are capable of operating such new technologies. By stimulating the demand for skilled labor, technical change increases skilled workers' wages with respect to unskilled workers (the skill premium), thus pushing wage inequality upward. Technical change has been shown to be biased toward skills by Bound and Johnson (1992), Katz and Murphy (1992), Levy and Murnane (1992), Krueger (1993), Berman-Bound-Griliches (1994), among others. 2 For instance, in manufacturing plants robots replaced traditional "blue collar" workers, but enhanced the productivity of "white collar" officers in charge of the assembly lines. Thus, automation both destroys blue collar jobs and reduces their wages with respect to their white collar colleagues. In this literature, a task is defined as a unit of working activity that produces output, and a skill worker's ability to perform a designated task. See (Acemoglu & Autor, 2011) for a model with skills and tasks. These authors also provide an exhaustive analysis of the empirical facts regarding the labor market that the canonical skillbiased technical change model cannot explain, but that a task-based model can.

3
Economia Politica (2022) 39:  labor market over the 1980-2005 time period: (i) labor has reallocated from less complex to more complex occupations over time; (ii) within groups of occupations with similar task complexity, labor has reallocated to non-routine occupations over time; (iii) there is a positive relationship across occupations between task complexity and wages and wage growth.
A subsequent large body of literature tested the effect of routine-biased technical change in the U.S. labor market, showing that employment indeed increased in jobs mostly consisting in technology-complementary tasks and decreased in jobs mostly consisting of technology-substitute tasks [ (Acemoglu & Autor, 2011); (Goos et al., 2014)], (Autor & Dorn, 2013) also showed that employment and wages in technology-substitute occupations diminished not only relative to technology-complementary occupations, but also relative to technology-neutral occupations, i.e. those jobs performed with manual skills that cannot be replaced by machines. Eventually, (Graetz & Michaels, 2018) and managed to relate directly the installation of automated capital in manufacturing plants (robots) with tasks displacement and reductions of employment in routine jobs.
Although the "job polarization" effect of automation achieved broad consensus in the literature, a similar hollowing-out effect on the wage distribution remained more controversial. By using systematic data from the U.S. labor market, (Autor et al., 2006(Autor et al., , 2008 showed that occupational tasks are not randomly distributed across the wage distribution, but occupations consisting mostly of technology-substitute tasks are typically placed in the middle echelon of the wage distribution, whereas occupations consisting mostly of technology-complementary tasks are typically placed in the upper echelon, and technology-neutral jobs in the bottom echelon. In addition, they found that composition-adjusted residual wage inequality increased above and diminished below the median wage during the 1990s. 3 These two pieces of evidence suggested that routine-biased technical change polarized the wage distribution, depressing the wages of middle-income technology-substitute workers while raising that of high-income technology-complementary workers. (Firpo et al., 2011) empirically confirmed the suggestive evidence of Autor et al. by directly estimating the overall effect of occupational tasks on the wage distribution using unconditional quantile regressions. However, by analyzing the evolution of wages in over 250 detailed occupations, (Mishel et al., 2013) questioned this evidence by showing that changes in wage differentials between technology-complementary and technologysubstitute occupations were too mild to regard automation as the key determinant of the observed growth in wage inequality. Similar findings were provided by Antonczyk et al. (2018) and Naticchioni et al. (2014), who found no evidence of wage 3 Residual wage inequality refers to inequality measured among the components of wages that are not explained by observable workers' characteristics. Similar evidence for unconditional wage inequality was first shown by Buchinsky (1998), Lemieux (2006) suggested that the observed increase in wage inequality during the 1990s was not due to increases in skill prices, but rather to changes in the composition of the labor force, i.e., the composition effect in his terminology. Eventually, (Autor et al., 2008)showed that the evidence on a non-monotone increase in wage inequality across the wage distribution was robust when controlling for changes in the composition of the labor force.
1 3 polarization in Germany and the EU, respectively, despite there being a clear pattern of job polarization in those labor markets. More recently, several papers argued theoretically in favor of a "hollowing-out" effect of automation on the wage distribution [(Berg et al., 2018), (Caselli & Alan, 2019), Osorio and Pinto (2020)], but conclusive empirical evidence are still lacking.
The contribution of this paper to previous literature is twofold. First, it provides a new perspective on the empirical relationship between automation and wage inequality in the U.S. labor market during the 1990s. It shows that automation has been the key determinant of the observed changes in wage inequality by affecting wage inequality within groups of homogeneous workers, whereas it had no appreciable effect on the wage differentials between workers performing technology-substitute tasks and workers performing other tasks on duty. These findings are in line with those reported by the aforementioned literature, but we improve upon it because we provide the mixed evidence within a unique empirical analysis. This allows us to identify the different mechanisms through which automation affected the prices of technology-substitute and technology-complementary tasks and, through these channels, inequality among low wages and high wages. Then, the second contribution of the paper is to rationalize the empirical evidence by providing a new theoretical formulation of the routinization hypothesis that adds to the labor demand channel usually conjectured in the literature [e.g. (Acemoglu & Restrepo, 2019) ] a novel channel based on the effect of automation on the labor supply.
The empirical analysis uses systemic data on the U.S. labor market to pursue a decomposition approach that first controls for changes in workers' observable characteristics, and then separately identifies the effects of variations in the prices of occupational tasks on: (i) changes in wage differentials between worker groups performing different tasks on duty (between-group price effect); (ii) changes in wage inequality within worker groups performing similar tasks on duty (within-group price effect). This decomposition is obtained by estimating the extension proposed by Autor et al. (2005) of Machado and Mata (2005) Counterfactual Quantile Regression [henceforth, CQR]. 4 Data on wages are collected using the May/ORG Census Samples database, supplemented by the fourth edition (1977) and the revised fourth edition (1991) of the U.S. Department of Labor's Dictionary of Occupational Titles. This database is used to estimate a set of CQR in which wage inequality is explained by workers' socioeconomic characteristics and tasks intensities performed on duty. According to our results, the decline in wage inequality experienced by workers placed below the 30th percentile is almost entirely explained by a reduction of wage dispersion within the group of workers performing routine tasks on duty. Both the composition effect and the between-group price effect only marginally affected wage inequality in this echelon of the wage distribution. By contrast, the variation in wage inequality among workers placed above the 60th percentile appear to be equally explained by positive between-group and within-group price effects, together with a strong contribution of the composition effect. Regarding the effects of automation, the estimation indicates that the large increase in the price of technology-complementary cognitive tasks has been the single most important driver of both the between-group and within-group price effects among high wages. On the contrary, the decrease in the price of technology-substitute routine tasks crucially determined the negative within-group price effect, but it was inconsequential on the betweengroup price effect which, in fact, had a negligible impact on wage inequality among low earners.
To explain the different effects of automation-related task prices on within-group and between-group wage inequality, in the last part of the paper we develop a taskbased model of automation in which workers' occupational choices are endogenous and respond to changes in task prices. Regarding the labor demand, we follow the literature assuming that routine-biased technical change pushes downward the relative price of technology-substitute tasks and upward that of technology-complementary tasks. Regarding the labor supply, we show that the response of income-maximizing workers to changes in task prices shifts their supply of labor in each task. After an increase in automation, the model argues that (i) labor demand and supply forces operate in the same and negative direction on technology-substitute employment, thus entailing a substantial loss of routine jobs, and (ii) the most skilled routine workers are willing to devote extra effort in obtaining now-better-paid technology-complementary occupations (upward migration), whereas less skilled workers are not able to catch up with learning new technology and prefer to switch to manual occupations (downward migration).
The first prediction shows that the model can replicate the "job-polarization" effect of automation, thus serving as model validation. The second prediction yields the key insights on the relationship between automation and wage inequality. In the lower half of the fitted earning distribution, inequality diminishes as in actual data. However, a reduction in routine workers' wages is not a necessary condition for this to occur because the migration of routine workers toward other jobs is sorted across the skill distribution. The group of surviving routine workers is more homogeneous in terms of skills, thus featuring a more equal distribution of wages (less inequality) even when routine tasks are paid the same price. The effect on cognitive labor is symmetric. In response to automation, the group of workers performing technology-complementary tasks becomes larger and more skill-heterogeneous. Hence, the upward migration pushes upward within-group wage inequality in the upper echelon of the fitted wage distribution.
Previous results can be related to the cited literature in the following way. In the empirical analysis, we find that variations in the prices of occupational tasks played a crucial role in determining the observed changes in wage inequality, as pointed out by Firpo et al. (2011) We qualify their results by showing that the price effect of occupational tasks operates on low-wage inequality and high-wage inequality through different channels. Variations in the prices of technology-complementary tasks enhanced wage inequality among high wages both between and within worker groups. Variations in the prices of technology-substitute tasks, instead, affected low wages inequality only within worker groups -i.e., workers with same education and experience and performing the same tasks on duty -, whereas it did not affect wage differentials between technology-substitute and technology-neutral workers, as already found by Mishel et al. (2013) Antonczyk et al. (2018), Naticchioni et al. (2014) Our results show that the reduction in wage inequality observed among low earners ( (Autor et al., 2008)) is entirely explained by a smaller wage dispersion within the group of workers performing routine tasks. Using a theoretical model, we rationalize this evidence by suggesting the existence of a sorted migration of routine workers towards other occupations. This relates our paper with (Groes et al., 2015), and (Cortes, 2016), who empirically supported the existence of a sorted migration of high-wage routine workers toward abstract jobs, and low-wage routine workers toward manual jobs. While (Groes et al., 2015) and Cortes focused on the effects of migration on the labor force composition, we argue that this mechanism is important also to explain changes in wage inequality within the group of cognitive workers. Finally, our results conform with the recent findings of Acemoglu et al. (2021), who document a decline in wage inequality for worker groups specialized in routine tasks in industries experiencing rapid automation. It should be noted that the additional channel based on the labor supply that our paper suggests is not an alternative, but rather complements the labor demand one on which is usually based the narrative on the effects of automation in the labor market.
As final remark, note that the theoretical framework developed in this paper is related to the literature on human capital, education/training, and technology. Although there is a large number of papers studying the effects of technical change on human capital and the labor supply, 5 few of them focus on the effects of automation on wages through occupational tasks. Acemoglu and Autor (2011), section 3) provides a tasks-based model in which routine-biased technical change affects both labor demand and labor supply. Our framework differs from that because agents in our model are heterogeneous in only one dimension, whereas Acemouglu and Autor's agents are heterogeneous in a multiplicity of skills, each suitable for a specific task. 6 (McIntosh & Steven, 2013) addresses the problem of understanding the effect of automation on the labor market as a demand and supply issue, but he acknowledges that there is not enough research in this direction. Hsieh et al. (2019) uses in a general-equilibrium context a model similar to our partial-equilibrium one to explain the allocation of talents over different occupations.
The remainder of the paper is organized as follows. Section 2.1 presents the data and Sect. 2.2 reports the results of the Counterfactual Quantile Regressions. Section 3 dwells on the insights of the empirical analysis regarding the effects of automation on wage inequality. To rationalize this evidence, Sect. 4 presents a model of the labor market in which workers are allowed to choose among technology-complementary, technology-substitute or technology-neutral occupations, each of which entails different learning costs. Then, Sect. 4.3 characterizes the effects of automation on the wage distribution and shows how they mimic the empirical evidence encountered in Sect. 3. Section 5 concludes.

Data
To analyze the U.S. wage distribution, we employ the database constructed by Autor et al. (2008), who combine two data sources commonly used in this literature. The first one is the annual collection of the March Issue of the Current Population Survey (CPS) supplemented by data from the May Issue and the Outgoing Rotation Group, which provides a measure of weekly wages for the entire distribution of hours worked included in CPS surveys for the years from 1986 to 2002. We refer to this source as May/ORG CPS. 7 The second source is the Fourth Edition (1977) and the Revised Fourth Edition (1991) of the U.S. Department of Labor's Dictionary of Occupational Titles [DOT]. Data from the May/ORG CPS are merged with the DOT to connect workers' occupations with their contents in terms of primary comparable occupational tasks. The resulting database provides a panel of observations at the worker level with information on worker's occupation, his/her weekly wage and the corresponding wage percentile, the tasks performed on duty, and several socioeconomic characteristics. The following empirical analysis is performed by using tasks intensities and workers' characteristics as regressors, and growth rates of wage gaps as dependent variables. 8 Following (Autor et al., 2003), we aggregate the original 44 tasks defined in the DOT into the following five groups of tasks: (1) EYEHAND, which is the ability to move hands and feet in coordination with the other senses, notably sight. These tasks are usually defined as manual in the literature; (2) FINGDEX, which is finger dexterity. This group evaluates the ability to do something manual with skill and speed and consists of what are typically defined as routine tasks; (3) STS, which 1 3 is the ability to set limits, tolerances, or standards for any production process and consists mainly of routine tasks; (4) DCP, which is the ability to undertake direction, control and planning -and involves one's attitude toward accepting responsibility -for supervising and planning activities. These tasks are typically defined as cognitive in nature; (5) MATH, which refers to general education, analytical and mathematical skills and the ability to engage in problem solving. This group contains the most typical cognitive tasks. 9 We adopt the five-group classification originally used in Autor et al. (2003) instead of a three-group classification -manual, routine, and cognitive -used in more recent literature ( (Autor & Dorn, 2013)) because we find that the five-group classification is more effective in identifying the effect of task prices on wage inequality. In particular, we note that the price of STS evolves differently from that of FINGDEX, and using a routine meta-group that includes both groups would add noise to the data and obscure the results. The same occurs with DCP and MATH, which again suggests that one should avoid the construction of an aggregate cognitive group in favor of a more detailed classification.
In the following sections, we take as given some established facts about the effects of automation on task groups. Our assumptions are based on a large literature on routine-biased technical change and its role in replacing occupational tasks previously performed by human labor. In particular, (Autor et al., 2003) and (Acemoglu & Autor, 2011) explained that automation in the labor market typically replaces human labor with capital in routine tasks and complements human labor in cognitive tasks. Atalay et al. (2018) showed that new IT technologies are in fact associated with an increase in nonroutine analytic tasks (group 5) and a decrease in nonroutine interactive, routine cognitive, and routine manual tasks (groups 2,3,4). Gallipoli and Makridis (2018) showed how employment share in IT intensive occupations increased and their productivity enhanced, thus providing evidence in favor of the complementarity between automation and cognitive tasks. Graetz and Michaels (2018) analyzed the penetration of robots in several industries and defined occupations as "replaceable if by 2012, their work could have been replaced, completely or in part, by robots. They found that robots reduced the share of hours worked by low-skilled workers in replaceable jobs (blue collars) relative to workers performing other tasks on duty. They also documented that industry-country pairs that saw more rapid increases in robot density from 1993 to 2007 experienced larger gains in (surviving) labor productivity (i.e., the productivity effect postulated by Acemoglu and Restrepo (2019) ). Acemoglu and Restrepo (2020);  confirmed and qualified Graetz and Michaels's findings, showing that the negative effects of robots on employment are concentrated in routine manual tasks, blue-collar, assembly, and related occupations. In what follows, we are making two basic assumptions based on all these findings. First, routine-biased technical change is substitute to routine manual tasks (group 2 in previous classification). Second, routine-biased technical change is complementary to cognitive/abstract tasks (group 5).

Estimation
Using the May/ORG CPS+DOT database, we estimate a set of Counterfactual Quantile Regressions in which the dependent variable is the change in the distance between two given wage percentiles, i.e. the wage gap, computed between the initial and final periods of the sample. As regressors we use: education, experience (proxied by age), and task intensity in each of the 5 groups of tasks defined in Sect. 2.1. We also include among regressors union membership, marital status and race, which are the variables used by Firpo et al. (2011) to control for other potential mechanisms affecting wage inequality Because some of the 6,700 cells of homogeneous workers defined by these characteristics have only a limited number of observations, we build a pseudo-panel in which the initial period is obtained by pooling the years 1986-1988 and the final period is obtained by pooling years 2000-2002. Percentiles below the 5th and above the 95th are trimmed to wash out the typical noise of data at the extremes of the wage distribution. Tables 1-2 (main text) and 3-4 (Appendix) report the estimation outcome. Table 1 presents some aggregate results that are useful to get a sense of the relative importance of within-group price effect, between-group price effect, and composition effect across the wage distribution. In each percentile interval, the reported price effect (composition effect) represents the counterfactual change in the corresponding wage gap that would have occurred had the coefficients (quantities) of all covariates taken final period values but the quantities (coefficients) had remained fixed at initial period values. The estimation results in Table 1 mirror the evidence reported in the literature. The total 5th − 95th wage gap rose by approximately 7 percentage points ( (Acemoglu, 2002)), and the last row of Table 1 shows that the increase was entirely driven by a larger inequality in the upper echelon of the distribution, which more than compensated for its decline in the lower echelon 1 3 ((Buchinsky, 1998)). The last column reveals that the largest contributor to the widening 5th − 95th wage gap is the between-group price effect. However, when the estimation is performed without distinguishing the between-group from the withingroup price effect, then the composition effect explains a prominent fraction of the total variation ( +3.77% ) because the positive between-group price effect ( +4.75% ) is partially offset by the negative within-group price effect ( −1.19% ). This finding reconciles our results with those of Lemieux (2006). When controlling for the composition effect and analyzing the distribution by echelons (first row), we find that the variation of wage inequality is again positive in the upper echelon ( +7.89% ) and negative in the lower echelon of the distribution ( −4.20% ), as shown by Autor et al. (2008). Our results clarify two important caveats to this finding. First, we show that the bulk of changes in wage inequality are concentrated below the 30th and above the 60th percentiles. In the middle echelon (third column), wage inequality appears relatively stable and variations in the 30th − 60th wage gap are close to zero due to the opposite signs of a negative within-group price effect and a positive composition effect. Second, the between-group price effect appears mostly important in determining the variation of inequality among high wages ( +3.68% ), but rather small and nonsignificant ( +0.53% ) in explaining the total reduction for low wages ( −2.85% ). This last is rather determined by a strong negative within-group price effect ( −4.73% ) which is only partially compensated for by a mild and positive composition effect ( +1.61%).
In Tables 3-4 we report the effects of individual regressors (see Appendix). Each figure measures how the wage gap between percentile i and j would change if the coefficient of the corresponding regressor changed while its quantity remained fixed, and all coefficients and quantities of the other regressors were kept fixed at initial period values. Several results are worth mentioning. We start with the estimates of the within-group price effect. For each variable, this effect measures the counterfactual change in the selected wage gap implied by the variation of the coefficient net of the variation in median coefficient. All other coefficients and quantities, including workers' characteristics, are fixed at their initial period values. Results in Table 3 show that changes in the prices of occupational tasks outweigh the effect of all the other variables both when considering the whole distribution, and when dividing the positive between 2.12 * * * 1.61 * * * 2.88 * * * 6.61 * * * within 2.10 * * * 2.14 * * * 4.18 * * * 8.42 * * * distribution by echelons. Among tasks, the largest contributors to changes in wage inequality across the whole distribution ( 5 − 95th wage gap) are routine manual and non-routine analytic. The price effect of the former significantly reduced lower and middle wage gaps, although is non-significant in the upper one, whereas the price effect of the latter raised wage inequality among all wage gaps. Specifically, changes in the price of routine manual tasks implied a reduction of −7.2% in the 5th − 30th wage gap. This effect alone appears to have determined the whole decline in wage inequality observed in the lower echelon of the wage distribution, as reported in Table 1 (within-group price effect, 5th − 30th ). Changes in the price of non-routine analytic tasks implied instead an increase of 4.2% in the 60th − 95th wage gap, which is equal to the overall variation reported Table 1 (within-group price effect, 60th − 95th ). Regarding the other tasks, the effects of non-routine manual, non-routine interactive and routine cognitive tasks are barely significant, and therefore, the overall effect of tasks in each wage gap is essentially equal to the difference between the negative effect of routine manual tasks and the positive effect of non-routine analytic tasks. For example, our estimation indicates that the 5th − 95th wage gap would increase by +8% if the price of non-routine analytic tasks alone changes, whereas it would diminish by −12% if the price routine manual alone changes. This reduction averages out at −5.5% when the prices of all tasks change simultaneously.
Regarding the between-group price effect, results in Table 4 show that education and non-routine analytic tasks have the largest effect on both the 5th − 95th wage gap (whole distribution) and the 60th − 95th wage gap (high wages), which is consistent with the predictions of standard theories on education and human capital accumulation and with the empirical findings of Piketty and Saez (2003). 10 In the other wage gaps, education and non-routine analytic tasks have significant but lower impacts, comparable to those of experience. The group of non-routine interactive tasks is always significant and has its strongest impact on the 5th − 95th wage gap ( +2.48% ), which is significantly lower than that of non-routine analytic ( +6.61% ), education ( +4.49% ), and experience ( −3.84% ). Finally, all control variables -union, married and race -are not significant in any of the wage gaps considered, and neither are the groups of tasks: non-routine manual, routine manual, and routine cognitive.

Automation and wage inequality
Given the relationships established in Sect. 2.1 between tasks and routine-biased technical change, we use the results of previous section to infer on the effects of automation on wage inequality across the wage distribution. To this end, Table 2 reports counterfactual changes in wage gaps implied by variations in the coefficients of tasks directly related to automation. That is, the price effect of technology-substitute routine manual tasks and technology-complementary non-routine analytic tasks. As reported in Table 2, both the within-group price effect and the betweengroup price effect of technology-complementary tasks are positive and significant, pushing upward wage inequality across all echelons of the wage distribution. 11 This result conforms to the findings of Firpo et al. (2011) and, more generally, to the theoretical and empirical literature that stressed the importance of technical change in explaining observed changes in wage inequality. Our results complement the existing literature by showing that changes in prices of technology-complementary tasks affected wage inequality both by enhancing the wage differential between cognitive and other workers (third row) and by increasing wage dispersion within the worker group (fourth row). 12 What is puzzling in Table 2 is the evidence on the effect of technology-substitute tasks. They had a strong negative price effect on wage inequality up to the 60th percentile (second row), and nonetheless the between-group price effect appears nonsignificant throughout the wage distribution (first row). By analyzing the coefficients of single quantile regressions, we learn that this result is due to a negligible variation in the median coefficient of routine manual tasks, i.e., Δ̂r out 50,t =̂r out 50,t � − ̂r out 50,t ≈ 0. This result seems at odds with the significant and negative within-group price effect (Table 2, second row), which suggests a declining price of routine tasks, and with the widespread opinion that automation would lower the price of technology-substitute routine tasks. As argued by Autor et al., in the lower half of the wage distribution, where occupations mostly comprise of routine and manual tasks, a reduction in the price of routine manual tasks would diminish routine workers' salaries. Eventually, wage inequality would decline because the wage differential between initially poorer manual workers and automation-impoverished routine workers would get smaller, and we should observe a negative between-group price effect. Our estimation suggests otherwise. Automation affects wage inequality only by reducing wage dispersion within homogeneous worker groups and not by reducing wage differentials between worker groups performing different tasks on duty.
A possible explanation of previous findings is that the law of one price does not hold for this particular production input (routine manual tasks). If automation reduced the price of routine tasks paid to low-wage workers while leaving the price unchanged for workers earning around the median wage, this would explain why the between-group price effect is non-significant but the within-group price effect in the 5th − 30th wage gap is. However, an explanation of our results based on the failure of the law of one price has some shortcomings. If automation did not change the price of routine tasks for workers earning above the 30th percentile, then within-group price effect of routine tasks in the 30th − 60th interval should be non-significant.
Instead, we find it significant and negative ( −3.55 ) suggesting that automation did affect the routine tasks price for mid-earners. If automation lowered the price of routine tasks up to any percentile above the 30th but below the 50th, thus affecting the 30th − 60th interval but not the coefficient ̂r out 50,t , then the 30th − 60th wage gap should increase and not decrease as it does, because poorer earners in this interval ( 30th − 50th ) would earn less while richer ( 50th − 60th ) earn the same. Finally, if automation lowered the price of routine tasks for all mid-earners up to the 60th percentile, this would explain the negative within-group price effect, but it would also imply a reduction in the median coefficient ̂r out 50,t , and thus a negative between-group price effect that we do not observe in our estimations.
Motivated by the difficulty in interpreting previous results, we develop a theoretical framework in which automation affects within-group wage inequality but not betweengroup wage inequality in the lower echelons of the wage distribution. These results are obtained by assuming that routine-biased technical change has an impact on both the labor demand and the labor supply. The effect on the labor demand is the one usually assumed in the literature. Routine-biased technical change allows firms to replace human labor with capital in routine tasks, thus leading to a reduction in firms' demand for routine labor. The effect on the labor supply is instead new to this literature, even though the mechanism is common in the literature on human capital. We assume that workers react to changes in the relative prices of tasks by adjusting their occupational choices, i.e. switching jobs, and therefore, changing the supply of task-specific labor.
Intuitively, such a model can rationalize previous results because it predicts that wage inequality among routine workers diminishes with automation even if the price differential between manual and routine tasks is held constant. The within-group effect on wage inequality is rather determined by the sorted migration of routine workers towards other occupations, which leaves the group of surviving routine workers more homogeneous in terms of skill. Recall that the estimated coefficients reported above capture regressors' contributions to the salary, which are interpreted as the prices paid by firms for the corresponding worker's characteristics like education, experience, etc. When tasks are used as regressors, task coefficients are interpreted as the fraction of wage paid by firm to perform a task, which is the combination of a task price and the worker's skill in performing efficient units of that task. Thus, if the support of the skill distribution in a group of workers shrinks, their wages will be more alike. Finally, note that because this effect is independent from changes in the price of routine tasks, the model accommodates the case in which wage differentials between routine and other workers do not change and nonetheless within-group wage inequality diminishes, as observed in data.

The model
We consider a partial equilibrium model of the labor market in which a continuum of uniformly distributed income-maximizing workers, indexed i ∈ (0, 1) , are each endowed with an idiosyncratic level of skill a i . Workers inelastically supply one unit of time to the labor market and decide which occupational task to undertake.
Following the literature, we assume that in the model economy exists directed technical change, g t , and three types of tasks with different levels of complementarity with g t : technology-complementary cognitive tasks h t , technology-substitute routine tasks z t , and technology-neutral manual tasks l t . We assume that each worker performs only one type of tasks. This assumption is equivalent to a model in which there is a one-to-one map between occupations and tasks.

Task prices and the labor demand
The labor demand is formed by a price-taker firm that combines worked hours in each tasks into units of productive labor. Building on Galor and Moav (2000), we define the complementarity between tasks and automation in terms of an erosion effect. When technical innovations occur, they erode the number of tasks that are not complementary to technology either because innovations replace workers with machinery or -as long as tasks are substitutes -because innovations reduce the relative efficiency of technology-neutral and technology-substitute labor compared with technology-complementary labor. Such erosion effect is akin to the displacement effect argued by Acemoglu and Restrepo (2019). In this framework, the erosion effect is assumed to depend on the growth rate of technology, thus implying changes in the relative demand for tasks only when new waves of automation arrive and not along constant, or constantly increasing, paths of technology. Moreover, we distinguish among tasks by assuming that workers performing tasks that require a minimum level of ability are more productive than other workers. The following composite labor aggregate H t accommodates previous assumptions: where g t = (A t − A t−1 )∕A t−1 is the growth rate of automation and A t its level, ∈ (1, ∞) captures the additional productivity of qualified labor (cognitive and routine) compared with unskilled labor (manual), and ∈ (0, 1) measures the intensity of the erosion effect. Because only cognitive tasks are assumed to be complementary to automation, both routine z t and manual l t tasks are subject to the erosion effect. We assume the same erosion intensity for the two types of tasks, independent of their degree of complementarity/substitutability with technology. This strategy imposes less structure on the model and avoids arbitrary assumptions required to calibrate different values of , which may direct the results. The demand for routine labor is differentiated from that for manual labor because routine workers are rewarded with the skill premium .
The cost-minimizing firm produces under a standard Cobb-Douglas technology hiring capital and labor in perfectly competitive markets. When the interest rate is constant, this formulation implies that the optimal ratio of capital to labor k t is also (1) H t = h t + (1 − g t )z t + (1 − g t )l t constant, and the aggregate wage rate of H t can be expressed as w t = A tw , where w = f (k) − f � (k)k , f (k) is the production function and f ′ is its first derivative. 13 Accordingly, task prices are The prices (2)−(4) conform to the empirical evidence presented in the literature. Automation is assumed to drive the general wage rate upward, w t ∕ g t > 0, given a positive productivity effect as in Acemoglu and Restrepo (2019). It also increases the price of cognitive tasks, whereas the effect on routine and manual tasks is undetermined, although certainly smaller than that on cognitive tasks. 14 The effect of g t on w z t and w l t is undetermined because automation generates two countervailing forces. Higher technology A t raises the marginal productivity of H t (positive productivity effect), whereas higher growth rates g t erode manual and routine task prices (negative displacement effect). This simple model is thus able to replicate the main assumptions about the impact of automation on the labor demand. Eventually, automation will enhance the price differential between cognitive and routine tasks, w h t ∕w z t = (1 − g t ) −1 , and between cognitive and manual tasks, w h t ∕w l t = (1 − g t ) −1 , while leaving unaffected the differential between routine and manual tasks: w z t ∕w l t = . This last feature implies that automation affects earnings inequality in the lower echelon of the earning distribution only through its effect on occupational choices, in line with paper's focus on the labor supply channel.

Labor supply and occupational choices
The amount of efficiency units of labor that each individual can supply in each occupation depends on her skill and on technology. In particular, automation is assumed to erode existing skill, which can be reestablished by individuals through a learning process. This assumption is introduced in the model using the linear formulation suggested by Galor and Moav (2000): The partial equilibrium model presented in this section can be readily extended to a dynamic general equilibrium framework by considering a small open economy in which the representative firm sells its product for investment and consumption purposes to a continuum of lifetime utility-maximizing households. Under the standard assumptions of concavity, non-satiability and separability of the utility function -in addition to the assumption that different types of labor entail the same levels of disutility -the household's occupational choice problem is separable from saving/consumption choices and, therefore, coincides with the choice analyzed here.
Equations (5) and (6) posit that the number of efficiency units of cognitive and routine labor that a worker can provide (i) increases with a i , which replicates the assumption that skill reduces the cost of learning ( (Bartel & Sicherman, 1998) ), and (ii) decreases with g t > 0, which implies that workers must devote a fraction of their time to learning innovations to maintain their supply of skilled labor at a constant level. Equation (7) posits that manual tasks require no learning processes, which replicates the standard assumption in this literature that manual duties are technology-neutral ( (Autor et al., 2003)). A byproduct of this assumption is that the supply of manual labor is constant even in a changing technological environment, and always coincides with workers' time endowment. Three additional features of the adopted formulation are worth emphasizing. First, learning costs in cognitive and routine tasks ( (1 − a i )g t ) are assumed to be equal, which is a conservative assumption with respect to our results. Any labor supply function entailing a learning advantage for cognitive tasks compared to routine tasks would strengthen the migration of workers from routine to cognitive tasks after new waves of automation, which would enhance the impact of automation on the earning distribution. Second, only cognitive tasks reward skill in a stationary technological environment, which is a natural consequence of the assumption that only cognitive tasks are complementary to automation. Third, technology is less costly for manual than for routine tasks, which is a consequence of the different relationship of automation with manual (neutral) and routine (substitute) tasks postulated by the routinization hypothesis [ (Acemoglu & Autor, 2011), (Autor & Dorn, 2013) ].
Each individual chooses which occupation to undertake in seeking to maximize income by observing task prices (2)−(4) and learning options (5)−(7). Because the different types of tasks are perfect substitutes (equation 1), individual i will choose the highest among the following income possibilities: As equations (8)−(10) illustrate, the marginal returns of skill are highest for cognitive tasks and lowest for manual tasks, i.e.
In equilibrium, this yields a sorted mapping between tasks and earnings in which the most capable individuals choose cognitive tasks and land in the top echelon of the earning distribution, less capable individuals choose routine tasks and are situated in the middle echelon, and the least capable individuals obtain manual tasks and are found in the lowest echelon. By equating pairwise the earning options for individual i, we can characterize the parametric values for the thresholds of occupation-switching skill as follows, Under certain conditions that guarantee the existence in equilibrium of all types of tasks, 15 the model argues that every individual with a level of ability above a * * will choose cognitive tasks, those with a level of ability below a * will choose manual tasks, and everyone in the middle will choose routine tasks. Figure 1 depicts the occupational distribution and the associated earnings distribution in equilibrium as function of individual skill. The upward frontier of earning possibilities represents the overall supply of tasks in equilibrium after occupational choices are undertaken.
(11) a * =1 − 1 − −1 g t (12) a * * = 1 − g t + g 2 t 1 + g 2 t Fig. 1 Earnings and occupational distributions 15 Using equations (11) and (12), it can be shown that (i) there always exists a calibration of { , } that guarantees a positive mass of individuals in each task, i.e., 0 < a * ≤ a * * < 1, and (ii) this calibration fulfills two conditions: (1 − g t ) > 1 and < −1 Intuitively, for routine tasks to exist, (i) routine income should be greater than manual income at least for the lowest level of skill, and (ii) the erosion effect should not be too large; otherwise, in the presence of automation, every individual will find her supply of cognitive labor high enough to choose cognitive over routine tasks.

Equilibrium effects: automation and earnings
Using the equilibrium characterized in previous section, we now analyze the implications of automation for the earning distribution. By inspecting equations (8)−(10), it is apparent that variations in g t affect both labor demands by changing task prices, and labor supplies by changing occupational choices, eventually determining a new allocation of labor among tasks across the earning distribution. In particular, we find that occupational switches affect the skill distribution both between and within occupational groups, thereby changing the distribution of earnings through several channels. These results are formally established in the next three propositions.
Lemma 1 (Job Polarization) Consider a partial equilibrium economy in which income-maximizing agents are endowed with heterogenous levels of innate skill. Assume that there are three occupational tasks, the relationships of which with individual skill are defined in equations (5)−(7). Each tasks is hired by a profit-maximizing firm in a perfectly competitive labor market and employed in a constant returns to scale production function using the composite labor aggregate (1). Production is affected by directed technical change in the form of automation, g t , whose different degree of complementarity with the three types of labor is specified in equations (2)−(4). In equilibrium, whenever g t increases: (i) the mass of workers performing cognitive tasks univocally grows.
(ii) the mass of workers performing routine tasks univocally diminishes. (iii) the mass of workers performing manual tasks univocally grows.
The results in Lemma 1 replicate the well-known job polarization dynamics. Automation impacts on the composition of the labor force by reducing employment in the middle echelon of the earning distribution and increasing it at the extremes. 16 In this model, the mechanism is generated by a twofold effect of g t . On the one hand, increases in g t weak-monotonically widen price differentials rewarding cognitive tasks, in particular. This condition drives the most capable routine workers to revise their occupational choices eventually switching to cognitive labor. The upward migration is limited to the fraction of routine workers possessing sufficiently high skill to guarantee a supply of cognitive tasks that makes the switch convenient. Otherwise, routine workers maintain their current occupations. On the other hand, automation generates a downward migration due to increased learning costs. If a routine worker's ability is below a certain threshold, an increase in g t implies a reduction of her supply of efficient units of routine labor up to the point at which her income gets lower than what she would earn from manual labor. Eventually, all routine workers with a skill level below that threshold switch to manual occupations. Note that the migration between routine and manual jobs only occurs in one direction. Because g t always penalize routine labor more than manual labor -compare equation (10) with (9) for a i < a * * -, no manual worker finds desirable the option of switching to routine labor after an increase in g t .
Lemma 1 is stated under the assumption that a limitless job pool exists for each type of labor. Thus, routine workers involved in the upward migration always find a cognitive job and those failing to catch up with the new technology always find a manual job. For the same reason, incumbent manual workers are not crowed out by the downward migration of routine workers. If the framework were to account for unemployment, these results should be qualified. Adding a mismatch or a cost of switching type of labor would cause some routine workers to exit the market. This additional effect would not counteract result (ii) of the Lemma 1. In the presence of unemployment, the mass of routine workers may decrease further, or remain the same and the model would additionally identify who is getting unemployed and who is switching to a new job. In both cases, increases in g t would shrink the group of routine workers as in the present version of model without unemployment. The same is not true for results (i) and (iii) of Lemma 1. If some workers exit the market, the mass of cognitive and manual workers may not necessarily increase even though the mass of routine workers is diminishing. The impact of automation on cognitive and manual labor would then be indeterminate. It is worth noting, however, that the no-unemployment assumption can be justified by the presence of a reinstatement effect as the one conjectured by Acemoglu and Restrepo (2019), in which automation creates new tasks that provides a labor demand outburst that absorbs the upward migration of workers predicted by our model (Fig. 2).
A key feature of the model is that the migration of workers described above is not random, but sorted across the skill distribution involving routine workers placed at the extremes of the ability interval of routine labor. Higher-skilled routine workers switch to cognitive tasks, whereas low-skilled routine workers toward manual tasks. This migration affects the distribution of skill by tasks and, eventually, earning routine tasks are not a necessary condition for automation to reduce earning inequality among routine workers because the effect is rather determined by a reduction in workers' skill-heterogeneity. This reduction is determined by increases in learning costs that penalize the labor supply and, in particular, variations in the price of routine tasks are not a necessary condition for automation to trigger the outflow of workers. To stress this mechanism, in our setup we held fixed the relative price differential between routine and manual labor ( w z t ∕w l t constant). 18 Besides, note that in the model the price of routine tasks does not necessarily diminish in levels. In fact, the effect of g t on w z t is indeterminate ( > 0 ) operates against the negative erosion effect ( ). The empirical evidence on the coefficient of technology-substitute routine manual tasks ( Δ rout 50,t ≈ 0) then indicates that the productivity effect of automation appears large enough to counteract both the erosion effect and the negative effect on the supply of routine tasks in efficient units due to increased learning costs ( Finally, the model can replicate the empirical evidence on the effects of automation on technology-complementary tasks reported in the last two rows of Table 2. The positive price effect on technology-complementary task prices ( w h t g t > 0 ) makes the group of cognitive workers relatively better paid, thus increasing their wage differentials with other workers (third row). In addition, the upward migration argued in result (i) of Proposition 2 widens the ability interval of cognitive labor ( a h g t > 0 ), thus raising earning inequality within the group of skill-heterogenous workers (fourth row).

Final remarks
In this paper, we analyze the effect of automation on wage inequality among low, medium and high earners by the mean of a Counterfactual Quantile Regression analysis. Depending on which tasks are considered, the analysis reveals two different patterns. On the one hand, by raising the prices of technology-complementary cognitive tasks, automation enhances (i) wage differentials between workers performing cognitive tasks and workers performing other tasks on duty, (ii) wage dispersion within groups of observationally-homogeneous workers performing cognitive tasks. These two effects operate in the same direction driving upward wage inequality. 18 Note that if automation decreased the price differential ( w z t ∕w l t decreasing in g t ), there would be an additional effect reinforcing the downward migration, thus eventually strengthening the result that z t g t < 0.
19 To see this point, it is useful to provide an interpretation of the estimated coefficients from the empirical analysis as the combination of a task price and a worker's skill in performing efficient units of that task. In terms of our model, the coefficient rout q,t would then be where z q t refers to the labor supply of workers in the q-th percentile.
As expected, the impact is stronger in the upper echelon of the wage distribution, where most of cognitive jobs are concentrated. On the other hand, we find that variations in the prices of technology-substitute routine tasks affected wage inequality by reducing wage dispersion within the group of workers performing routine tasks, but not by enhancing wage differentials between workers performing routine tasks and workers performing other tasks on duty. As expected, we find that the effect is significant in the lower half of the wage distribution stronger where most of routine jobs are concentrated, and strongest among wages below the 30th percentile. We rationalize the response of low and high wages to automation by developing a partial-equilibrium model of the labor market augmented with the routinization hypothesis, in which skill-heterogeneous agents endogenously adjust their occupational choices to changes in the task prices. This model is able to mimic the effect of automation on wage inequality across the wage distribution as observed in actual data, according to the empirical evidence presented in the paper. We do not directly bring the model to data because we understand that two assumptions should be relaxed before attempting a proper estimation. First, the one-to-one map between occupations and tasks. Second, the linearity of labor supplies, given that some curvature in the policy functions is needed when performing structural estimations of the model. We leave these extensions to future research.

A.1 Lemma 1
Given the assumption that individuals are uniformly distributed on the [0, 1] continuous interval, and maintaining the condition 0 ≤ a * < a * * ≤ 1, then item (i) directly follows from the fact that a * * g t < 0 and item (iii) from the fact that a * g t > 0. Item (ii) follows from the contemporaneous increase in a * and reduction in a * * .

A.2 Proposition 2
Using equations (11) and (12), the skill intervals for each occupation can be written as function of g t . That is, (15) a z =|a * * − a * | = 1 − −1 (1 + g 2 t ) g t (1 + g 2 t ) (16) a l =|a * − 0| = −1 − 1 + g t g t 4. Given the marginal density of the covariates g(X t , obtain the unconditional distribution of wages by random sampling x * i,t from the rows of X t using where ̂i ,t is the i th row and t column of matrix B . 5. Compute the simulated unconditional quantile ̂ as: Q ,t (w * i,t ).
Regarding the analysis of wage inequality, stage two is attained by performing the following steps: 1. Let the variation between two periods (s and t) of the distance between two selected percentiles ( and ′ ) be or equivalently, where we simplify the notation using Q ,n ≡ Q ,n (w * i,n ) for n = {t, s} , and = i , � = j for i ≠ j. 2. Given the median of the simulated distribution Q 50,n , define ̂, n =̂, n −̂5 0,n as the difference between the estimated coefficient in percentile and the median coefficient. 3. Then, the variation from s to t of the wage gap between and ′ can be decomposed as follows: where ΔQ ,s,t is the within-group wage change in percentile : ΔQ b ,s,t is the between-group wage change in percentile : and ΔQ X ,s is the composition effect: (21) ΔQ ,s,t = ΔQ ,s,t + ΔQ b ,s,t + ΔQ X ,s,t ΔQ ,s,t =Q (̂5 0,s +̂, s , X s ) −Q (̂5 0,s +̂, t , X s ) ΔQ b ,s,t =Q (̂5 0,s +̂, t , X s ) −Q (̂5 0,t +̂, t , X s )

B.2 Estimation Results: individual variables contributions
The estimation is performed following using the procedure explained in Section B.1. Data sample: 1986-2002. Years 1986, 1987, 1988, 1989 are pooled to build initial period data. Years 2000Years , 2001Years , 2002 are pooled to build final period data. More details on data are provided in Sect. 2.1.

Table 4 Sources of variations in wage gaps
In each column, figures report the percentage variation in the corresponding wage gap from the initial to the final period. Final period is counterfactual. That is, wage gaps in final period are obtained by estimating a counterfactual distribution of wages in which, for each row, the coefficient of the indicated regressor is replaced with its median value in final period estimation. Its quantity and all of the other coefficients and quantities are fixed at initial period values. Standard Deviations (in parentheses) are obtained using a bootstrap procedure with 200 draws