the shock reallocates workers to sector-locations with larger wedges or stronger agglomeration forces.<sup>8</sup> The logic is similar to that in Hsieh and Klenow (2009) who show that sectors with larger wedges are too small relative to the first-best allocation. If a shock reallocates workers to firms bearing higher distortions, the aggregate welfare effects are larger.

I calibrate the model using structural relationships. The key parameter to estimate is the labor supply elasticity across sectors, which governs the reallocation of workers from the informal to the formal sector. I follow Tsivanidis (2019) and calculate measures of market access for residents and firms by sector. To recover this key elasticity, I exploit variation across locations after the shock by running a triple-difference estimator that associates changes in labor allocation between the formal and informal sectors with changes in market access. I find that the estimates for the labor supply elasticity parameter, around 1.9, are consistent with the theoretical assumptions of the model and the data. Intuitively, if a transit shock connects workers to better formal jobs relative to informal jobs, workers reallocate from the informal to the formal sector, generating additional welfare gains.

Moreover, to calibrate the wedges, I use two different approaches that yield similar results. First, I follow Hsieh and Klenow (2009) and use the inverse of the labor and capital share relations. Under the assumption that all firms within the same sector use the same production function, differences in these shares capture the wedges. Second, I use the analysis from Levy (2018) that documents differences in taxes, subsidies, and other distortions between formal and informal establishments in the Mexican economy. I assume a constant wedge for formal firms considering all these distortions and a wedge of zero for the informal ones.

Next, I quantify and decompose the welfare gains from the transit shock by varying trade/commuting costs in the GE model. I find that the allocative efficiency margin drives a significant fraction of the total gains. I am able to run counterfactuals from an initial equilibrium inverting the model and recovering scale parameters. I compute the counterfactuals, using the estimates of the key elasticities and the initial equilibrium conditions (Dekle et al., 2008). The results suggest that the new subway line increased welfare by around 1.8%. I find that the direct effects explain approximately 79% of the total gains, while the reallocation of workers from informal to formal firms explains 18% and the remaining 2% are driven by differences in agglomeration between the two sectors.<sup>9</sup> The counterfactual analysis also suggests that the reductions in commuting and trade costs account for a similar amount of the total gains.

In terms of the cost-benefit analysis, the allocative efficiency margin increases net welfare by a considerable margin. According to official documents from the Government of Mexico City (henceforth the Government), the net present value of the total cost of a subway line with 20 km and 20

> capture actual changes in welfare, the approach rests on the assumption that any reduction in commuting costs is infinitesimal. Accordingly, I compute the counterfactuals using percentage changes.

> 8The third term arises in the presence of heterogeneous agglomeration externalities or trade imbalances as in Fajgelbaum and Gaubert (2020). In the case of the efficient economy, I am assuming trade balances. In the inefficient economy, the labor wedges create trade imbalances, and the third term arises.

> 9I compute two counterfactuals. The first one allows workers to migrate within the city. The second one holds constant the population in each census tract. The results of both counterfactuals are very similar.

4