This thesis contains four independent essays in heterogeneous agent macroeconomics. They explore the sources of income inequality and income risk and study the optimal design of public redistribution and insurance. 
The first chapter, joint with Filip Rozsypal, studies the origins of idiosyncratic earnings risk in frictional labor markets, with a particular focus on the role of firms for worker earnings risk. First, using administrative matched employer-employee data from Denmark, we document key properties of the worker earnings growth distribution, the firm revenue growth distribution, and their joint distribution. The worker earnings and firm revenue growth distributions exhibit strong deviations from normality, in particular excess kurtosis, with many workers and firms experiencing very small changes to their earnings/revenues, but a significant minority experiencing very large changes. Large earnings losses are more likely for workers in firms with negative revenue growth, driven both by separations to unemployment and earnings losses on the job. Second, we develop a model framework consistent with the data, with four key features: i) frictional labor markets and on the job search to capture unemployment risk and wage growth through a job ladder, ii) multi-worker firms to capture gross and net worker flows, iii) risk averse workers such that earnings risk matters, and iv) contracting with two-sided limited commitment because earnings of job stayers are changing infrequently in the data. Third, we use the model to explore policies designed to mitigate earnings fluctuations. 
The second chapter, joint with Annika Bacher and Lukas Nord, studies one particular private insurance margin against individual income risk only available to couples, which is the so called added worker effect. Specifically, we study how this intra-household insurance against individual job loss through increased spousal labor market participation varies over the life cycle. We show in U.S. data that the added worker effect is much stronger for young than for old households. A stochastic life cycle model of two-member households with job search in a frictional labor market is capable of replicating this finding. The model suggests that a lower added worker effect for the old is driven primarily by better insurance through asset holdings. Human capital differences between employed young and old contribute to the difference but are quantitatively less important, while differences in job arrival rates play a limited role. 
In the third chapter, joint with Axelle Ferriere, Gaston Navarro, and Oliko Vardishvili, we study optimal redistribution, taking into account not just the large income and wealth inequality in the data, but also the distribution of income risk that is key in the first two chapters. The U.S. fiscal system redistributes through a rich set of taxes and transfers, the latter accounting for a large part of the income of the poor. Motivated by this, we study the optimal joint design of transfers and income taxes. Within a simple heterogeneous-household framework, we derive analytical results on the optimal relationship between transfers and tax progressivity. Higher transfers are associated with lower optimal income tax progressivity. Redistribution is achieved with generous transfers while efficiency is preserved via a lower progressivity of income taxes. As such, the optimal tax-and-transfer system features larger progressivity of average than of marginal tax rates. We then quantify the optimal tax-and-transfer system in a rich incomplete-market model with realistic distributions of income, wealth, and income risk. The model features a novel flexible functional form for progressive income taxes and means-tested transfers. Relative to the current U.S. fiscal system, the optimal policy consists of more generous means-tested transfers, which phase-out at a slower rate. These larger transfers are financed with higher tax rates, but the taxes are not more progressive than the current system. 
The fourth chapter, joint with Axelle Ferriere and Dominik Sachs, also studies optimal redistribution, but instead of considering a stationary environment it analyzes the dynamics of the equity-efficiency trade-off along the growth path. To do so, we incorporate the optimal income taxation problem into a state-of-the-art multi-sector structural change general equilibrium model with non-homothetic preferences. We identify two key opposing forces. First, long-run productivity growth allows households to shift their consumption expenditures away from necessities. This implies a reduction in the dispersion of marginal utilities, and therefore calls for a welfare state that declines along the growth path. Yet, economic growth is also systematically associated with an increase in the skill premium, which raises inequality and the desire to redistribute. We quantitatively analyze these opposing forces for two countries: the U.S. from 1950 to 2010, and China from 1989 to 2009. Optimal redistribution decreases at early stages of development, as the role of non-homotheticities prevails. At later stages of development the rising income inequality dominates and the welfare state should become more generous.