Zsófia L Bárány
email: zsofia.barany@sciencespo.fr

Nicolas Coeurdacier
email: nicolas.coeurdacier@sciencespo.fr

Stéphane Guibaud
email: stephane.guibaud@sciencespo.fr.

Capital Flows in an Aging World

Keywords: JEL Classification: E21, F21, J11 Aging, Household Saving, International Capital Flows

We investigate the importance of worldwide demographic evolutions in shaping capital flows across countries and over time. Our lifecycle model incorporates cross-country differences in fertility and longevity as well as differences in countries' ability to borrow inter-temporally and across generations through social security. In this environment, global aging triggers uphill capital flows from emerging to advanced economies, while country-specific demographic evolutions reallocate capital towards countries aging more slowly. Our quantitative multi-country overlapping generations model explains a large fraction of long-term capital flows across advanced and emerging countries.

Introduction

The world is aging and is expected to age further, as a result of a secular decline in fertility and mortality rates worldwide. As shown in Figure 1, these trends have been especially pronounced in emerging countries, which have seen their demographic patterns converge towards those of advanced economies over the last decades. While the world was essentially bi-modal in the 1960s-with a marked contrast between advanced economies and emerging countries in terms of fertility and life expectancy-demographic patterns have become more homogeneous around the globe. [START_REF] Aguiar | Growth in the Shadow of Expropriation[END_REF] Figure 1 nonetheless reveals substantial heterogeneity in the timing and pace of demographic evolutions, among emerging countries in particular. While South-East Asia experienced a fast convergence, the rest of Asia, the Middle East and North Africa (MENA), and Latin America converged at a slower pace. Sub-Saharan Africa still displays fairly high levels of fertility and mortality, and is projected to gradually converge in the future. This paper investigates how these broad demographic evolutions, comprising both global and country-specific components, can help explain patterns of capital flows across countries and over time. A distinct feature of our theoretical and quantitative analysis is to incorporate cross-country differences in credit markets and social security-i.e., differences in their ability to make intertemporal and intergenerational transfers. The interactions between demographic evolutions and these dimensions of heterogeneity occupy central stage in our work, and their combination is essential to the quantitative success of the model.

Country-specific demographic evolutions and the global aging trend both contribute in shaping international capital flows. On the one hand, demographic heterogeneity generates capital flows towards countries that are younger and are aging more slowly. This force tends to induce downhill flows towards emerging countries-most of which are importing capital in the data. On the other hand, the common trend itself constitutes another driver of capital flows in our setup. [START_REF] Alfaro | Sovereigns, Upstream Capital Flows and Global Imbalances[END_REF] Specifically, we show that, when countries differ in their ability to borrow over the lifecycle and across generations, global aging tends to generate uphill flows towards advanced economies-which typically have more developed credit markets and a wider social security coverage. This second force is quantitatively relevant to match some important features of the Notes: Panels (a) and (c) display fertility rates adjusted for infant mortality, while panels (b) and (d) display life expectancy at birth. See Appendix C for data sources, list of countries, and regional classification.

data. It helps to account for the vast amounts of capital flowing uphill from some emerging countries to advanced economies in the 2000s (Bernanke (2005), Obstfeld and Rogoff (2009))

and to rationalize the limited amounts of capital flowing towards emerging countries.

In the first part of the paper, we articulate our theory of aging and capital flows in a stylized multi-country overlapping generations framework. Three generations coexist in each country:

the young borrow against future income; the middle-aged work, contribute to social security, and save for retirement; the elderly consume out of their savings and pension benefits. The ability to borrow and the level of social security contributions/benefits differ across countries and are assumed to be higher in developed countries. Global and country-specific demographic trends are captured by exogenous fertility and probability of surviving into old age.

In this setup, we characterize analytically the impact of fertility and longevity on the interest rate and capital flows. Global aging causes a drop in the world interest rate due to a rise in savings and a decline in investment-even more so when the world average level of social security is low. Uphill capital flows arise as a consequence of a divergence in savings across countries-which is partly driven by their differential response to the interest rate drop.

In all countries, the young tend to borrow more thanks to cheaper credit. On the other hand, the middle-aged tend to increase their savings as a result of higher longevity, but this rise is mitigated both by a wealth effect (higher present value of future benefits) and an increase in social security contributions (as the system adjusts to the demographic pressure). Due to easier access to credit and higher levels of social security, the increase in borrowing by the young and the forces that mitigate the rise in middle-aged's savings are stronger in advanced economies-which thus experience a deterioration in their net foreign asset positions. The divergence in savings and the resulting uphill capital flows are reinforced when the decline in the interest rate is more pronounced, and when the financing of social security in advanced economies adjusts to population aging mostly through higher contribution rates, rather than lower benefits.

We also analyze how country-specific demographic factors affect capital flows in our setup, in the cross section and over time. Among emerging countries, differences in the timing of demographic evolutions lead to markedly different outcomes in terms of capital flows. Countries that experience an early convergence (i.e., roughly at the time they integrate to the world capital market) quickly start to export capital-possibly as soon as they open up. In contrast, countries with a delayed convergence are more likely to experience capital inflows. Hence, younger developing countries with more vibrant demographics may experience capital inflows, while emerging economies that age fast export capital. More broadly, the model predicts that rich patterns of capital flows may emerge-shaped by differences in demographics and aging prospects, but also by the interactions between the worldwide aging trend and heterogeneity in credit markets and social security.

In the second part of the paper, we consider a quantitative version of the model and confront its predictions on capital flows to the data. In the quantitative setup, all features of cross-country heterogeneity are preserved, but agents live for many periods, with some probability of dying in each period. Considering a sample of 70 countries that covers all regions of the globe and more than 90% of world GDP, we calibrate fertility and mortality rates to the data for each country. Using household debt data and processing a vast amount of information on social security systems across the world, we also calibrate the level of credit market development in each country, as well as the generosity of their public pension schemes.

Keeping all countries on the same productivity growth path to isolate the role of demographics, we simulate the dynamics of the world economy assuming complete autarky until 1980, when world capital markets integrate.

Our calibrated model broadly reproduces the salient patterns of capital flows across countries over the last decades. Upon opening in the 1980s, capital flows are relatively modest despite massive demographic differences across countries, and capital tends to flow from Western Continental Europe and Japan towards younger regions. Because they have relatively young populations, most emerging countries initially import capital-although much less than a model with symmetric credit constraints and social security would predict. Over time, as some emerging countries (e.g., South-East Asia) are aging faster than the rest of the world, they turn into creditors and replace Continental Europe and Japan as major world lenders-a phenomenon reinforced by the fall in the world interest rate induced by global aging. Meanwhile, countries with a delayed demographic transition (Sub-Saharan Africa and, to a lesser extent, South and Central Asia) become large debtors. Among advanced economies, global aging accentuates the position of Anglo-Saxon countries as large debtors, while bringing Old Europe and Japan closer to balance. Simulations suggest that such trends should perpetuate in the future, with an even larger fraction of emerging countries turning into creditors.

To systematically assess the quantitative performance of the model, we regress capital flows as observed in current account data over the period 1990-2015 on model-predicted flows.

The model explains a substantial fraction of the dispersion in capital flows across countries, accounting for 30-40% of the cross-country variation in the data, with a slope coefficient that is close to unity. Although the model misses higher frequency variations observed in the data due to financial crises and business cycle fluctuations, it captures well, both qualitatively and quantitatively, the long-term trends in capital flows and their cross-country dispersion.

Counterfactual experiments show that the global aging trend and cross-country differences in demographics are both essential to the model's performance. While the latter tend to foster capital flows towards countries that are aging more slowly, the former-interacted with heterogeneous credit constraints and social security-helps bring the model in line with the data by limiting the magnitude of downhill flows towards younger developing economies, and by generating some uphill flows towards advanced economies. As a by-product of our quantitative analysis, we also assess the ability of global demographic changes to explain the sustained decline in the world interest rate and find that our model accounts for almost half of the fall observed since 1990.

This paper contributes to an abundant literature on the economic implications of aging.

First and foremost, our analysis relates to earlier studies exploring the impact of demographic evolutions on capital flows-including Obstfeld and Rogoff (1996), Brooks (2003), Ferrero (2010), Choukhmane (2012), and Backus, Cooley, and Henriksen (2014). In particular, our quantitative methodology is largely inspired by the one employed in Domeij and Flodén (2006).

Whereas prior studies mostly focus on advanced economies, the main contribution of our paper is to incorporate emerging/developing countries in the analysis, and to show that a common demographic trend on its own can trigger capital flows when countries are heterogeneous in the development of their credit markets and social security systems. Second, our work relates to a series of recent papers that assess the extent to which demographic factors can explain the secular fall in real interest rates. Carvalho, Ferrero, and Nechio (2016), Eggertsson, Mehrotra, and Robbins (2017), Gagnon, Johannsen, and López-Salido (2016), and Lisack, Sajedi, and Thwaites (2017) develop their analysis in the context of a closed advanced economy. Our paper is more closely related to Krueger and Ludwig (2007), who investigate the impact of aging on the future evolution of factor prices in an open-economy setting, focusing on OECD countries.

Instead, we include an extensive set of emerging economies in our quantitative exploration.

These countries, which constitute a substantial fraction of the world economy, have typically aged later but faster than advanced economies, and also tend to have less generous social security systems. Our findings indicate that their presence reinforces the decline in interest rates in the most recent period. Third, our work connects to the vast literature on aging and pension reforms, which typically adopts an OLG modelling approach similar to ours.

Whereas a majority of papers set up their analysis in a closed-economy framework, Attanasio, on the implications for factor prices and welfare across generations and countries. Instead, we articulate a theory of aging and capital flows and provide a quantitative evaluation of its predictions using current account data.

From a theoretical perspective, our analysis also contributes to a large body of work that investigates the mechanisms driving global imbalances and uphill capital flows. [START_REF] Attanasio | Global Demographic Trends and Social Security Reform[END_REF] Our paper emphasizes the role of global aging as a potential source of capital flows from emerging countries to advanced economies, providing a novel mechanism complementary to the ones previously offered in the literature. Lastly, our work is related to the empirical literature on the medium-run determinants of the current account. [START_REF] Attanasio | Consumption Growth, the Interest Rate and Aggregation[END_REF] Unlike prior studies, we rely on a quantitative model to construct a theory-grounded predictor of capital flows, which we use in our regression-based assessment of the role of demographics as a driver of capital flows.

The paper proceeds as follows. Section 2 provides a tractable model of aging and capital flows, and elucidates the main mechanisms at play. Section 3 presents the quantitative model and its calibration to the data, and evaluates its ability to account for the patterns of capital flows observed across the world over the last decades. Section 4 performs sensitivity analysis and extensions. Section 5 concludes. Appendices A-D contain supplementary material.

Theory

The world consists of N countries populated by overlapping generations of agents who live for at most three periods-youth (y), middle age (m), and retirement (o). Agents only work in middle age. All countries operate the same technology (with possibly different levels of productivity) to produce a homogeneous good that is traded freely and costlessly. Agents share the same preferences and are immobile across countries. We describe the details of our setup by considering a given country i ∈ {1, . . . , N }.

Demographics. All agents reach middle age with probability one, but a middle-aged individual in period t only survives to old age with probability p i t . Individuals of the same generation are grouped into households, each comprising a continuum of agents. We denote by L i g,t the measure of agents belonging to generation g ∈ {y, m, o} in period t, and we denote by n i t the mass of children born to a young household in that period, implying that

L i y,t+1 = n i t L i y,t . It follows that L i m,t+1 L i m,t = L i y,t L i m,t = n i t-1 and L i o,t+1 L i m,t+1 = p i t n i t-1
.

Eugeni (2015), Gourinchas and Jeanne (2013), Mendoza, Quadrini, and Rios-Rull (2009), Sandri (2010), Song, Storesletten, and Zilibotti (2011), and the survey by Gourinchas and Rey (2013) for further references. [START_REF] Attanasio | Consumption Growth, the Interest Rate and Aggregation[END_REF] See in particular Alfaro, Kalemli-Ozcan, and Volosovych (2014), Chinn and Prasad (2003), Higgins (1998), Lane and Milesi-Ferretti (2002), Taylor and Williamson (1994), and the meta-analysis by Ca'Zorzi, Chudik, and Dieppe (2012) for further references. For evidence on the impact of demographics and its interaction with social security on aggregate savings across countries, see Bloom et al. (2007) and Samwick (2000), as well as Leff (1969) for a seminal contribution.

Hence, fertility in period t -1 determines labor force growth between periods t and t + 1, as well as the relative share of young to middle-aged in period t. Moreover, together with the survival probability p i t , it also affects the old-dependency ratio (L i o /L i m ) in period t + 1.

Production. There is a unique good used for consumption and investment. Gross output in period t is given by

Y i t = (K i t ) α A i t L i m,t 1-α ,
where K i t denotes the capital stock at the end of period t -1, and A i t is labor-augmenting productivity, which grows at rate γ i A,t+1 between period t and t+1. Labor and capital markets are competitive. Assuming full capital depreciation over a generation, the wage w i t in period t and the gross rate of return R i t between period t -1 and t are given by

w i t = (1 -α)A i t (k i t ) α and R i t = α(k i t ) α-1 , (1)
where

k i t ≡ K i t /(A i t L i m,t
) denotes the capital-effective-labor ratio.

Social Security. An agent who reaches retirement in period t receives pension benefits i t w i t-1 , where i t denotes the replacement rate in that period. The 'pay-as-you-go' social security system is financed by taxing the labor income of middle-aged workers at rate τ i t . Assuming that the system runs a balanced budget in every period, the contribution and replacement rates must satisfy L i m,t τ i t w i t = L i o,t i t w i t-1 , which is equivalent to

w i t w i t-1 τ i t = p i t-1 n i t-2 i t . (2)
A higher old-dependency ratio (p i t-1 /n i t-2 ), or smaller wage growth (w i t /w i t-1 ), exerts pressure on the financing of the retirement system-which needs to adjust through a combination of a higher contribution rate (τ i t ) and/or a smaller replacement rate ( i t ).

Preferences and Budget Constraints. Let c i g,t denote the consumption of an agent belonging to generation g in period t. A young household in period t -1 maximizes

U i t-1 = u(c i y,t-1 ) + βu(c i m,t ) + β 2 p i t u(c i o,t+1 ), β ∈ ]0, 1].
Per period utility is given by u(c) = c 1-1/σ 1-1/σ , where σ ≤ 1 denotes the elasticity of intertemporal substitution (e.i.s.). [START_REF] Attanasio | Consumption and Saving: Models of Intertemporal Allocation and Their Implications for Public Policy[END_REF] Utility maximization is subject to the flow budget constraints:

c i y,t-1 + a i y,t-1 = 0, (3)
c i m,t + a i m,t = 1 -τ i t w i t + R i t a i y,t-1 , (4)
c i o,t+1 = R i t+1 a i m,t p i t + i t+1 w i t . (5)
When young, the household needs to borrow to finance consumption. We denote by a i y,t-1 < 0 the value of their end-of-period net asset holdings. In middle age, labor income is used for debt repayment, contribution to social security, consumption, and asset accumulation (a i m,t ). At the end of middle age, the assets held by the agents who die are transferred within the household to those who survive, so that an elderly individual receives gross income R i t+1 a i m,t /p i t from savings. In old age, agents consume all available resources, including social security benefits.

Credit Constraint. A young household in period t -1 faces the constraint

a i y,t-1 ≥ -θ i t-1 w i t R i t ,
where θ i t-1 measures the level of credit market development in period t -1. For tractability, we assume that the constraint is binding in every period, which implies that 6

c i y,t-1 = -a i y,t-1 = θ i t-1 w i t R i t . (6)
Saving Decision in Middle Age. Combining (4)-( 6) together with the first-order optimality condition with respect to c i m,t yields the amount of assets accumulated by the middle-aged:

a i m,t = p i t (1 -τ i t -θ i t-1 ) p i t + β -σ (R i t+1 ) 1-σ w i t - β -σ (R i t+1 ) 1-σ p i t + β -σ (R i t+1 ) 1-σ p i t i t+1 w i t R i t+1 . (7)
The first term in (7) captures the fact that the middle-aged's propensity to save out of their disposable income is increasing in their survival probability p i t . [START_REF] Backus | Demography and Low-Frequency Capital Flows[END_REF] In the presence of social security ( i t+1 > 0), the second term corresponds to the reduction in savings induced by [START_REF] Attanasio | Consumption and Saving: Models of Intertemporal Allocation and Their Implications for Public Policy[END_REF] The assumption σ ≤ 1 is standard and in line with the empirical evidence. Estimates of the elasticity of intertemporal substitution are typically between 0.1 and 0.8 (see footnote 27 for references to the literature). [START_REF] Bacchetta | The Demand for Liquid Assets, Corporate Saving, and Global Imbalances[END_REF] This assumption, which can be formulated as a restriction on parameter values (see Remark A-1 in Appendix A), is relaxed in the quantitative analysis. [START_REF] Backus | Demography and Low-Frequency Capital Flows[END_REF] Our analysis assumes that τ i t < 1 -θ i t-1 , which ensures that net disposable income in middle age after debt repayment, (1 -τ i t -θ i t-1 )w i t , is positive.

the prospect of receiving retirement benefits in old age. This term can be interpreted as intergenerational borrowing: essentially, the middle-aged borrow against their future pension benefits, i.e., against the contributions levied on the middle-aged workers of the next period.

Integrated Equilibrium

Under financial integration, capital flows freely across borders until rates of return are everywhere equal to the world interest rate. That is, financial integration in period t implies that

R i t+1 = R t+1 and k i t+1 = k t+1
, for all i. Equilibrium in the world capital market requires that

i L i y,t a i y,t + L i m,t a i m,t = i K i t+1 = k t+1 i A i t+1 L i m,t+1 .
Using (1), ( 2), (6), and (7), this condition can be rewritten as

k t+1 i n i t-1 (1 + γ i A,t+1 )A i t L i m,t 1 + 1 -α α θ i t + β -σ R 1-σ t+1 p i t + β -σ R 1-σ t+1 τ i t+1 = (1 -α)k α t i A i t L i m,t p i t (1 -τ i t -θ i t-1 ) p i t + β -σ R 1-σ t+1 . (8)
The left-hand side of (8) represents the world supply of assets. In any country i, the asset supply is increasing in the ability to borrow over the lifecycle (θ i t ) and across generations (τ i t+1 ), where the latter effect comes from the middle-aged implicitly borrowing against their future pension benefits. Higher fertility (n i t-1 ) and faster productivity growth (γ i A,t+1 ) also have a positive impact on the asset supply by increasing the share of young borrowers in the economy and their borrowing capacity, respectively, and by stimulating investment-through a higher marginal productivity of capital. [START_REF] Bekaert | Does Financial Liberalization Spur Growth[END_REF] The right-hand side of the equation represents the global 'gross' demand for assets by the middle-aged, which corresponds to the first term in (7). Asset demand is decreasing in the contribution rate levied on the middle-aged savers (τ i t ), and in their past ability to borrow (θ i t-1 ). Equation ( 8), together with (1), governs the dynamics of the world economy.

Steady State with Common Demographics.

To analyze the determinants of the world interest rate and capital flows, it is useful to consider a steady-state configuration in which [START_REF] Bekaert | Does Financial Liberalization Spur Growth[END_REF] Holding the contribution rate τ i t+1 constant, higher values of n i t-1 and γ i A,t+1 also lead to an increase in the replacement rate i t+1 (thanks to a lower old-dependency ratio and higher wage growth), and hence to greater borrowing by the middle-aged against their future pension benefits.

countries share the same demographics (n i t = n, p i t = p) and productivity growth (γ i A,t = γ A ), but potentially differ in terms of credit access and social security (θ i t = θ i , τ i t = τ i ). We denote the weighted-average levels of credit constraints and contribution rates across countries by

θ = i λ i θ i and τ = i λ i τ i , (9)
respectively, where

λ i = A i t L i m,t / j A j t L j m,t
is the constant share of country i in the world effective labor force. The balanced budget constraint faced by the social security system in each country implies that

i = n p (1 + γ A )τ i , i = 1, ..., N, (10)
i.e., higher contribution rates are associated with more generous replacement rates. This constraint also implies that a change in demographic variables requires an adjustment of the pension systems. To capture such adjustment in a tractable way, we assume that 9

- ∂τ i /τ i ∂n/n = ∂τ i /τ i ∂p/p = ε, ε ≥ 0.
When ε > 0, an increase in the old-dependency ratio is-partly, fully, or more than-absorbed by a rise in the contribution rate. [START_REF] Bernanke | The Global Saving Glut and the U.S. Current Account Deficit. Sandridge Lecture[END_REF] At the same time, as long as ε < 1, social security systems adjust to population aging at least partly through a lower replacement rate.

Lemma 1. Under the assumptions stated above, the integrated world economy converges to a unique steady state, in which the world interest rate R satisfies

R = n(1 + γ A ) p 1 -τ -θ p α 1 -α + θ + β -σ R 1-σ α 1 -α + θ + τ . ( 11
)
The steady-state interest rate is increasing in fertility and decreasing in longevity if τ < τ † , where the threshold τ † is defined in Appendix A. The interest rate R is also increasing in the ease of credit access θ and in the level of social security τ . [START_REF] Benhima | A Reappraisal of the Allocation Puzzle through the Portfolio Approach[END_REF] That is, the steady-state contribution rate τ i is assumed to be an isoelastic function of the old-dependency ratio p/n. The assumption ε ≥ 0 captures the notion that the contribution rate is adjusted upwards in response to aging. In view of (10), the replacement rate i has elasticities -d ln i /d ln n = d ln i /d ln p = -(1 -ε). [START_REF] Bernanke | The Global Saving Glut and the U.S. Current Account Deficit. Sandridge Lecture[END_REF] Political economy considerations suggest that a rise in the old-dependency ratio could lead to an increase in the replacement rate (see for example Galasso et al. (2004)), which corresponds to the case ε > 1. Then, the increase in contribution rate must also compensate for the rise in i .

While it is easy to see that, in the absence of social security, population aging leads to a lower interest rate, the picture is less clear in the presence of social security. [START_REF] Best | Estimating the Elasticity of Intertemporal Substitution Using Mortgage Notches[END_REF] A drop in fertility (n) causes the interest rate to fall by reducing investment and the share of young borrowers in the economy. Higher longevity (p) contributes to the reduction in R by raising the propensity to save of the middle-aged. In the presence of social security, on top of these effects, a change in demographic variables also affects the interest rate indirectly through the adjustment of pension systems. An increase in the contribution rate reduces the disposable income of the middle-aged, thus dampening the increase in net savings and the associated fall in the interest rate. On the other hand, a reduction in the replacement rate reduces the borrowing of the middle-aged against their future retirement benefits, thus reinforcing the fall in R. Lemma 1 establishes that, as long as the average level of social security is not too high, the intuitive result that aging causes a fall in the interest rate is maintained. [START_REF] Bloom | Demographic Change, Social Security Systems, and Savings[END_REF] The lemma further states that looser credit and more developed social security both lead to higher interest rates by increasing the supply of assets (through an increase in intertemporal and intergenerational borrowing, respectively) and by reducing the demand for assets (through a fall in the net disposable income of the middle-aged).

Shadow Autarky Rates and the Direction of Capital Flows. Capital flows reflect differences in autarky rates across countries-namely, countries that export capital are those where low interest rates would prevail under autarky. The autarky (steady-state) interest rate of any given country satisfies (11) with the country's own demographic and institutional characteristics in place of the world parameters. The comparative statics derived in Lemma 1, when interpreted cross-sectionally, thus shed light on differences in autarky rates and on the direction of capital flows. First, holding everything else constant, countries with tighter credit constraints (low θ i ) and/or less developed social security systems (low τ i ) have lower autarky interest rates and therefore tend to experience capital outflows towards the rest of the world.

Likewise, 'older' countries with low fertility and high longevity tend to have more depressed autarky rates and are more likely to be capital exporters (we further discuss the impact of country-specific aging on capital flows in Section 2.3).

Thinking in terms of shadow autarky rates is also useful to understand the impact of global aging on capital flows. When countries differ in their ability to borrow over the lifecycle and/or across generations, their autarky interest rates respond differently to a common demographic change. We now characterize the capital flows that arise as a result of this mechanism.

Global Aging and Capital Flows

This section focuses on the impact of global aging on capital flows when countries differ in terms of credit markets and social security-abstracting from cross-country heterogeneity in demographics. We show that, under mild conditions, worldwide population aging tends to generate uphill capital flows from emerging countries (low θ, low τ ) to advanced economies (high θ, high τ ), especially when the associated fall in the world interest rate is large. We first discuss the mechanism in the context of cross-country differences in access to credit, and then turn to the case of heterogeneous social security.

Heterogeneity in Credit Constraints. Consider two countries, H and L, that only differ in the tightness of their credit constraints, with θ L < θ < θ H . To simplify the discussion and abstract from any effect driven by social security, assume that τ H = τ L = τ = 0. [START_REF] Bolt | The Maddison Project: Collaborative Research on Historical National Accounts[END_REF] In the integrated steady state, country L, which has a tighter constraint, is a creditor, while country H is a debtor-reflecting differences in their autarky rates. [START_REF] Borsch-Supan | Aging, Pension Reform, and Capital Flows: A Multi-Country Simulation Model[END_REF] Furthermore, the steady-state net foreign asset positions of the two countries are such that

∆ N F A ≡ N F A L t Y L t - N F A H t Y H t = (1 -α) n(1 + γ A ) R + p p + β -σ R 1-σ (θ H -θ L ) > 0.
Global aging affects the dispersion in net foreign asset positions ∆ N F A to the extent that it exerts a different impact on net asset demand across countries. In the present configuration, countries H and L are differently impacted by world aging for three reasons. [START_REF] Brooks | Population Aging and Global Capital Flows in a Parallel Universe[END_REF] First, a fall in fertility (n) implies a smaller share of young borrowers. Since credit constraints are looser in country H, the change in demographic composition leads to a greater increase in net savings in that country, which tends to reduce ∆ N F A . Second, a rise in longevity (p) causes an increase in the propensity to save of the middle-aged. Since a smaller fraction of middle-age labor income [START_REF] Bolt | The Maddison Project: Collaborative Research on Historical National Accounts[END_REF] The results derived in Proposition 1 apply to the more general case where τ H = τ L ≥ 0 and τ ≥ 0. 14 Countries' net foreign asset positions in the steady state are given by (A-54) in Appendix A.1. [START_REF] Brooks | Population Aging and Global Capital Flows in a Parallel Universe[END_REF] It is worth noting that, in the more general case τ H = τ L ≥ 0, the effects of aging on net savings driven by social security are irrelevant since they affect the two countries symmetrically, and therefore do not affect the dispersion in net foreign asset positions.

is spent on debt repayment in country L, a higher propensity to save translates into a greater rise in net savings in that country, leading to an increase in ∆ N F A . The third channel arises from the interaction between the equilibrium adjustment of the world interest rate to aging and heterogeneity in credit constraints. In both countries, a fall in R leads to more borrowing by young households and, for σ < 1, more savings by the middle-aged. The former effect is stronger in country H where credit constraints are looser, while the latter effect is larger in country L where a smaller fraction of middle-age labor income goes into debt repayment.

As a result, net savings increase by more (or fall by less) in country L, and the interest rate channel contributes to an increase in ∆ N F A . This discussion suggests that (i) a global rise in longevity associated with a fall in the world interest rate leads to greater dispersion in the NFA positions of the two countries; whereas (ii) for a drop in fertility to have the same qualitative impact, the fall in the world interest rate needs to be large enough-so that the interest rate channel dominates the demographic composition effect. Proposition 1 confirms and generalizes these insights, establishing sufficient conditions under which global aging generates uphill capital flows from low-θ to high-θ countries. These conditions are expressed in terms of the elasticities η n ≡ ∂R/R ∂n/n and η p ≡ -∂R/R ∂p/p , which capture the equilibrium response of the world interest rate to aging. [START_REF] Buera | Productivity Growth and Capital Flows: The Dynamics of Reforms[END_REF] Proposition 1. Consider the steady state of the world economy as characterized in Lemma 1, and suppose that there exist two countries, H and L, such that θ L < θ H and τ H = τ L . Then, the difference in normalized net foreign asset positions between the two countries,

∆ N F A = N F A L t /Y L t -N F A H t /Y H t > 0, is decreasing in global fertility if η n ≥ 1 and increasing in world longevity if η p ≥ 0.
In the appendix, we derive weaker conditions on the elasticities η n and η p for uphill flows to arise as a result of worldwide aging-and show that they are amply satisfied for reasonable parameter values. 17 Furthermore, we prove that the larger the fall in the world interest rate, the larger the increase in NFA dispersion. Figure 2.1 illustrates the mechanism in the transition for realistic parameter values, depicting the dynamics of net foreign asset positions across two countries that differ only in the tightness of their credit constraints.

Heterogeneity in Social Security. Now consider two countries, H and L, that only differ in their public retirement systems, with τ L < τ < τ H , and assume that θ L = θ H = θ. In the integrated steady state country L is a creditor, while country H is a debtor. The difference in net foreign asset positions across the two countries is given by

∆ N F A = (1 -α) p p + β -σ R 1-σ τ H -τ L + β -σ R 1-σ p + β -σ R 1-σ p( H -L ) R > 0.
To make the contrast as stark as possible, suppose that country L has no social security system at all (τ L = L = 0). In this context, world aging affects the net asset demands of countries H and L differently through three distinct channels. First, an increase in survival probability raises the propensity to save of the middle-aged, which has a greater impact on net savings in country L-where middle-aged workers have more disposable income since they do not pay social security taxes. This direct channel thus tends to increase the dispersion in NFA positions across the two countries. [START_REF] Campbell | Consumption-Based Asset Pricing[END_REF] Second, upon a fall in R, the interest rate channel also contributes to an increase in ∆ N F A : the middle-aged in country H tend to borrow more against their future pensions via a positive wealth effect and, for σ < 1, the higher propensity to save exerts a greater impact on savings in country L. Third, the social security system in country H needs to adjust to the demographic pressure. An increase in the contribution rate (τ H ) lowers the net income of the middle-aged, which causes their savings to fall-thus reinforcing the dispersion in NFA positions. On the contrary, a cut in the replacement rate ( H ) causes an increase in the savings of the middle-aged, which tends to reduce ∆ N F A .

Hence, the interplay between global aging and heterogeneity in social security can trigger uphill capital flows-from low-to high-τ countries. This outcome is more likely when the induced fall in the world interest rate is large and when public pension systems adjust mostly through higher contributions. The next proposition confirms and generalizes these insights.

Proposition 2. Consider the steady state of the world economy as characterized in Lemma 1, and suppose that there exist two countries, H and L, such that θ H = θ L and τ L < τ H . Then, the difference in normalized net foreign asset positions between the two countries,

∆ N F A = N F A L t /Y L t -N F A H t /Y H t > 0,
is decreasing in global fertility and increasing in world longevity if η n ≥ η n and η p ≥ η p , respectively, where the thresholds η n and η p , defined in Appendix A, are decreasing in the elasticity of the contribution rates to aging, ε.

The conditions under which uphill capital flows arise as a result of global aging are largely satisfied for reasonable parameter values. [START_REF] Carroll | A Tractable Model of Precautionary Reserves, Net Foreign Assets, or Sovereign Wealth Funds[END_REF] The increase in NFA dispersion is stronger when the equilibrium fall in the world interest rate is larger (i.e., high η n , η p ) and when a greater share of the social security adjustment goes through contributions (i.e., high ε). [START_REF] Carvalho | Demographics and Real Interest Rates: Inspecting the Mechanism[END_REF] Empirical Implications. The above results imply that, in and of itself, the worldwide aging trend illustrated in Figure 1 can act as a driver of capital flows. Specifically, to the extent that emerging economies are characterized by tighter access to credit and less developed social security systems, our theory predicts that global aging tends to trigger uphill capital flows. [START_REF] Campbell | Consumption-Based Asset Pricing[END_REF] This is reinforced by the fact that an increase in p lowers the rate R/p at which middle-aged households discount future benefits-which reduces middle-age savings in country H through a positive 'wealth effect'. [START_REF] Carroll | A Tractable Model of Precautionary Reserves, Net Foreign Assets, or Sovereign Wealth Funds[END_REF] Appendix A establishes sufficient conditions in terms of parameter values. See also Figure A.5. [START_REF] Carvalho | Demographics and Real Interest Rates: Inspecting the Mechanism[END_REF] A higher elasticity of the contribution rate to aging dampens the fall in R (i.e., η n and η p are lower), which reduces the strength of the interest rate channel. However, through its impact on the sign and magnitude of the social security channel, a higher value of ε reinforces uphill capital flows. Notes: Parameter values are α = 0.3, β = 0.96 (annual), σ = 1/2, γ A = 1% (annual), θ = 8%. In the initial steady state, n = 2, p = 0.4, with replacement rates H = 50% and L = 10%. In the final steady state, n = 1.1, p = 0.8, with replacement rates H = 38.6% and L = 7.7% (i.e., ε = 0.8). Changes in fertility and longevity occur between periods 0 and 2. A period is 25 years, N = 2, countries H and L are of equal size.

More broadly, if one were to rank countries in terms of credit access (θ i ) and generosity of public pensions (τ i ), Propositions 1 and 2 characterize how the response of capital flows to a common aging trend differs across countries according to their relative positions. In the quantitative part of our analysis, we carefuly measure these two dimensions of cross-country heterogeneity and evaluate the relevance of these mechanisms to understand the dispersion of capital flows.

Country-Specific Aging and Capital Flows

We now discuss the effects of country-specific demographic evolutions on capital flows. To abstract from the general equilibrium effect of aging on the interest rate, we consider a small open economy (SOE)-say, country i (with weight λ i ≈ 0). The following proposition characterizes the impact of country i's own demographics on its NFA position. [START_REF] Ca'zorzi | Thousands of Models, One Story: Current Account Imbalances in the Global Economy[END_REF] Proposition 3. Country i's NFA position in period t is determined by lagged fertility, n i t-1 , and the longevity of the middle-aged, p i t . Furthermore, i. If i t+1 = 0, country i's NFA position is decreasing in fertility and increasing in longevity.

ii. If i t+1 > 0, country i's NFA position is decreasing in fertility and increasing in longevity if ε i t+1 ≤ εn and ε i t+1 ≤ εp , respectively, where ε i t+1 denotes the elasticity of the contribution rate τ i t+1 to the old-dependency ratio L i o,t+1 /L i m,t+1 , and the thresholds εn and εp are defined in Appendix A.

The impact of demographic variables on the NFA position of a small open economy is analogous to their effect on the country's (shadow) autarky interest rate. A drop in fertility and/or a rise in longevity directly leads to an improvement in the country's NFA position-as captured by statement (i) in Proposition 3. However, such demographic changes also operate indirectly via the adjustment of the pension system. [START_REF] Chinn | A New Measure of Financial Openness[END_REF] The sign and magnitude of this indirect effect depends on the form of the adjustment, captured by the elasticity ε i t+1 . A decrease in the replacement rate reinforces the direct effect of aging on the country's NFA position, while an increase of the contribution rate works in the opposite direction. For reasonable parameter values, the thresholds εn and εp are both largely above unity. Thus, for any realistic adjustment of the contribution rate to aging, lower fertility and higher longevity both translate into an increase in net foreign asset holdings.

Empirical Implications. According to Proposition 3, countries with more vibrant demographics tend to be debtors, while older ones tend to be creditors. Over time, holding everything else constant (including global demographics), a fall in fertility or a rise in longevity in a given country tends to be associated with capital outflows-although to a lesser extent when a larger share of the social security adjustment goes through an increase in contributions.

Numerical Illustration. Figure 2.3 illustrates the response of capital flows to country-

specific aging for an emerging SOE-characterized by credit constraints that are tighter than in the rest of the world, and by a less developed social security system. The emerging SOE starts from an initial autarky steady state and integrates to the world economy at date t = 0.

While both the SOE and the rest of the world are aging, the emerging country is initially characterized by higher fertility and lower longevity. Over time, the demographic patterns of the SOE converge to those of the rest of the world. Panel (a) of Figure 2.3 corresponds to a [START_REF] Chinn | A New Measure of Financial Openness[END_REF] Recall that L i o,t+1 /L i m,t+1 = p i t /n i t-1 . Hence, a change in n i t-1 and/or p i t must cause an adjustment of the contribution rate τ i t+1 and/or the replacement rate i t+1 for the balanced budget condition to remain satisfied. Independently of the pace of convergence, saving and investment rates in the emerging economy both increase upon integration (bottom-right corner of each panel). However, the speed of convergence affects the timing and magnitude of their respective increases. In the case of a fast demographic convergence, savings increase faster than investment, leading the SOE to export capital (panel (a)). Instead, with a more prolonged convergence, the rise in savings is delayed-as the composition effect induced by a fall in fertility (i.e., relatively less young borrowers) and the increase in middle age savings caused by a rise in longevity both set in more slowly-while the increase in investment at opening is stronger, as fertility is expected to remain high for some time before converging. As a result, in the latter scenario, the small emerging country initially borrows from the rest of the world (panel (b)). Theory thus predicts that, depending on the speed of demographic convergence, capital may either flow uphill towards the rest of the world, or downhill towards emerging economies.

Quantitative Analysis

This section evaluates the ability of our theory to account for the patterns of capital flows observed across the world over the last decades. Our quantitative model enriches the analytical framework of Section 2 along several dimensions. We first describe the augmented setup and its calibration. The assessment of the model's quantitative performance follows.

A Multi-Period OLG Model

Countries are populated with agents whose economic life runs for at most J + 1 periods. We denote by p i j,t the probability that an agent of age j = 0, . . . , J in period t and country i survives to the next period (by construction, p i J,t = 0 for all i and t). Taking mortality into account, the number of agents reaching age 1 ≤ j ≤ J in period t is given by

L i j,t = j-1 =0 p i ,t-j+ L i 0,t-j ,
where the size of the youngest active age group evolves exogenously according to 23

L i 0,t+1 = (1 + γ i L,t+1 )L i 0,t .
Production. Agents potentially work all their life. Gross output in country i is given by

Y i t = (K i t ) α A i t J j=0 e i j,t L i j,t 1-α = A i t Li t (k i t ) α ,
where Li t ≡ J j=0 e i j,t L i j,t denotes the total efficiency-weighted population, and

k i t = K i t /(A i t Li t )
denotes the capital-effective-labor ratio. The set of efficiency weights {e i j,t } J j=0 captures the shape of the age-income profile in period t and country i. The labor income received by an agent of age j in period t and country i is w i j,t = e i j,t w i t , where

w i t ≡ (1 -α)A i t (k i t ) α .
Finally, the gross rate of return between t -1 and t is

R i t = 1 -δ + α(k i t ) α-1
, where δ denotes the depreciation rate of capital over one period. Social Security. An agent of age j > J in period t and country i receives social security benefits π i j,t equal to a fraction i t of labor income earned at age J, that is, π i j,t = i t w i J,t-j+J . Social security contributions are levied on labor income at a flat rate τ i t . For the social security system to be balanced in every period, the paths of contribution and replacement rates must be such that

τ i t J j=0 L i j,t w i j,t = i t J j=J+1 L i j,t w i J,t-j+J . (12)
Unintentional Bequests. Let a i j,t denote the end-of-period net asset holdings of an agent of age j in period t. The aggregate wealth of agents who die at the end of period t, given by

Q i t ≡ J-1 j=0 (1 -p i j,t )L i j,t a i j,t , (13)
is equally redistributed as lump-sum transfers to a subset of agents-namely, agents of age j ∈ B who survive to the next period. [START_REF] Choukhmane | Demography, Domestic Savings and the Current Account: a Demographic Perspective on Global Imbalances[END_REF] Denoting by q i j,t the wealth transfer received by a [START_REF] Chinn | Medium-Term Determinants of Current Accounts in Industrial and Developing Countries: An Empirical Exploration[END_REF] Any sequence {γ i L,t } can equivalently be expressed as an explicit sequence of (past) fertility rates, at the cost of more cumbersome notation. In the steady state, γ i L,t = γ i L coincides with the overall population growth rate in country i. [START_REF] Choukhmane | Demography, Domestic Savings and the Current Account: a Demographic Perspective on Global Imbalances[END_REF] When an indebted agent dies, the (riskfree) loan is effectively repaid by bequest recipients.

surviving agent of age j at the end of period t, we thus have q i j,t = 0 for j / ∈ B and

q i j,t = Q i t m∈B p i m,t L i m,t for j ∈ B. (14)
Individual Optimization. Let c i j,t denote the consumption of an agent of age j in period t and country i. An agent who enters active life in period t maximizes

U i t = u(c i 0,t ) + J j=1 j-1 =0 p i ,t+ β j u(c i j,t+j ), (15)
with isoelastic preferences u(c) = (c 1-1 σ -1)/(1 -1 σ ), subject to the flow budget constraints

c i j,t+j + a i j,t+j = R i t+j (a i j-1,t+j-1 + q i j-1,t+j-1 ) + (1 -τ i t )w i j,t + π i j,t 0 ≤ j ≤ J, (16)
with the notational convention a i -1,t-1 = q i -1,t-1 = 0 and π i j,t = 0 for all j ≤ J. The agent also faces a sequence of credit constraints of the form

a i j,t+j ≥ -θ i t+j p i j,t+j H i j+1,t+j+1 R i t+j+1 for j ≤ J -1 and a i J,t+ J ≥ 0, (17)
where H i j,t denotes the expected discounted present value of current and future labor income for an individual who reaches age j in period t, namely,

H i j,t = w i j,t + J-j τ =1 τ -1 s=0 p i j+s,t+s w i j+τ,t+τ τ s=1 R i t+s for j ≤ J -1 and H i J,t = w i J,t .
Equilibrium. For a given evolution of demographics, productivity, credit tightness, and replacement rates, the model equilibrium consists of sequences for the capital-effective-labor ratios {k i t }, consumption c i j,t , asset holdings a i j,t , wealth transfers q i j,t , and contribution rates {τ i t } such that: (i) all agents maximize their lifetime expected utility (15) subject to the sequence of budget constraints (16) and credit constraints (17); (ii) the consistency condition (14) between wealth transfers and unintentional bequests holds; (iii) the social security budget constraint (12) is satisfied; and (iv) the market for capital clears in every period, either locally (under financial autarky) or globally (under integration).

Calibration

This section presents our baseline quantitative experiment and provides a detailed description of the calibration of common and country-specific model parameters.

Experiment. We simulate the model over a large sample of countries, each having its own demographic, credit market, and social security characteristics. To isolate the role of demographics, countries share a common growth rate of productivity. Demographics are held constant until 1950, when the demographic transitions begin. Countries start from their autarky steady states and remain in autarky until they integrate financially in 1980. All changes are anticipated. In the long run, fertility rates converge to the same level across countries and the global economy converges to a final integrated steady state. Appendix B provides a detailed description of the numerical solution method (see Section B.5, in particular).

Country Sample. To obtain the sample of countries included in the experiment, we start by considering the 100 most populated economies in 1990. Focusing on population size rather than GDP enables us to obtain a well-balanced sample of advanced and developing countries.

We then remove two types of countries whose capital flows are largely driven by factors outside of our model. Namely, we exclude major energy-exporting countries, [START_REF] Cihak | Benchmarking Financial Development Around the World[END_REF] as well as countries plagued by very deadly conflicts-which usually experience massive capital flights or large capital inflows to sustain war efforts. [START_REF] Coeurdacier | Credit Constraints and Growth in a Global Economy[END_REF] Finally, we eliminate countries for which some of the inputs needed for our simulations are missing. This leaves us with a sample of 70 countries, covering all areas of the globe and accounting for 91% of world GDP (85% of world population) in 2000. The list of countries in our final sample is provided in Appendix C.2.

Common Parameters. We now turn to the calibration of model parameters that are common across countries, summarized in Table 1. A period lasts for 5 years, which corresponds to the frequency at which demographic data are available. Adult life runs for at most 16 periods-which map into age brackets 20-24, 25-29, . . . , 95-99-and agents receive social security benefits after age 64.

Preferences and Technology. Preference and technology parameters are set to standard values, in line with the literature. We set the discount factor β to 0.96 annually. The elasticity of Age-Income Profile. Efficiency parameters are assumed to be constant over time and common across countries (e i j,t = e j ), and are set to match the age-income profile in the U.S. (relative to the 50-54 age bracket), based on labor income data by age groups from the American Community Survey for the year 2005. The age-income profile in the U.S. is very stable over the period 1990-2010, hence our results are not sensitive to the choice of year 2005.

Bequest Transfers. We assume that unintentional bequests are evenly redistributed across individuals of age 25-59, reflecting bequests towards children and grandchildren. Results are barely sensitive to alternative redistribution schemes.

Country-Specific Parameters. Next, we describe our approach to calibrating the parameters that capture the key dimensions of heterogeneity emphasized by our theory. Measuring these over a large sample of countries, comprising both developed and emerging economies, constitutes an important aspect of our quantitative exercise. [START_REF] De Silva | Population Control Policies and Fertility Convergence[END_REF] Demographics and Country Size. Calibrated values for demographic parameters are based on data from the United Nations (World Population Prospects), available at a 5-year frequency. [START_REF] De Nardi | Why Do the Elderly Save? The Role of Medical Expenses[END_REF] The vast majority of the empirical literature finds estimates of the elasticity of intertemporal substitution between 0.1 and 0.8. Among other references, see Hall (1988), Attanasio and Weber (1993), Ogaki and Reinhart (1998), Vissing-Jørgensen (2002), Yogo (2004), and Best et al. (2017), as well as the surveys by Campbell (2003) and Attanasio and Weber (2010). Lifecycle saving models typically use values between 0.3 and 0.5 (e.g. Scholz, Seshadri, and Khitatrakun (2006) and De Nardi, French, and Jones (2010)), while the macro asset pricing literature (discussed in Guvenen (2006)) often assumes higher values closer to unity. [START_REF] De Silva | Population Control Policies and Fertility Convergence[END_REF] Appendix C provides further details on the data used in the calibration and on calibrated parameter values for all countries in the sample. Our dataset is available upon request.

With worldwide coverage, the data provides population composition and survival probabilities (from the life tables) by age groups over the period 1950-2015, and also includes demographic forecasts until 2100. In the initial steady state of a given country i, the survival probabilities p i j are set to their 1950 values, while the population growth rate γ i L is chosen to best match the observed age composition in 1950. For years 1955, 1960, . . . , 2015, the growth rate of the youngest age group γ i L,t as well as the survival probabilities p i j,t are set to their data counterparts. [START_REF] Domeij | Population Aging and International Capital Flows[END_REF] For the period 2015-2100, we proceed similarly, matching the U.N. forecasts.

Post-2100, survival probabilities are held constant at their 2100 values and population growth is set to zero in all countries. Initial population and productivity levels are set to match relative population size and GDP across countries in 2000.

Credit Constraints. To calibrate country-specific credit constraint parameters, we rely on household debt data collected from various sources. Such data, however, is missing for some countries in our sample. To remediate this issue, we predict household debt-to-GDP ratios for these countries based on variables that are observable and correlated with household debt, namely, the fraction of the population aged 15 and above with a mortgage, the fraction having ever borrowed from a financial institution, and private credit over GDP. [START_REF] Eggertsson | A Model of Secular Stagnation: Theory and Quantitative Evaluation[END_REF] As a baseline, credit constraint parameters are assumed to be time-invariant (θ i t = θ i ). For a given country i, the ratio θ i /θ U S is chosen to match household debt to GDP in country i (observed or predicted) relative to the U.S. in 2005. [START_REF] Eugeni | An OLG Model of Global Imbalances[END_REF] The resulting heterogeneity in credit market development is substantial-with constraints about 5 to 10 times tighter in emerging countries than in advanced economies. The remaining free parameter, θ U S , is set to match aggregate savings over GDP in the U.S. in 2005 (17.7%), leading to a value of 16%. [START_REF] Fehr | Will China Eat Our Lunch or Take Us to Dinner? Simulating the Transition Paths of the United States, the European Union, Japan, and China[END_REF] An alternative experiment considered in Section 4 allows for time-varying constraints, to better account for credit market evolutions over the last decades (deepening until 2008, followed by tightening).

Social Security. To calibrate social security systems for all the countries in our sample, we proceed in two steps (see Appendix C.5 for details). First, we collect information on pay- [START_REF] Domeij | Population Aging and International Capital Flows[END_REF] As displayed in Appendix C.3, the model matches the observed age composition fairly well (although not perfectly, partly due to migration flows). Accordingly, when survival probabilities are instead calibrated to match the age composition data, our quantitative results are barely affected. [START_REF] Eggertsson | A Model of Secular Stagnation: Theory and Quantitative Evaluation[END_REF] See Appendix C.4 for a detailed description. The predictive regression is estimated over the period 1990-2015 on the set of 54 countries for which household debt data are available. The R 2 of the regression is 0.83 and the predicting variables are highly significant. Using alternative predictors yields very similar results. [START_REF] Eugeni | An OLG Model of Global Imbalances[END_REF] Household debt data are available for a large set of countries post-2000. We choose 2005 for consistency with the calibration of social security, but cross-sectional differences are very persistent over the period. [START_REF] Fehr | Will China Eat Our Lunch or Take Us to Dinner? Simulating the Transition Paths of the United States, the European Union, Japan, and China[END_REF] Figure C.4 in the appendix displays the calibrated values of credit constraint parameters for all the countries in our sample in relation to their household debt-to-GDP ratios.

as-you-go systems across countries from the Social Security Administration website. For each country, we construct a schedule of replacement rates for an average income earner, as a function of the number of years of contribution. Taking the difference between country-specific ages of retirement and labor market entry to proxy for the number of years of contribution, we thus obtain an official replacement rate, denoted by ˜ i . [START_REF] Ferrero | A Structural Decomposition of the U.S. Trade Balance: Productivity, Demographics and Fiscal Policy[END_REF] However, one also needs to account for the actual coverage of social security programs, which varies a lot across countries. In developing countries, for instance, typically few workers contribute to the official system and qualify for any benefits. In our framework, lower coverage translates into lower contribution and replacement rates. As a second step, we thus adjust for coverage, using data from the World Social Security Report (ILO). [START_REF] Gagnon | Understanding the New Normal: The Role of Demographics[END_REF] The data provides two different measures of coverage: the percentage of retired receiving benefits, χ i B , and the percentage of the working age population contributing to pensions, χ i C . [START_REF] Galasso | Lessons for an Ageing Society: The Political Sustainability of Social Security Systems[END_REF] The former measure is typically above the latter, reflecting the existence of universal minimum benefits. In our baseline calibration, we set the effective replacement rate in country i to

i = χ i B + χ i C 2 ˜ i ,
taking the average of χ i B and χ i C to alleviate concerns about measurement error or potential biases in each of the two measures. Section 4 performs sensitivity analysis, considering the

alternative calibrations i B = χ i B ˜ i and i C = χ i C ˜ i . 36

Model vs. Data

In the spirit of Domeij and Floden (2006), we simulate capital flows in the calibrated model and confront the model predictions to their data counterpart. Because many emerging countries had capital account restrictions until the late-1980s/early-1990s (see Bekaert et al. (2005) and Chinn and Ito ( 2008)), we focus on capital flows from 1990-2015. Net capital flows are [START_REF] Ferrero | A Structural Decomposition of the U.S. Trade Balance: Productivity, Demographics and Fiscal Policy[END_REF] Other studies have computed (official) replacement rates for a restricted number of countries. When such data exists, we check that our measure is in line with alternative sources (see Appendix C.5). [START_REF] Gagnon | Understanding the New Normal: The Role of Demographics[END_REF] ILO data are based on surveys conducted for the vast majority in 2005/2006, which is why we focus on 2005 in the calibration. The data is available for most countries in our sample. When it is missing, we predict the coverage rate based on correlated variables using a logistic regression (see Appendix C.5). [START_REF] Galasso | Lessons for an Ageing Society: The Political Sustainability of Social Security Systems[END_REF] Figure C.5 in the appendix confirms that large disparities exist around the world according to both measures. In low income countries, about 20-30% of the population is covered by social security on average, compared to 70-80% in more advanced economies. [START_REF] Gourinchas | Capital Flows to Developing Countries: The Allocation Puzzle[END_REF] In our view, i B (resp. i C ) provides an upper bound (resp. a lower bound) for the effective replacement rate. Our baseline calibration uses the average between these two bounds. measured as current account over GDP, averaged over five-year periods, for each of the 70 countries in our sample. Due to some missing current account observations, the data consists of an unbalanced panel of 402 country×period observations. Methodology. Let ca d i,t (resp. ca m i,t ) denote the current account-to-GDP ratio of country i in period t as observed in the data (resp. as predicted by the model). To assess the quantitative performance of our model, we consider the regression equation

ĉa d i,t = γ ĉa m i,t + i,t , (18)
where

ĉa d i,t = ca d i,t -ca d t (resp. ĉa m i,t = ca m i,t -ca m t )
, and i,t is a residual capturing the variation in the data that is orthogonal to the model. Both the data and the model predictions are demeaned in the cross section (period by period) to deal with the fact that current account data are not balanced. [START_REF] Gourinchas | External Adjustment, Global Imbalances, Valuation Effects[END_REF] Equation ( 18) is estimated as a pooled regression, in the 'between' and 'within' dimensions, and in the cross section in each period. Moreover, we also consider the time-differenced version of ( 18), looking at the cross section of changes in current accountto-GDP ratios over a 20-year period (1995-2015). [START_REF] Guvenen | Reconciling Conflicting Evidence on the Elasticity of Intertemporal Substitution: A Macroeconomic Perspective[END_REF] Performance Metrics. To evaluate the model's ability to account for observed capital flows and compare performance across alternative calibrations, we report a couple of basic statistics.

A 'good' model should be such that the R 2 of regression ( 18) is high and the estimate of γ is close to unity. The R 2 on its own can be misleading: a model that yields a negative regression coefficient is not a good one, even if it has a high R 2 . As a (reliable) summary measure of distance between model and data, we compute the normalized mean squared error

D = var( ĉa d -ĉa m ) var( ĉa d ) . ( 19
)
The distance metric D reflects the variation in the data that the model cannot account for.

Conditionally on the coefficient γ being unity, the regression R 2 is exactly equal to 1 -D.

Regression coefficient

Distance R-squared Notes: For each specification, the top panel shows the estimate of the slope coefficient in regression (18) along with its 5% confidence interval, the middle panel displays the distance between model and data as defined by (19), and the bottom panel shows the regression R 2 . Regressions are performed with pooled data (standard errors clustered at the country level), in the cross section by years, in the between and within dimensions, and in the cross section of changes over the period 1995-2015. Model-predicted current account-to-GDP ratios are obtained under the baseline calibration described in Section 3.2.

Results

Figure 3.1 plots the estimate of γ with its 5% confidence interval, the distance D between model and data, and the R 2 of regression (18) for all specifications: pooled, cross sections by year, between, within, and 1995-2015 change. In the pooled regression and in all years except 1990, the coefficient estimate is close to unity, and the R 2 is between 20% and 35%. [START_REF] Hall | Intertemporal Substitution in Consumption[END_REF] In the between dimension, the model's fit to the data is even better, with an R 2 close to 40%.

Performance deteriorates substantially in the within dimension (γ significantly below 1 and [START_REF] Hall | Intertemporal Substitution in Consumption[END_REF] Results for the year 1990 should be taken with caution. As discussed in Section 4.1, performance in that year improves a lot when one excludes observations for countries that had very low capital account openness. Notes: For each country in the scatter plot, the x-coordinate (resp. y-coordinate) corresponds to the average current account over GDP predicted by the model (resp. observed in the data) over 1990-2015. Model and data are demeaned in each period. The solid (grey) line is the 45 degree line and the dashed (red) line is the regression line. Model predictions are obtained under the baseline calibration described in Section 3.2. low R 2 ), but the model fares better when looking at current account changes over 1995-2015 (γ not significantly different from 1). Inspection of the distance measure across different specifications corroborates these conclusions. As expected, when the estimate of γ is around unity, the regression R 2 is very close to 1 -D. Henceforth, when summarizing performance for alternative model calibrations, we only report the estimated slope and the distance metric.

In short, the model does a good job at matching current account data in the cross section, but less so over time. The model's ability to capture long-term trends in capital flows and their dispersion across countries is illustrated in Figure 3.2, which displays the model's fit to the data in the between dimension.

Capital Flows over Time by Regions/Countries. To assess the time variation that our model is able to capture-as well as where it fails-it is useful to compare current account series as predicted by the model (ca m i,t ) to those observed in the data (ca d i,t ). It also predicts that an emerging market like China replaces Old Europe/Japan as major world creditor. These trends are expected to continue in the future. In particular, due to the increasing share of elderly together with generous pension systems, Europe and Japan should eventually turn into borrowers.

The top-right panel in the figure zooms in on the evolution of current account positions within Old Europe/Japan. Having aged faster than Continental Europe, Japan is initially the main creditor. Over time, due to aging in Europe and the rising share of elderly in Japan, differences in current account balances diminish. Within Continental Europe, Portugal, an initially younger country with relatively easy access to credit and a generous social security system, is a net external borrower-while France, an older country with comparatively tighter credit and less generous pensions, is a net lender. [START_REF] Higgins | Demography, National Savings and International Capital Flows[END_REF] and South and Central Asia. This pattern becomes more pronounced over time, as other emerging markets that are aging faster become creditors-South-East Asia, followed by Latin America. Overall, these two panels illustrate the role of demographics as a key driver of differences in capital flows across emerging countries. [START_REF] Krueger | On the Consequences of Demographic Change for Rates of Returns to Capital, and the Distribution of Wealth and Welfare[END_REF] Nonetheless, while our model captures the broad trends well, it does miss the fast current account reversal in South-East Asia around the 1997 financial crisis-and similarly for Latin America around the mid 2000s. That low-frequency demographic evolutions have a hard time accounting for high-frequency variations in the data is not very surprising. At higher frequency, business cycle fluctuations and financial shocks are better candidates to explain capital flows.

The World Interest Rate. According to the theory, capital flows in our framework are partly driven by the fall in the world interest rate induced by population aging. The analysis of Section 2 sheds light on the forces that drive the drop in the interest rate [START_REF] Higgins | Demography, National Savings and International Capital Flows[END_REF] The calibrated credit constraint parameters (θ i ) for Portugal and France are 12.4% and 8.1%, respectively, and their effective replacement rates ( i ) are 68.8% and 40.3%. [START_REF] Krueger | On the Consequences of Demographic Change for Rates of Returns to Capital, and the Distribution of Wealth and Welfare[END_REF] Because fast-aging emerging countries also tend to be the ones that are growing faster (e.g., South-East Asia versus slow-growing but younger Sub-Saharan Africa), demographic factors may help explain why the (negative) correlation between current account and growth predicted by the standard neoclassical model fails to hold across emerging countries-which Gourinchas and Jeanne (2013) refer to as an 'allocation puzzle'. implied by the model (see Lemma 1). Beyond the direct impact of the worldwide decline in fertility and mortality on global savings and investment, the drop in the interest rate also results from the fact that, over time, the world (weighted-average) level of credit access and social security falls. Indeed, despite their own aging, emerging countries experience higher demographic growth than the rest of the world-leading to an increase in their relative size and a fall in θ and τ , in terms of the notations introduced in (9). By making net asset demand less sensitive to a change in the interest rate, a lower e.i.s. coefficient σ implies a larger interest rate drop, as illustrated in the figure (see also Lemma A-2 in the appendix).

To assess how the presence of less developed countries affects the evolution of the world interest rate, we perform the same experiment on high-income OECD countries. [START_REF] Lane | Long-Term Capital Movements[END_REF] Although the quantitative effects are mild, comparing interest rate paths across experiments reveals that, until 2005, the decline in interest rate is slightly stronger in the rich-country experiment, while the presence of emerging countries accelerates the fall after 2005. This pattern is consistent with cross-country differences in the timing of the fertility drop (Figure 1). While most of the drop occurs between the mid-1950s and the late-1970s in advanced economies, the convergence of emerging countries starts in the late-1960s-with a 15-year lag-and continues today. In the rich-country experiment, the interest rate is not predicted to decrease much further post-2025, as the rising share of elderly with a low propensity to save mitigates the other effects of aging. When including emerging countries, the fall in interest rate is 30 basis points larger by 2030 and is expected to be more prolonged. [START_REF] Lane | The External Wealth of Nations Mark II: Revised and Extended Estimates of Foreign Assets and Liabilities, 1970-2004[END_REF]

Inspecting the Mechanisms

In our framework, capital flows are driven by demographic evolutions-both common and country-specific-and their interactions with cross-country heterogeneity in credit constraints and social security. To disentangle the various forces at play, we run a series of alternative experiments and compare their implications for capital flows to the baseline and the data. For the sake of brevity, we focus on results in the between dimension, although findings are very similar in other specifications. Notes: For each calibration, the top panel shows the estimate of the regression coefficient in (18) with its 5% confidence interval, while the bottom panel displays the distance between model and data as defined by (19).

Model and data are averaged in the between dimension. In columns 1-3, model predictions are obtained by holding demographic characteristics fixed to their 1950 values, by holding fertility fixed while setting longevity parameters p i j,t to their baseline values, and by holding longevity fixed while setting fertility parameters γ i L,t

to their baseline values, respectively. Column 4 corresponds to the baseline (Section 3.2). In column 5 (right axis), demographic parameters in all countries are set to the population-weighted world average.

('longevity only'). Compared to the 'no aging' experiment, the fit of the model improves very slightly-the distance between model and data remains large and the regression coefficient is barely significant. Hence, rising longevity on its own does not explain much of the crosssectional dispersion in capital flows. Conversely, keeping survival probabilities fixed at their 1950 values in each country, we let fertility evolve as in the data. The model's fit improves significantly, with a slope coefficient close to unity. However, the distance between model and data remains higher than in our baseline-with an R 2 around 30% compared to 40% in the baseline. Taken together, these findings establish the primary importance of the fertility decline for our results, but also indicate the relevance of rising longevity when combined with changes in fertility. As the fraction of middle-aged individuals in the economy increases after a drop in fertility, the rise in life expectancy has a more significant impact on aggregate savings.

Country-Specific vs. Global Aging. Last, we consider an experiment where all countries share the same demographics, reflecting the world average fertility and mortality rates. Shutting down demographic differences across countries isolates the effect of global aging on capital flows and reveals the importance of country-specific aging patterns for our results. In this counterfactual, capital flows massively from developing to developed countries ( panel (b)), echoing the results of Propositions 1 and 2. [START_REF] Lee | The Demographic Transition: Three Centuries of Fundamental Change[END_REF] Although this experiment captures some of the uphill flows observed in the recent period (see countries in the upper-right and bottom-left quadrants of the panel), it counterfactually predicts that the average developing country is a capital exporter. Hence, the estimated slope coefficient is negative and the model's fit to the data is extremely poor (Figure 3.5, last column). Cross-country differences in demographics are therefore crucial in matching the downhill flows observed in the data. Notes: For each calibration, the top panel shows the estimate of the slope coefficient in (18) along with its 5% confidence interval, while the bottom panel displays the distance between model and data as defined by (19). Model and data are averaged in the between dimension. Model predictions are obtained under the baseline calibration, in the absence of credit constraints (θ = ∞), in the absence of social security ( = 0), and when credit constraint and social security parameters are set to their U.S. values in all countries (last column).

The Role of Credit Constraints and Social Security. In another set of experiments, we assess the importance for our results of combining worldwide aging with (heterogeneous) credit markets and social security. Keeping demographic parameters at their baseline values, we first remove credit constraints in all countries. In this simulation, predicted capital flows are overly dispersed compared to the data (Figure 3.6, panel (c)). The model implies too much borrowing by debtor countries and, via a general equilibrium effect, too much lending by creditors. In particular, the model generates excessively large external deficits in young emerging countries and-at odds with the data-it also predicts that advanced economies with highly developed credit markets (such as the U.S.) are creditors. Hence, this model does significantly worse than our baseline, with a regression coefficient well below unity (Figure 3.7, column 2). In a second experiment, we shut down social security in all countries ( = 0). In this simulation, regions characterized by generous pension systems (e.g., Old Europe/Japan, Central and Eastern Europe) export much more capital than in the data, whereas emerging countries with less generous pensions end up borrowing more heavily-again generating too much dispersion relative to the data. [START_REF] Leff | Dependency Rates and Savings Rates[END_REF] Finally, we consider a last experiment where all countries have the same level of credit [START_REF] Leff | Dependency Rates and Savings Rates[END_REF] The scatter plot illustrating the model's fit to the data for this calibration is provided in Appendix D.

market and social security development as the U.S. (Figure 3.7, last column). In this counterfactual, capital flows are exclusively driven by cross-country differences in demographics.

The fit between model and data is much worse than in our baseline, as the model essentially generates (excessive) downhill flows towards younger countries and countries that are expected to age more slowly (Figure 3.6, panel (d)).

Summary. These counterfactual experiments establish the crucial role played by worldwide demographic evolutions in the model's ability to qualitatively and quantitatively account for the patterns of capital flows seen in the data. While cross-country differences in demographics are key to generate capital flows towards younger developing economies, worldwide aging-in combination with heterogeneous credit constraints and social security-is essential to match the magnitude of these downhill flows, and to generate some uphill flows towards advanced economies with highly developed credit markets and/or more generous pension systems.

Sensitivity and Extensions

This section explores the sensitivity of our baseline quantitative results along several dimensions. In particular, we consider alternative calibrations of the model that incorporate time variation in credit constraints and replacement rates.

Sensitivity Analysis

First, we assess the sensitivity of the model's performance with respect to the value of the e.i.s. coefficient, the level of credit constraints, and the measure of country-specific replacement rates. We also discuss the impact on our quantitative results of excluding observations when countries have a very low degree of financial openness.

Elasticity of Intertemporal Substitution.

To the extent that it affects the strength of the equilibrium adjustment of the world interest rate to global aging-and thereby cross-country differences in their saving response to aging-the value of the elasticity of intertemporal substitution (σ) matters quantitatively. Given the range of empirical estimates in the literature, we investigate the predictions of our model with a lower e.i.s. (σ = 0.25) and a higher e.i.s.

(σ = 0.75), in the lower and upper range of empirical estimates. For comparison, we also show results for σ = 1 and for values of the e.i.s. above 1. Notes: For each calibration, the top panel shows the estimate of the regression coefficient in (18) along with its 5% confidence interval, while the bottom panel displays the distance between model and data as defined by (19). Model and data are averaged in the between dimension. Model predictions are obtained for different values of the e.i.s. coefficient σ. All other parameters are set to their baseline values, as per Section 3.2. As observed in the figure, the model's ability to account for worldwide capital flows is robust as long as the e.i.s. coefficient does not exceed 1. For an e.i.s. between 0.25 and 0.75, the slope coefficient γ is not significantly different from unity (although the point estimate is closer to unity for a lower σ) and the distance between model and data is not much affected.

Regression coefficient

For higher values of the e.i.s., the performance of the model deteriorates: the estimated γ is significantly below unity and the distance between model and data increases. As shown in Figure 3.4, the world interest rate adjustment to demographic changes is smaller for higher values of σ-and cross-country differences in saving responses to world aging are dampened as a result. [START_REF] Lisack | Demographic Trends and the Real Interest Rate[END_REF] Conversely, the fall in the world interest is reinforced for lower values of the e.i.s.: for σ = 0.25, the model explains almost all of the fall observed in the data since 1990.

Credit Constraint Parameters and Replacement Rates.

To analyze the sensitivity of our results with respect to the overall level of credit constraints, we consider simulations [START_REF] Lisack | Demographic Trends and the Real Interest Rate[END_REF] For higher values of the e.i.s., the model wrongly predicts Anglo-Saxon countries to be large creditors and fails to reproduce the uphill flows observed in the data. See between scatter plot for σ = 2 in Figure D.2. Notes: For each calibration, the top panel shows the estimate of the regression coefficient in (18) along with its 5% confidence interval, while the bottom panel displays the distance between model and data as defined by (19). Model and data are averaged in the between dimension. Model predictions are obtained under the baseline calibration, with tighter or looser credit constraints (parameters θ i being set 50% below baseline in the 'low θ' experiment and 50% above in the 'high θ' experiment), and with country-specific replacement rates computed using the coverage of beneficiaries, B , and of contributors, C (see Appendix C.5 for a detailed description of social security data). All other parameters are set to their baseline values, as per Section 3.2.

Regression coefficient

in which the country-specific parameters θ i are set 50% below and 50% above their baseline values. The model's performance under these alternative calibrations is shown in Figure 4.2 (columns 2 and 3, respectively) for the between variation. Relative to the baseline, estimates of the slope coefficient γ are barely affected, but the distance between model and data increases significantly when credit constraints are loosened in all countries. To better match the data, it thus seems important to have rather tight credit constraints globally, although cross-sectional heterogeneity in their level is also key to the model's success (Figure 3.7). We investigate as well the robustness of our findings to alternative measures of replacement rates. Namely, we consider the country-specific replacement rates i B and i C defined in Section 3.2, obtained by using either the percentage of retired receiving pension benefits ( B ) or the percentage of contributors in the working-age population ( C ) to adjust official replacement rates for social security coverage. Results are barely affected (Figure 4.2, columns 4 and 5).

Capital Account Restrictions. Our baseline experiment assumes that all countries in the sample are fully integrated financially from 1980 onwards. In reality, while many countries lifted capital account restrictions in the 1970s and 1980s, quite a few developing countries did so progressively and remained fairly closed to capital account transactions until the mid-1990s (Chinn and Ito (2008)). This may explain the poor performance of the model in the 1990 cross section (Figure 3.1, column 2). As a sensitivity check, we remove country-year observations for which the Chinn and Ito capital account openness index (kaopen i t ) takes its lowest possible value-leaving us with 373 observations instead of 402. [START_REF] Lucas | Why Doesn't Capital Flow from Rich to Poor Countries?[END_REF] While results are essentially unaffected for other years, the fit between model and data is significantly better for the 1990 cross section: the estimated slope coefficient γ becomes not statistically different from 1, and the distance metric falls by 23%.

Time-Varying Credit Constraints and Social Security

Time-Varying Credit Constraints. Our baseline calibration assumes a constant level of credit constraints over the entire period, focusing only on cross-country heterogeneity. As a result, the model does not match the worldwide increase in household debt observed in the data until the 2007-2009 financial crisis, nor the subsequent fall. To capture this pattern, we feed the model with an exogenous worldwide increase in the credit supply followed by a contraction. To do so, at each date, country-specific credit constraint parameters θ i are multiplied by a world credit supply shifter, θ t . [START_REF] Mendoza | Financial Integration, Financial Development and Global Imbalances[END_REF] The evolution of this time-varying parameter, normalized to one in 2005, is set to match the growth rate of household debt over GDP in the U.S. over the period 1980-2015. In this experiment, a worldwide credit boom precedes a phase of deleveraging in the recent period. The model's fit to capital flows data improves substantially: in the between dimension, the distance measure falls by 10% and the R 2 of the regression reaches 47%. [START_REF] Obstfeld | Foundations of International Macroeconomics[END_REF] Time-Varying Replacement Rates. Our baseline experiment assumes that, when confronted with population aging, countries adjust their contribution rates in order for the social security system to remain balanced-while replacement rates are held constant. The lack of times-series data for a large cross section of countries prevents us from fully calibrating the [START_REF] Lucas | Why Doesn't Capital Flow from Rich to Poor Countries?[END_REF] Specifically, 14 observations are excluded in 1990, 5 in 1995, 2 in 2000, 3 in 2010, and 5 in 2015. In the early 1990s, most excluded observations are for Central and Eastern European countries. [START_REF] Mendoza | Financial Integration, Financial Development and Global Imbalances[END_REF] That is, we set θ i t = θ t θ i , where θ i is as in the baseline (based on household debt over GDP in country i relative to the U.S. in 2005) and θ 2005 = 1. This calibration assumes that the speed of financial development over the period is common across countries. See Appendix D.3 for further details. [START_REF] Obstfeld | Foundations of International Macroeconomics[END_REF] In all specifications but the 2005 cross section, the distance measure between model and data is reduced, with the largest improvement for the 2015 cross section. model to the realized path of social security adjustments. However, we perform sensitivity analysis with respect to the adjustment of the generosity of pensions to aging, under the assumption that the form of the adjustment is common across countries. Specifically, in the spirit of Section 2, we assume that aging triggers a fall in the replacement rate according to

log( i t ) = log( i 2005 ) -(1 -ε) log OldDep i t OldDep i 2005 , (20)
where i 2005 denotes the replacement rate in country i in 2005 as constructed from the data, OldDep i t measures the old-dependency ratio (population above 65 divided by the number of individuals aged 20-65) in country i at date t, and (1 -ε) captures the downward elasticity of replacement rates to population aging. [START_REF] Obstfeld | Global Imbalances and the Financial Crisis: Products of Common Causes[END_REF] In our baseline calibration, replacement rates do not adjust to population aging, which corresponds to the case ε = 1. We perform sensitivity analysis using values for ε between 0 and 1. Figure D.4 in Appendix D shows that, as one reduces ε from its baseline value of 1 towards 0, the distance between model and data increases monotonously, although moderately. Even if half of the social security adjustment goes through lower replacement rates (ε = 0.5), the estimated slope coefficient γ remains not statistically different from unity (in the between dimension and other specifications).

Hence, the model's quantitative performance is robust as long as a substantial fraction of the adjustment occurs through higher contribution rates, rather than going entirely through a reduction in replacement rates. [START_REF] Ogaki | Measuring Intertemporal Substitution: The Role of Durable Goods[END_REF] In particular, for higher values of ε, the model is better able to match current account deficits in South and Eastern European countries with highly generous pension systems, in accord with the analysis of Section 2.2 (Proposition 2).

Conclusion

This paper develops a multi-country overlapping generations model where countries differ in their aging prospects and in their access to credit markets and social security. In this model, global aging can be a potent driver of capital flows as the response of savings to a common demographic trend differs across countries. In particular, global aging can generate uphill capital flows-whereby emerging countries export capital to more advanced economies, which [START_REF] Obstfeld | Global Imbalances and the Financial Crisis: Products of Common Causes[END_REF] Consistent with the notation of Section 2, the parameter ε captures the elasticity of contribution rates to population aging. For countries that have fully private systems in 2005 (implying that i 2005 = 0), i t is set equal to zero at all dates. [START_REF] Ogaki | Measuring Intertemporal Substitution: The Role of Durable Goods[END_REF] A scatter plot illustrating the model's fit to the data for ε = 0 is provided in Appendix D (Figure D.5).

have more developed financial markets and a broader social security coverage. Differences in aging patterns across countries also trigger capital flows, which are typically going downhill: emerging markets that are aging at a slower pace are importing capital. By combining these two forces, our framework can account for the substantial cross-sectional heterogeneity in the direction and magnitude of capital flows among emerging and advanced economies.

The quantitative assessment of the theory on a large sample of emerging and advanced economies establishes the relevance of these mechanisms in understanding the international allocation of capital. Given the calibrated heterogeneity in credit constraints and social security, we find that worldwide demographic evolutions explain about a third of the cross-sectional dispersion of capital flows, and model-implied flows move one-for-one with the data. Overall, the model does remarkably well in reproducing the patterns of capital flows observed across countries, both emerging and developed, over the last three decades.

A common view on the global allocation of capital is that emerging countries do not seem to import enough capital, in particular the fast-growing ones (Lucas (1990), Gourinchas and Jeanne ( 2013)). Our findings indicate that, when focusing on demographics as a driver of capital flows-to the extent that countries differ in their ability to transfer resources over time and across generations-the data are in line with the predictions of the theory. Our framework provides a natural starting point to further study the efficiency of the global allocation of capital and understand why some fast-growing emerging countries act as capital exporters.

If countries that experience high productivity growth are also aging faster on average, demographics could help explain this 'allocation puzzle'. Furthermore, the non-Ricardian nature of our environment can be useful to understand the role played by the public sector in shaping capital flows (Alfaro, Kalemli-Ozcan, and Volosovych (2014)). We leave a careful examination of these important questions for future research.

Policy makers across the world are concerned with the implications of population aging.

Our work sheds light on some of the issues at stake and opens the possibility for a number of policy counterfactuals on external imbalances-e.g., to assess the impact of pension system adjustments in some large economies on the global allocation of capital and the return to capital. Our multi-country quantitative model would be well-suited for this type of analysis.

A Appendix to Section 2

This appendix contains the proofs of the propositions derived in Section 2 of the paper, along with additional material. Section A.0 analyzes the determinants of autarky interest rates. Sections A.1-A.3 correspond to Sections 2.1-2.3 of the paper. Section A.4 contains supplementary figures.

A.0 Autarky Equilibrium

To start with, we derive the law of motion that governs the dynamics of an economy under autarky (for notational convenience, we drop the country superscript throughout this section).

Total asset holdings in period t are given by

W t ≡ L y,t a y,t + L m,t a m,t .
Under the assumption that the credit constraint is binding (see Remark A-1 below), the asset holdings of the young are given by

a y,t = -θ t w t+1 R t+1 . (A-1)
To obtain the optimal asset holdings of the middle-aged, we combine ( 4)-( 6) together with the first-order optimality condition with respect to middle age consumption in period t,

(c o,t+1 ) 1/σ = βp t R t+1 p t (c m,t ) 1/σ = βR t+1 (c m,t ) 1/σ ,
which yields (7). It follows that

W t = -L y,t θ t w t+1 R t+1 + L m,t p t (1 -τ t -θ t-1 ) p t + β -σ R 1-σ t+1 w t - β -σ R 1-σ t+1 p t + β -σ R 1-σ t+1 p t t+1 w t R t+1 = L m,t -n t-1 θ t w t+1 R t+1 + p t (1 -τ t -θ t-1 ) p t + β -σ R 1-σ t+1 w t - β -σ R 1-σ t+1 p t + β -σ R 1-σ t+1 n t-1 τ t+1 w t+1 R t+1 = A t L m,t p t (1 -τ t -θ t-1 ) p t + β -σ R 1-σ t+1 (1 -α)k α t -n t-1 (1 + γ A,t+1 ) 1 -α α θ t + β -σ R 1-σ t+1 p t + β -σ R 1-σ t+1 τ t+1 k t+1 , (A-2)
Furthermore, we impose the following restrictions on parameter values

α ∈ ]0, 1[, β ∈ ]0, 1], σ ∈ ]0, 1], p ∈ ]0, 1], n > 0, γ A ≥ 0, θ ≥ 0, τ ≥ 0 and θ + τ < 1.
Although not needed for our derivations, it is natural to assume that n ≥ 1, so that the population size does not tend to zero over time. Note that a fertility rate of n in the model should be interpreted as a fertility rate of 2n in practice.

Lemma A-1. Under the assumptions stated above, the economy converges to a unique steady state, in which the interest rate R ≡ R(n, p, γ A , θ, τ, α, β, σ) satisfies

R = n(1 + γ A ) p(1 -τ -θ) p α 1 -α + θ + β -σ R 1-σ α 1 -α + θ + τ . (A-6)
The interest rate is increasing in the ease of credit access θ and in the level of social security τ .

Proof: Under the constant parameter assumption, (A-3) becomes

n(1 + γ A ) 1 + 1 -α α θ + β -σ R 1-σ t+1 p + β -σ R 1-σ t+1 τ k t+1 = p(1 -τ -θ) p + β -σ R 1-σ t+1 (1 -α)k α t . (A-7)
Using the identity k t+1 = αk α t+1 /R t+1 implied by (1), this can be rewritten as

n(1 + γ A ) p + β -σ R 1-σ t+1 p(1 -τ -θ)R t+1 α 1 -α + θ + β -σ R 1-σ t+1 p + β -σ R 1-σ t+1 τ = k t k t+1 α , which is equivalent to n(1 + γ A ) p(1 -τ -θ) p α 1-α + θ R t+1 + β -σ α 1-α + θ + τ R σ t+1 = R t+1 R t α 1-α . (A-8)
Existence and Uniqueness. In view of (A-8), if a steady state exists, the steady-state value of the interest rate, R, must be such that

n(1 + γ A ) p(1 -τ -θ) p α 1-α + θ R + β -σ α 1-α + θ + τ R σ = 1. (A-9)
The left-hand side of the equation is strictly decreasing in R, goes to ∞ as R ↓ 0, and converges to zero as R → ∞. Hence, (A-9) admits a unique solution, which pins down the we differentiate (A-20) with respect to p, R, and τ . Taking into account the fact that ∂τ /τ ∂p/p = ε, i.e., dτ = ετ p dp, we obtain

p(1 -τ -θ) -(1 -σ)n(1 + γ A ) α 1 -α + θ + τ (βR) -σ dR = n(1 + γ A ) α 1 -α + θ -(1 -τ -θ)R dp + ετ p pR + n(1 + γ A )β -σ R 1-σ dp. (A-24)
The term that multiplies dR is positive per (A-12), as above. Hence, the inequality ∂R/∂p < 0 holds if and only if the condition

(1 -τ -θ)R -n(1 + γ A ) α 1 -α + θ -ετ R + n(1 + γ A ) p β -σ R 1-σ > 0 holds. Using the fact that (1 -τ -θ)R -n(1 + γ A ) α 1 -α + θ = n(1 + γ A ) p α 1 -α + θ + τ β -σ R 1-σ ,
which follows from (A-20), the latter condition is equivalent to

n(1 + γ A ) p α 1 -α + θ + τ β -σ R 1-σ -ετ R + n(1 + γ A ) p β -σ R 1-σ > 0. (A-25)
Again, this condition is trivially satisfied when τ = 0 or ε = 0. More generally, we can write

∂R ∂p = - 1 p × n(1+γ A ) p α 1-α + θ + τ β -σ R 1-σ -ετ R + n(1+γ A ) p β -σ R 1-σ (1 -τ -θ) -(1 -σ) n(1+γ A ) p α 1-α + θ + τ (βR) -σ . (A-26)
Thresholds. The difference between the left-hand sides of (A-22) and (A-25) is equal to

n(1 + γ A ) α 1 -α + θ > 0,
which implies that, if (A-25) holds, then (A-22) holds as well. Moreover, multiplying (A-25) by pβ σ R σ-1 , it is immediate to see that this condition is equivalent to

n(1 + γ A ) n(1 + γ A ) + p(βR) σ -ε τ α 1-α + θ + τ > 0. (A-27)
For the remainder of this paragraph, suppose that ε > 0. Then (A-27) implicitly defines an upper bound on τ . Indeed, the left-hand side of the inequality is strictly decreasing in τ , converges to a strictly positive number as τ ↓ 0, and to a strictly negative number as τ ↑ (1-θ).

Hence, there exists a unique point Threshold τ † . To provide a unified treatment of the cases where ε = 0 and ε > 0, we introduce the threshold τ † ≡ τ † (n, p, γ A , θ; α, β, σ, ε) defined as

τ p ≡ τ p (n, p, γ A , θ; α, β, σ, ε) ∈ ]0, 1 -θ[ such that (A-
τ † = sup τ ∈ [0, 1 -θ[ n(1 + γ A ) n(1 + γ A ) + p[βR(τ )] σ -ε τ α 1-α + θ + τ > 0 . (A-30)
By definition, when ε = 0, then τ † = 1 -θ; and when instead ε > 0, then

τ † = τ p ∈ ]0, 1 -θ[.
The first part of Lemma A-2 follows immediately from (A-28), and from the observation that the inequalities (A-22) and (A-25) hold for ε = 0. A Special Case. In the particular case when σ = 1, the inequality (A-27) can be written as

P (τ ) ≡ -τ 2 + χ 1 τ + χ 0 > 0,
where

χ 1 = 1 -2θ - α 1 -α -ε 1 1 -α + βp α 1 -α + θ , χ 0 = (1 -θ) α 1 -α + θ .
In this case, τ † is equal to the positive root of the quadratic equation P (τ ) = 0, namely,

τ † = χ 1 + χ 2 1 + 4χ 0 2 =: ν(p, θ; α, β, ε). (A-31)
In particular, one can check that ν is decreasing in ε, is equal to 1 -θ for ε = 0, and is such

that ν ∈ ]0, 1 -θ[ for ε > 0.
Explicit Lower Bound for τ † . In view of (A-27), the threshold value τ † is decreasing in σ if and only if

∂ ∂σ β σ R(σ) σ > 0,
where we write R(σ) to make explicit the dependence of R on σ. The left-hand side of the inequality can be expressed as

∂ ∂σ β σ R(σ) σ = ln(βR) + ∂R ∂σ σ R (βR) σ .
Moreover, using (A-17), we obtain

ln(βR) + ∂R ∂σ σ R = 1 - σn(1 + γ A ) α 1-α + θ + τ (βR) -σ p(1 -τ -θ) -(1 -σ)n(1 + γ A ) α 1-α + θ + τ (βR) -σ ln(βR).
Hence, one can see that, when βR > 1, the inequality ∂(β σ R(σ) σ )/∂σ > 0 holds if and only if

p(1 -τ -θ) -n(1 + γ A ) α 1 -α + θ + τ (βR) -σ > 0,
which is indeed satisfied per (A-12). Therefore, under condition (A-18), τ † is decreasing in σ, in which case the closed-form expression in (A-31) provides a lower bound for τ † when σ < 1.

Dependence of ∂R/∂n and ∂R/∂p in σ. Next, we analyze how the response of the interest rate to a change in demographic variables is affected by the value of the elasticity of intertemporal substitution, σ. To do so, we compute

∂ ∂σ ∂R ∂x = ∂ ∂x ∂R ∂σ
, for x = n, p, by differentiating the expression for ∂R/∂σ in (A-17) with respect to n and p. Let us define

N ≡ n(1 + γ A ) α 1 -α + θ + τ β -σ R 1-σ > 0 (A-32) D ≡ p(1 -τ -θ) -(1 -σ)n(1 + γ A ) α 1 -α + θ + τ (βR) -σ > 0. (A-33)
In view of the expression for ∂R/∂σ in (A-17), we compute

∂ ∂n ∂R ∂σ = - ∂ ∂n ln(βR) × N D = - R R × N D + ln(βR) × N D -N D D 2 = - 1 D 2 (DR ) × N R + ln(βR) × (N D -N D ) , (A-34)
where we use the abbreviated notations R = ∂R/∂n, N = ∂N/∂n, and D = ∂D/∂n.

Proceeding under the assumption that condition (A-18) holds and τ < τ † , we now show that the expression in (A-34) is negative. We have shown that, if τ < τ † , then R > 0, which implies that (DR ) × (N/R) > 0. Furthermore, differentiating (A-32) and (A-33) with respect to n, we obtain

N = (1 + γ A ) α 1 -α + θ + τ β -σ R 1-σ + n(1 -σ)R -σ × R (A-35) D = -(1 -σ)(1 + γ A ) α 1 -α + θ + τ β -σ R -σ -nσR -σ-1 × R , (A-36)
Using these expressions as well as (A-32)-(A-33), we compute

N D -N D = n(1 + γ A ) 2 α 1 -α + θ + τ 2 (βR) -σ × α 1-α + θ α 1-α + θ + τ p 1 + (1 -σ)η n + β -σ R 1-σ > 0, (A-37)
where η n ≡ (∂R/R)/(∂n/n) = R ×(n/R) > 0. Since condition (A-18) ensures that ln(βR) > 0 (see Remark A-2), we conclude, in view of (A-34), that

∂ ∂σ ∂R ∂n = ∂ ∂n ∂R ∂σ < 0. (A-38)
Similarly, given the quantities N and D defined by (A-32)-(A-33), and now using the abbreviated notations R = ∂R/∂p, N = ∂N/∂p, and D = ∂D/∂p, we obtain

∂ ∂p ∂R ∂σ = 1 D 2 -(DR ) × N R + ln(βR) × (N D -N D) . (A-39)
We have shown that, if τ < τ † , then R < 0, which implies that -(DR ) × (N/R) > 0.

Furthermore, differentiating (A-32) and (A-33) with respect to p, we obtain

N = n(1 + γ A ) α 1 -α + θ + τ (1 -σ)(βR) -σ × R (A-40) D = (1 -τ -θ) + σ(1 -σ)n(1 + γ A ) α 1 -α + θ + τ β -σ R -σ-1 × R , (A-41)
and using (A-32)-(A-33) and (A-40)-(A-41), we compute

N D -N D = n 2 (1 + γ A ) 2 α 1 -α + θ + τ 2 (βR) -σ × α 1-α + θ α 1-α + θ + τ 1 + (1 -σ)η p + β -σ R 1-σ p > 0, (A-42)
where η p ≡ -(∂R/R)/(∂p/p) = -R × (p/R) > 0. In view of (A-39), we therefore conclude that, under condition (A-18),

∂ ∂σ ∂R ∂p = ∂ ∂p ∂R ∂σ > 0. (A-43)
In Remark A-5 below, we show that the impact of the e.i.s. coefficient σ on the response of the interest rate to demographic variables also applies to the elasticities of R with respect to n and p, that is, ∂η n /∂σ < 0 and -∂η p /∂σ > 0.

Remark A-4. It is enlightening to rewrite the right-hand side of (A-21) as

(1 + γ A )(p + β -σ R 1-σ ) α 1 -α + θ dn + pR dτ + pβ -σ R 1-σ d , (A-44)
where dτ = -(ετ /n)dn and d = (1 -ε) /n dn. This expression allows one to clearly distinguish the direct impact of fertility on the equilibrium interest rate (first term) from the indirect impact going through the adjustment of social security (second and third terms). The latter involves the effect driven by a change in contribution rate (dτ ) and the one driven by a change in replacement rate (d ). Since the sign of ∂R/∂n coincides with the sign of the expression in (A-44), a sufficient condition for ∂R/∂n > 0 is that the social security channel reinforces the direct effect of change in fertility, i.e.,

1 dn pR dτ + pβ -σ R 1-σ d = -pR ετ n + pβ -σ R 1-σ (1 -ε) n > 0,
which is equivalent to

τ (1 -ε)n(1 + γ A )β -σ R 1-σ -εpR > 0.
Rewriting the right-hand side of (A-24), one can show that this condition is also necessary and sufficient for the social security channel to reinforce the direct effect of a change in longevity.

For the remainder of this remark, we assume that τ > 0, so that the social security channel operates. Furthermore, noting that the above inequality is trivially satisfied when ε = 0, and trivially violated when ε ≥ 1, suppose that ε ∈ ]0, 1[. Then, the overall social security adjustment channel (strictly) contributes to a fall in R in response to aging if and only if

f (ε) := ε 1 -ε < n(1 + γ A ) p βR(τ ) -σ =: g(τ ). (A-45)
Recall that R is an increasing function of τ (see Lemma A-1, and (A-16) in particular), which goes to ∞ in the limit as τ ↑ (1 -θ), as revealed by (A-9). Therefore, the right-hand side of (A-45) is a decreasing function of τ , starting from g(0) > 0 and going to zero in the limit as τ ↑ (1 -θ). The left-hand side is an increasing function of ε, which starts from f (0) = 0 and goes to infinity as ε ↑ 1. The variations of f and g imply that:

• There exists a unique point ε

† ∈ ]0, 1[ such that f (ε † ) = g(0). Moreover, if ε ≥ ε † , then f (ε) ≥ g(τ ) for all τ . • For any ε ∈ ]0, ε † [, there exists a unique point τ * (ε) ∈ ]0, 1 -θ[ such that f (ε) < g(τ ) if
and only if τ < τ * (ε). Moreover, τ * is decreasing in ε, with limit (1 -θ) as ε ↓ 0, and zero as ε ↑ ε † .

Likewise, using (A-26), we compute

η p = - ∂R ∂p p R = n(1+γ A ) p α 1-α + θ + τ (βR) -σ -ετ 1 + n(1+γ A ) p (βR) -σ (1 -τ -θ) -(1 -σ) n(1+γ A ) p α 1-α + θ + τ (βR) -σ . (A-48)
It is worthwhile to note in passing that η n > η p , since (A-20) implies that

n(1 + γ A ) p α 1 -α + θ + τ (βR) -σ = (1 -τ -θ) - n(1 + γ A ) R α 1 -α + θ .
Special Case: Log Utility. In the particular case where σ = 1, using the fact that

n(1 + γ A ) pβR = 1 -τ -θ (1 + βp) α 1-α + θ + τ
as implied by (A-10), the expressions in (A-47) and (A-48) simplify to

η n = 1 -ετ 1 1 -τ -θ + 1 (1 + βp) α 1-α + θ + τ (A-49)
and

η p = α 1-α + θ + τ (1 + βp) α 1-α + θ + τ -ετ 1 1 -τ -θ + 1 (1 + βp) α 1-α + θ + τ , (A-50)
respectively. When furthermore τ = 0, it is immediate to see that (A-49) and (A-50) become

η n = 1 and η p = 1 1 + βp .
Impact of σ on Elasticities. We now extend the results of Lemma A-2 (see (A-38) and (A-43), in particular) regarding the impact of the e.i.s. coefficient σ on the magnitude of the interest rate response to a change in demographic variables. Again, we proceed under the assumption that condition (A-18) holds and τ < τ † . First, we compute

∂η n ∂σ ≡ ∂ ∂σ ∂R/R ∂n/n = n × ∂ ∂σ ∂R ∂n × 1 R = n R ∂ ∂σ ∂R ∂n - ∂R ∂n × ∂R ∂σ × 1 R . (A-51)
Using the notations introduced in (A-32)-(A-33) and (A-35)-(A-36), as well as the expression for ∂R/∂σ in (A-17), we write

∂R ∂n × ∂R ∂σ × 1 R = -ln(βR) × R × N DR ,
which, combined with (A-34), implies that

∂ ∂σ ∂R ∂n - ∂R ∂n × ∂R ∂σ × 1 R = - 1 D 2 (DR ) × N R + ln(βR) × N D -N D -(DR ) × N R .
If τ < τ † and (A-18) holds, then R ≡ ∂R ∂n > 0 and ln(βR) > 0. Therefore, in view of (A-51),

N D -N D -(DR ) × N R > 0 ⇒ ∂η n ∂σ < 0.
To show that the left inequality holds, we first observe that (A-21) and (A-33) imply that

DR = (1 + γ A ) p α 1 -α + θ + β -σ R 1-σ α 1 -α + θ + τ - ετ n pR + n(1 + γ A )β -σ R 1-σ .
Using this expression along with (A-20) and (A-32), we compute

(DR ) × N R = p(1 -τ -θ) α 1 -α + θ + τ β -σ R 1-σ × (1 + γ A ) - ετ n pR + n(1 + γ A )β -σ R 1-σ p α 1-α + θ + β -σ R 1-σ α 1-α + θ + τ . = (1 + γ A ) α 1 -α + θ + τ (βR) -σ × p(1 -τ -θ)R -ετ pR + n(1 + γ A )β -σ R 1-σ .
Moreover, we note that (A-37) implies

N D -N D = (1 + γ A ) α 1 -α + θ + τ (βR) -σ × n(1 + γ A ) p α 1 -α + θ 1 + (1 -σ)η n + α 1 -α + θ + τ β -σ R 1-σ > (1 + γ A ) α 1 -α + θ + τ (βR) -σ × p(1 -τ -θ)R,
where the inequality follows from (A-20) along with the fact that η n > 0. Therefore,

N D -N D -(DR ) N R > ετ (1 + γ A ) α 1 -α + θ + τ pR + n(1 + γ A )β -σ R 1-σ (βR) -σ ≥ 0,
implying that ∂η n /∂n < 0. Similarly, we compute

- ∂η p ∂σ ≡ ∂ ∂σ ∂R/R ∂p/p = p × ∂ ∂σ ∂R ∂p × 1 R = p R ∂ ∂σ ∂R ∂p - ∂R ∂p × ∂R ∂σ × 1 R . (A-52)
Using the notations introduced in (A-32)-(A-33) and (A-40)-(A-41), as well as the expression for ∂R/∂σ in (A-17), we write

∂R ∂p × ∂R ∂σ × 1 R = -ln(βR) × R × N DR ,
which, combined with (A-39), implies that

∂ ∂σ ∂R ∂p - ∂R ∂p × ∂R ∂σ × 1 R = 1 D 2 -(DR ) × N R + ln(βR) × N D -N D + (DR ) × N R .
If τ < τ † and (A-18) holds, then R ≡ ∂R ∂p < 0 and ln(βR) > 0. Therefore, in view of (A-52),

N D -N D + (DR ) × N R > 0 ⇒ ∂η p ∂σ < 0.
To show that the left inequality holds, we note that (A-42) implies that

N D -N D = n(1 + γ A ) α 1 -α + θ + τ (βR) -σ × n(1 + γ A ) p p α 1 -α + θ 1 + (1 -σ)η p + α 1 -α + θ + τ β -σ R 1-σ > n(1 + γ A )(1 -τ -θ) α 1 -α + θ + τ β -σ R 1-σ ,
where the inequality follows from (A-20) along with the fact that

η p = -R × (p/R) > 0.
Moreover, (A-26) and (A-33) imply that

DR = - 1 p n(1 + γ A ) α 1 -α + θ + τ β -σ R 1-σ -ετ pR + n(1 + γ A )β -σ R 1-σ , while (A-20) and (A-32) yield N R = p(1 -τ -θ) α 1-α + θ + τ β -σ R 1-σ p α 1-α + θ + β -σ R 1-σ α 1-α + θ + τ . Therefore, (DR ) × (N/R) is equal to n(1 + γ A )(1 -τ -θ) α 1 -α + θ + τ β -σ R 1-σ × - α 1-α + θ + τ β -σ R 1-σ p α 1-α + θ + β -σ R 1-σ α 1-α + θ + τ + ετ n(1 + γ A ) pR + n(1 + γ A )β -σ R 1-σ p α 1-α + θ + β -σ R 1-σ α 1-α + θ + τ . It is thus immediate to see that N D -N D + (DR ) × (N/R) > 0, implying that ∂η p ∂σ = - ∂ ∂σ ∂R/R ∂p/p < 0.
In view of these results, when σ < 1 and (A-18) holds, the closed-form expressions in (A-49)

and (A-50) provide lower bounds for η n and η p , respectively. Figures A.2 and A.3 in Section A.4

illustrate the magnitudes of η n and η p , respectively, as a function of parameter values.

A.1 Integrated Equilibrium

The proof of Lemma 1 relies heavily on the results derived in the previous section under financial autarky (see Lemmas A-1 and A-2, in particular). In the derivations that follow, we consider an integrated steady-state configuration in which

n i t = n, p i t = p, γ i A,t = γ A , θ i t = θ i , and
τ i t = τ i .
We proceed under the assumption that the credit constraint is binding in all countries.

Proof of Lemma 1. Starting from (8), dividing both sides by the world effective labor supply j A j t L j m,t , and using the definition of the country weights λ i , we obtain

n(1 + γ A ) i λ i 1 + 1 -α α θ i + β -σ R 1-σ t+1 p t + β -σ R 1-σ t+1 τ i k t+1 = (1 -α)k α t i λ i p(1 -τ i t -θ i ) p + β -σ R 1-σ t+1 .
Using the definition of θ and τ in (9) along with the fact that i λ i = 1 yields

n(1 + γ A ) 1 + 1 -α α θ + β -σ R 1-σ t+1 p + β -σ R 1-σ t+1 τ k t+1 = p(1 -τ -θ) p + β -σ R 1-σ t+1 (1 -α)k α t ,
which is the counterpart to (A-7) under integration. The proof of existence, uniqueness, and convergence to the integrated steady state, as well as the derivation of the implicit definition is given by

W i t = A i t L i m,t p(1 -τ i -θ i ) p + β -σ R 1-σ t+1 (1 -α)k α t -n(1 + γ A ) 1 -α α θ i + β -σ R 1-σ t+1 p + β -σ R 1-σ t+1 τ i k t+1 .
Using this expression along with the fact that

K i t+1 = A i t+1 L i m,t+1 k t+1 = n(1 + γ A )A i t L i m,t k t+1 and Y i t = A i t L i m,t k α t
, the net foreign asset position normalized by GDP is

N F A i t Y i t = (1 -α) p(1 -τ i -θ i ) p + β -σ R 1-σ t+1 -n(1 + γ A ) 1 + 1 -α α θ i + β -σ R 1-σ t+1 p + β -σ R 1-σ t+1 τ i k t+1 k α t .
In the integrated steady-state equilibrium, R t+1 = R and k t+1 /k α t = k 1-α = α/R. Therefore, the expression for the normalized net foreign asset position becomes

N F A i t Y i t = (1 -α) p(1 -τ i -θ i ) p + β -σ R 1-σ - n(1 + γ A ) R α + (1 -α) θ i + β -σ R 1-σ p + β -σ R 1-σ τ i . (A-56)
To obtain (A-54), we note that ( 11) is equivalent to

(1 -α) p(1 -τ -θ) p + β -σ R 1-σ - n(1 + γ A ) R α + (1 -α) θ + β -σ R 1-σ p + β -σ R 1-σ τ = 0, (A-57)
i.e., the world interest rate is such that the net asset demand (or NFA position) of a country with credit constraint and social security parameters θ and τ , respectively, is equal to zero.

Taking the difference between (A-56) and (A-57) gives (A-54).

Remark A-7. With a view to characterizing the impact of global aging on capital flows, it is useful to study how changes in world demographics affect total asset holdings in any given country. Considering the normalized country wealth

Ψ i ≡ W i t (1 -α)Y i t = p(1 -τ i -θ i ) p + β -σ R 1-σ - n(1 + γ A ) R θ i + β -σ R 1-σ p + β -σ R 1-σ τ i , (A-58)
we use (10) to rewrite

Ψ i = - n(1 + γ A ) R θ i + p(1 -τ i -θ i ) p + β -σ R 1-σ - β -σ R 1-σ p + β -σ R 1-σ p i R = - n(1 + γ A ) R θ i + ψ(1 -τ i -θ i ) -(1 -ψ) p i R , (A-59)
where 60) corresponds to the propensity to save of the middle-aged, which is common across countries.

ψ ≡ p p + β -σ R 1-σ ∈ ]0, 1[ (A-
It is straightforward to show that

ψ p ≡ ∂ψ ∂p = 1 p ψ(1 -ψ) > 0 and ψ R ≡ ∂ψ ∂R = - 1 -σ R ψ(1 -ψ) ≤ 0, (A-61)
with ψ R < 0 when σ < 1. Furthermore, we compute

∂ ∂R 1 -ψ R = - 1 -ψ R 2 [1 -(1 -σ)ψ] < 0. (A-62)
It is useful to also establish the dependence of ψ in σ. To do so, we compute

∂ ∂σ β -σ [R(σ)] 1-σ = -ln(βR) + ∂R ∂σ 1 -σ R β -σ R 1-σ .
Under the assumption that (A-53) holds, then βR > 1 and ∂R/∂σ < 0, implying that this expression is negative (see Remark A-2). In turn, this implies that the propensity to save ψ is increasing in σ and is therefore bounded above by its value at σ = 1. That is, when condition (A-53) holds,

ψ ≤ βp 1 + βp ≤ 1 2 , and σ < 1 ⇒ ψ < βp 1 + βp ≤ 1 2 . (A-63)
In order to evaluate the change in Ψ i caused by a change in world fertility-taking into account the adjustments of the world interest rate and of the social security system in country i, we differentiate (A-59) with respect to n, τ i , i , and R. This yields

dΨ i = - (1 + γ A ) R θ i dn -ψ dτ i -(1 -ψ) p R d i + n(1 + γ A ) R 2 θ i + (1 -τ i -θ i )ψ R -p i ∂ ∂R 1 -ψ R dR, (A-64)
where

dτ i = - ε i τ i n dn, d i = (1 -ε i ) i n dn, and dR = η n R n dn. (A-65)
Combining (A-64) with (A-61), (A-62), (A-65), and (10), we obtain

dΨ i dn = - (1 + γ A ) R θ i + ψε i n τ i -(1 -ψ) p R (1 -ε i )(1 + γ A ) p τ i + n(1 + γ A ) R 2 θ i - 1 -σ R ψ(1 -ψ)(1 -τ i -θ i ) + (1 -ψ)[1 -(1 -σ)ψ] R 2 n(1 + γ A )τ i η n R n . (A-66)
Likewise, we compute the change in Ψ i caused by a change in world longevity:

dΨ i = (1 -τ i -θ i )ψ p -(1 -ψ) i R + ψ p p i R dp -ψ dτ i -(1 -ψ) p R d i + n(1 + γ A ) R 2 θ i + (1 -τ i -θ i )ψ R -p i ∂ ∂R 1 -ψ R dR, (A-67)
where

dτ i = τ i ε i p dp, d i = - (1 -ε i ) i p dp, and dR = -η p R p dp. (A-68)
Using (A-61), (A-62), and (10), we obtain

dΨ i dp = (1 -ψ) ψ p (1 -τ i -θ i ) -(1 -ψ) n(1 + γ A ) pR τ i -ψ ε i p τ i + 1 -ψ R (1 -ε i )n(1 + γ A ) p τ i - n(1 + γ A ) R 2 θ i - 1 -σ R ψ(1 -ψ)(1 -τ i -θ i ) + (1 -ψ)[1 -(1 -σ)ψ] R 2 n(1 + γ A )τ i η p R p .
(A-69)

A.2 Global Aging and Capital Flows

The proofs of this section build extensively on Remark A-7. In view of the definition (A-55) of a country's net foreign asset position, and given the fact that the ratio K i t+1 /Y i t is equalized across countries, the difference between the normalized net foreign asset positions of two countries L and H in the integrated steady state can be expressed as

∆ N F A ≡ N F A L t Y L t - N F A H t Y H t = W L t Y L t - W H t Y H t = (1 -α) Ψ L -Ψ H , ∂∆ N F A /∂p > 0 if and only if η p > η (θ)
p , where 4 of the appendix illustrates the magnitudes of η (θ) n , η (θ) p , as well as the difference η n -η (θ) n and η p -η (θ) p , and their dependence in σ and τ . For reasonable parameter values, the conditions for global aging to induce an increase in NFA dispersion are amply satisfied (even more so for lower values of σ and τ ). Lastly, it is worthwhile to note that

η (θ) p = - ψ(1 -ψ) n(1+γ A ) R + (1 -σ)ψ(1 -ψ) < 0. (A-72) Figure A.4 in Section A.
∂ 2 ∆ N F A ∂η n ∂n < 0 and ∂ 2 ∆ N F A ∂η p ∂p > 0,
i.e., the increase in NFA dispersion induced by world aging is stronger when the equilibrium fall in the world interest rate is larger, as stated in the discussion following the proposition.

Proof of Proposition 2. We now consider two countries, H and L, such that θ H = θ L , τ L < τ H , and ε H = ε L = ε. Using (A-70) along with (A-66) and the stated assumptions on the characteristics of the two countries, we obtain

∂∆ N F A ∂n = (1 -α) ∂Ψ L ∂n - ∂Ψ H ∂n = -(1 -α) ψε n - (1 -ψ)(1 -ε)(1 + γ A ) R + (1 -ψ) (1 -σ)ψ n + (1 + γ A )[1 -(1 -σ)ψ] R η n (τ H -τ L ).
In this configuration, the inequality ∂∆ N F A /∂n < 0 holds if and only if

ψε n - (1 -ψ)(1 -ε)(1 + γ A ) R + (1 -ψ) (1 -σ)ψ n + (1 + γ A )[1 -(1 -σ)ψ] R η n > 0, which is equivalent to (1 -σ)ψ + n(1 + γ A )[1 -(1 -σ)ψ] R η n > n(1 + γ A ) R -ε n(1 + γ A ) R + ψ 1 -ψ . (A-73)
the expression for country i's NFA position in period t, normalized by GDP. Using (A-2) and

(A-55) along with (2), we find that

N F A i t Y i t ≡ W i t -K i t+1 Y i t = (1 -α)ψ i t (1 -τ i t -θ i t-1 ) - n i t-1 (1 + γ i A,t+1 ) R t+1 α + (1 -α)θ i t k t+1 k t α -(1 -α) 1 -ψ i t p i t i t+1 R t+1 , (A-78)
where, consistent with the notation introduced in (A-60), we define

ψ i t ≡ p i t p i t + β -σ R 1-σ t+1 .
Proof of Proposition 3. By inspection of (A-78), we see that the net foreign asset position of country i in period t is affected by past fertility (n i t-1 ) and by the current survival probability (p i t ), but not by other aspects of the country's demographic evolutions. We denote by ε i t+1 the elasticity of the contribution rate to the old-dependency ratio in period t + 1, assuming that its adjustment is independent of whether aging is caused by a drop in fertility or a rise in longevity. Specifically, we define

- ∂τ i t+1 /τ i t+1 ∂n i t-1 /n i t-1 = ∂τ i t+1 /τ i t+1 ∂p i t /p i t = ε i t+1 , implying that - ∂ i t+1 / i t+1 ∂n i t-1 /n i t-1 = ∂ i t+1 / i t+1 ∂p i t /p i t = -(1 -ε i t+1 ).
In view of (A-78), the change in country i's NFA position in period t caused by a change in

n i t-1 is given by d N F A i t Y i t = -α + (1 -α)θ i t 1 + γ i A,t+1 R t+1 k t+1 k t α dn i t-1 -(1 -α) 1 -ψ i t p i t R t+1 d i t+1 ,
where

d i t+1 = (1 -ε i t+1 ) i t+1 /n i t-1 dn i t-1 . We thus have ∂ ∂n i t-1 N F A i t Y i t = -α + (1 -α)θ i t 1 + γ i A,t+1 R t+1 k t+1 k t α -(1 -α) 1 -ε i t+1 1 -ψ i t p i t R t+1 i t+1 n i t-1
.

A sufficient condition for this expression to be negative is that ε i t+1 ≤ 1. More generally,

∂ 2 ∂ε i t+1 ∂n i t-1 N F A i t Y i t > 0,
and it is immediate to see that there exists a unique threshold εn > 1 such that a drop in fertility in period t -1 causes an increase in NFA/GDP in period t if and only if ε i t+1 < εn .

The change in the country's NFA position caused by a change in p i t is given by

d N F A i t Y i t = (1 -α) 1 -τ i t -θ i t-1 ∂ψ i t ∂p i t dp i t - 1 -α R t+1 ∂ ∂p i t 1 -ψ i t p i t i t+1 dp i t .
Using the fact that

∂ψ i t ∂p i t = ψ i t (1 -ψ i t ) p i t and observing that ∂ ∂p i t 1 -ψ i t p i t i t+1 = -p i t i t+1 ∂ψ i t ∂p i t + 1 -ψ i t i t+1 + p i t ∂ i t+1 ∂p i t = 1 -ψ i t -ψ i t + 1 -1 -ε i t+1 i t+1 = 1 -ψ i t ε i t+1 -ψ i t i t+1 ,
where the second equality uses ∂ i t+1 /∂p i t = -(1 -ε i t+1 ) i t+1 /p i t , we obtain

∂ ∂p i t N F A i t Y i t = (1 -α)(1 -ψ i t ) 1 -τ i t -θ i t-1 ψ i t p i t + ψ i t -ε i t+1 i t+1 R t+1 .
It is immediate to see that

∂ 2 ∂ε i t+1 ∂p i t N F A i t Y i t < 0,
and that ∂(N F A i t /Y i t )/∂p i t > 0 if and only if

ε i t+1 < 1 + 1 -τ i t -θ i t-1 R t+1 p i t i t+1 ψ i t =: εp . (A-79)
In order to gauge how restrictive this condition is, consider the case where σ = 1 and the rest of the world is in an integrated steady state as characterized in Lemma 1. Then

ψ i t = βp i t 1 + βp i t and R t+1 = n(1 + γ A ) βp(1 -τ -θ) (1 + βp) α 1 -α + θ + τ for all t.
Furthermore, consider the impact on NFA of a rise in longevity dp i t > 0 in country i, assuming that this country is similar to the average world economy in every relevant dimension, that is, n i t-1 = n, γ i A,t+1 = γ A , θ i t-1 = θ, and τ i t = τ . Evaluating the right-hand side of (A-79) at the point p i t = p, one can see that, in this special case,

∂ ∂p i t N F A i t Y i t > 0 ⇔ ε i t+1 < 1 + α 1-α + θ τ ,
which for reasonable values of α, θ and τ gives an upper threshold εp largely above one.

Remark A-8. It is worthwhile to note the natural similarity between the condition ε i t+1 < εn (resp. ε i t+1 < εp ) needed for a decrease in n i t-1 (resp. an increase in p i t ) to cause an increase in NFA and the condition ε < εn (resp. ε < εp ) needed for a drop in n (resp. rise in p) to induce a fall in the steady-state autarky interest rate (see (A-29) in the proof of Lemma A-2).

A.4 Figures

B Solution Method for the Quantitative Model

This appendix provides a detailed description of the solution method for the quantitative model considered in Sections 3 and 4.

B.1 Individual Optimization

In the environment described in Section 3.1, an agent born in period t and country i faces a sequence of gross rates of return {R i t+j+1 } J-1 j=0 , labor income {w i j,t+j } J j=0 , social security taxes {τ i t+j } J j=0 , pension benefits {π i j,t+j } J j=0 , and bequest transfers {q i j,t+j } J-1 j=0 . The agent's problem under perfect foresight consists in choosing a path of consumption and asset holdings to maximize expected lifetime utility (15) subject to flow budget constraints (16) and credit constraints (17).

B.2 Autarky Steady State

Consider a steady state in country i where e i j,t = e i j , conditional survival probabilities remain constant over time (p i j,t = p i j ) and L i 0,t+1 = (1 + γ i L 0,t , so that the total population grows at constant rate γ i L , productivity grows at constant rate γ i A , and i t = i in every period. The steady-state contribution rate τ i must satisfy

τ i J j=0 L i j,t e i j w i t = i e i J J j=J+1
L i j,t w i t+J-j , which implies

τ i = i e i J J j=J+1 L i j,t J =0 e i L i ,t w i t+J-j w i t = i e i J J j=J+1 (1 + γ i L ) -j j-1 m=0 p i m J =0 e i (1 + γ i L ) - -1 m=0 p i m (1 + γ i A ) J-j . (B-1) Let k i = K i t /A i t

Li

t denote the autarky steady-state level of capital-efficient-labor ratio in country i, where Li t ≡ J j=0 e i j,t L i j,t . The market clearing condition at the end of period t is

K i t+1 = A i t+1 Li t+1 k i = J-1 j=0 L i j,t a i j,t . (B-2)
In order to determine the steady state equilibrium, we need to characterize net asset holdings a i j,t for a given value of k i . It is useful to observe that, in the steady state, a i j,t should grow over time at rate γ i A , while the total amount of unintentional bequests Q i t grows at rate

γ i Y = (1 + γ i A )(1 + γ i L ) -1.
Thus, there exists {ã i j } J-1 j=0 and Qi such that a i j,t = ãi j w i t-j , for all j, t (B-3)

Q i t = Qi L 0,t w i t , for all t. (B-4)
Using this observation, we solve for the steady-state autarky equilibrium in two steps.

Step 1: As a preliminary step, we analyze the joint determination of the values of {ã i j } J-1

j=0
and Qi for a candidate steady-state interest rate R i = 1 -δ + α(k i ) α-1 . First, we show how to solve for {ã i j } taking Qi as given. Starting from ( 14) and using (B-4), we note that in the steady state, the level of bequests received at the end of period t by an agent of age j ∈ B can be expressed as

q i j,t = Q i t m∈B p i m L i m,t = Qi L i 0,t m∈B p i m L i m,t w i t = Qi m∈B p i m m-1 =0 p i (1 + γ i L ) m -1 w i t = Qi m∈B p i m m-1 =0 p i (1 + γ i L ) m -1
(1 + γ i A ) j w i t-j =: qi j w i t-j .

(B-5)

Moreover, the labor income received in period t by a worker of age j is

w i j,t = e i j w i t = e i j (1 + γ i A ) j w i t-j =: wi j w i t-j ,
and the amount of pensions received in period t by an agent of age j > J is π i j,t = i w i J,t+J-j = i e i J w i t+J-j = i e i J (1 + γ i A ) J w i t-j =: πi j w i t-j . Now, consider the individual optimization problem of an agent born in period t -j. This agent faces a sequence of labor income w i j,t = wi j w i t-j , constant tax rate τ i , pension transfers π i j,t = πi j w i t-j and wealth transfers q i j,t = qi j w i t-j . Since in our environment the solution to the individual optimization problem is homogeneous of degree one in the level of wages and transfers, the optimal path of asset holdings {a i j,t } for this agent satisfies a i j,t = ãi j w i t-j , where {ã i j } denotes the optimal path of asset holdings in the normalized optimization problem of an individual who faces a sequence of wages { wi j }, tax rate τ i , and transfers {π i j } and {q i j }. Note that since qi j = qi j ( Qi ) as per (B-5), the normalized amount of unintentional bequests Qi affects wealth accumulation, that is {ã i j } = {ã i j ( Qi )}. Conversely individual wealth accumulation, captured by {ã i j }, affects the normalized amount of unintentional bequests Qi . Indeed, using the expression for Q i t in (13) along with (B-3) and (B-4), we have in the steady state

Qi L i 0,t w i t = J-1 j=0 (1 -p i j )L i j,t ãi j w i t-j ⇒ Qi = J-1 j=0 (1 -p i j ) L i j,t L i 0,t w i t-j w i t ãi j ⇒ Qi = J-1 j=0 (1 -p i j ) j-1 =0 p i [(1 + γ i L )(1 + γ i A )] j ãi j . (B-6)
The value of Qi in the autarky steady state is obtained as a fixed point by solving (B-6) with ãi j = ãi j ( Qi ). In turn, this immediately pins down normalized asset holdings {ã i j }.

Step 2: Using the fact that a i j,t = ãi j w i t+1 /(1 + γ i A ) j+1 and L i j,t = j-1 =0 p i L i 0,t+1 /(1 + γ i L ) j+1 , the market clearing condition (B-2) can be rewritten as

J j=0 e i j j-1 =0 p i (1 + γ i L ) j (k i ) 1-α = (1 -α) J-1 j=0 j-1 =0 p i [(1 + γ i L )(1 + γ i A )] j+1 ãi j (k i ), (B-7)
where the notation ãi j (k i ) captures the fact that (normalized) net asset positions depend on the steady-state rate of return, as previously described. Equation (B-7) implicitly defines the level of the capital-effective-labor ratio in the autarky steady state.

B.3 Integrated Steady State

Consider an integrated steady state where (1 + γ i A )(1 + γ i L ) = 1 + γ Y in all countries, although countries may be heterogeneous in other respects. Social security systems are balanced in all countries; hence τ i must satisfy (B-1) for all i, taking i as given. Capital-effective-labor ratios are equalized across countries,

K i t A i t Li t = k.
The integrated steady state is determined along the same logic as for the autarky steady state.

Step 1: Taking the steady-state value of the gross rate of return R as given, we consider the (normalized) optimization problem of an individual in country i with labor income sequence { wi j } J j=0 with wi j = e i j (1 + γ i A ) j and constant tax rate τ i , pension transfers πi j = i e i J (1 + γ i A ) J-1 for J < j ≤ J, and wealth transfers {q i j } j∈B satisfying (B-5) for some Qi . Let {ã i j ( Qi )} J j=0 denote the optimal path of wealth. For each country i, the normalized amount of unintentional bequest Qi ≡ Qi (R) is obtained as a fixed point, namely, as the solution to

Qi = J-1 j=0 (1 -p i j ) j-1 =0 p i (1 + γ Y ) j ãi j ( Qi ).
Stationarity and homogeneity imply that, if the world steady-state interest rate is R, the wealth at age j of an agent born in period t in country i is a i j,t+j = ãi j w i t , where ãi j = ãi j [ Qi (R)]. In the reminder of this subsection, we use the notation ãi j (k) to denote the normalized asset holdings of an individual of age j in country i when the steady-steady capital-effective-labor ratio is k, which is identical to ãi j [ Qi (R)] with R = 1 -δ + αk α-1 .

Step 2: The market clearing condition at the end of period t is

i K i t+1 ≡ k i A i t+1 Li t+1 = i J-1 j=0 L i j,t a i j,t , (B-8) which is equivalent to i A i t+1 L i 0,t+1 J j=0 e i j j-1 =0 p i (1 + γ i L ) j k 1-α = (1 -α) i A i t+1 L i 0,t+1 J-1 j=0 j-1 =0 p i (1 + γ Y ) j+1 ãi j (k). Let η i ≡ J j=0 e i j ( j-1 =0 p i ) (1+γ i L ) j
, and introduce country weights

λ i ≡ η i A i t+1 L i 0,t+1 n η n A n t+1 L n 0,t+1
.

The market clearing condition can be rewritten

k 1-α = (1 -α) i λ i η i J-1 j=0 j-1 =0 p i (1 + γ Y ) j+1 ãi j (k) = (1 -α) J-1 j=0 1 (1 + γ Y ) j+1 i λ i η i j-1 =0 p i ãi j (k).
Special case: when η i = η in every country, the market clearing condition simplifies to

k 1-α = 1 -α η J-1 j=0 1 (1 + γ Y ) j+1 i λ i j-1 =0 p i ãi j (k) ,
where λ i corresponds to the constant share of country i in world effective labor.

B.4 Dynamics

The law of motion for k t ≡ (k i t ) N i=1 in the transition depends on whether countries are financially integrated or in financial autarky. In both cases, it takes the form of a forward-backward difference equation (FBDE).

Under autarky, the market clearing condition in period t and country i is

A i t+1 Li t+1 k i t+1 = J-1 j=0 L i j,t a i j,t .
The generations who matter in period t are those born in periods t -J + 1 to t. Thus market clearing in period t pins down k i t+1 given the following inputs:

• lagged values K i L,t+1 ≡ {k i s } t s=t-J+1 and future values K i F,t+1 ≡ {k i s } t+ J s=t+2 ,
• past, current, and future productivity {A i s } t+ J s=t-J+1 ,

• past, current, and future age-income profiles, i.e., {e i j,s+j } J j=0 for s = t -J + 1, ..., t,

• replacement rates { i s } t+ J s=t-J+J+2 ,

• contribution rates

T i t+1 ≡ {τ i s } t+ J s=t-J+1 ,
• demographics, summarized by {L i 0,s } t s=t-J+1 and {p i j,s+j } J-1 j=0 for s = t -J + 1, ..., t,

• past, current, and future amounts of unintentional bequests Indeed all the points in the scatter plots tend to gather around the 45 degree line, even more so in the more recent period. Notes: For each country i, the scatter plot represents the credit constraint parameter θ i in the baseline calibration against household debt over GDP in 2005. Household debt over GDP in 2005 is from the BIS, completed when necessary using OECD and Eurostat data. For countries for which the data is missing, we report the predicted value using data on private credit over GDP and data on financial inclusion (World Bank For a given country, the coverage rate is replaced by its predicted value if missing (using log of GDP per capita, old dependency ratio, and regional dummies), as per (C-1).

Q i t+1 ≡ {Q i τ } t+ J-
of the number of years of contribution, ˜ i (y), for a worker earning the average national wage.

The final step to infer the average official replacement rate ˜ i in country i is to compute the average number of years of contribution y i in the country-then calibrating ˜ i to ˜ i (y i ).

As a proxy for the average number of years of contribution, we use the difference between the country-specific (male) retirement age and the average age of entry in the labor market The OECD also provides replacement rates for the average income earner. [START_REF] Song | Growing like China[END_REF] Unfortunately, these data do not distinguish between social security benefits and alternative pensions schemes Notes: For each country, the rate of coverage is measured as the average between the percentage of contributors in working-age population and the fraction of retirees who receive benefits in 2005, (χ i B +χ i C )/2 (Source: ILO). When missing, the coverage rate is replaced by its predicted value (using log of GDP per capita, old dependency ratio, and regional dummies) as per (C-1). Sample of 70 countries used in the quantitative evaluation (see list in Appendix C.2). Real GDP per capita in 2005 is from the World Development Indicators.

regression (GLM estimation) on the entire cross section of countries for which coverage (in 2005) is observed:

log χ i x 1 -χ i x = a x • z i + i x , x ∈ {B, C},
where χ i x is the coverage rate for beneficiaries (x = B) or contributors (x = C), z i is a vector of explanatory variables (log of GDP per capita, old-dependency ratio and square of olddependency ratio, as well as regional dummies), and i

x is a residual. 61 The selected predictors are highly significant and capture more than 85% of the cross-sectional variance. Countries with missing coverage data are imputed the predicted value Our baseline calibration uses the average of these two effective replacement rates, low-income countries with very low coverage, for which the official replacement rate is essentially irrelevant (bottom-left corner of the scatter plot); middle-income countries-including countries with generous official replacement rates, whose effective replacement rate is largely determined by the rate of coverage (e.g., Egypt), as well as countries with mostly private systems and thus very low replacement rates independently of coverage (e.g., Peru); countries with fairly high coverage rate, mostly advanced economies (right part of the scatter plot), for which the generosity of the pension system is linked to the official replacement rate and to the degree of privatization of the pension system (compare, for instance, Portugal vs Australia).

i = i B + i C 2 = χ i B + χ i C 2 ˜ i .
Similar patterns hold when using the coverage rate of beneficiaries (resp. contributors) and the corresponding official replacement rate, i B (resp. i C ). Focusing on cross-sectional heterogeneity, the official replacement rate is assumed to be constant over time in our baseline calibration, equal to its 2005 value. Sensitivity analysis is performed with time-varying replacement rates, as discussed in Section 4.2 (see also Appendix D.4).

D Alternative Experiments and Extensions

This appendix provides additional material referred to in Sections 3 and 4 when we discuss the performance of the quantitative model under alternative calibrations.

D.1 No Social Security ( = 0)

The experiment in which we remove social security altogether is discussed in the second half of Section 3.5. Notes: For each country in the scatter plot, the x-coordinate (resp. y-coordinate) corresponds to the average current account over GDP predicted by the model (resp. observed in the data) over 1990-2015. Model and data are demeaned in each period. The solid (grey) line is the 45 degree line and the dashed (red) line is the regression line. Model predictions are obtained by setting σ = 2, other parameters being kept at their baseline values. Notes: The data on household debt over GDP in the U.S. are from the Bank of International Settlements.

D.3 Time-Varying Credit Constraints

D.4 Time-Varying Replacement Rates

As described in Section 4.2, the experiments with time-varying replacement rates assume that the generosity of social security adjusts to aging in the same way across countries. In any country i with a social security system, the replacement rate i t falls when the old-dependency ratio rises, with a constant elasticity (1 -ε) as per Eq. (20). 62 We consider several alternative experiments for different values of ε between 0 and 1, where ε = 1 corresponds to our baseline (i.e., constant replacement rates equal to their 2005 values). A lower value of ε implies that a greater share of the social security adjustment to aging goes through a reduction in replacement rates, and less through a rise in contributions. Notes: For each calibration, the top panel shows the estimate of the regression coefficient in (18) along with its 5% confidence interval, while the bottom panel displays the distance between model and data as defined by (19). Model and data are averaged in the between dimension. Model predictions are obtained for different values of the elasticity of the replacement rate to the old-dependency ratio, measured by -(1-ε). The baseline corresponds to the case of constant replacement rates (ε = 1). For values of ε = 1, the path of the replacement rate in a given country is determined according to (20). Notes: For each country in the scatter plot, the x-coordinate (resp. y-coordinate) corresponds to the average current account over GDP predicted by the model (resp. observed in the data) over 1990-2015. Model and data are demeaned in each period. The solid (grey) line is the 45 degree line and the dashed (red) line is the regression line. Model predictions are obtained under the assumption that replacement rates adjust to population aging according to (20) with ε = 0, other parameters being kept at their baseline values.

Regression coefficient

  Life Expectancy: Advanced vs Emerging (c) Fertility across Regions (d) Life Expectancy across Regions

Figure 1 :

 1 Figure 1: Fertility and Life Expectancy across the World.

  Kitao, and Violante (2007), Borsch-Supan, Ludwig, and Winter (2006), and Fehr, Jokisch and Kotlikoff (2007) study social security adjustments to aging in an open economy, focusing

Figure 2 . 2 illustrates

 22 the dynamics of net foreign asset positions in the transition for two countries that differ only in their levels of social security.

Figure 2 . 2 :

 22 Figure 2.2: Global Aging and NFA with Heterogeneous Social Security.

Figure 2 . 3 :

 23 Figure 2.3: Impact of Country-Specific Aging in a Small Open Emerging Economy.Notes: In panels (a) and (b), the first two subplots depict the exogenous evolution of fertility and longevity in the SOE and the rest of the world (RoW). The SOE (dashed line) integrates to the RoW (solid line) at t = 0. The RoW is characterized by θ = 15%, initial replacement rate -2 = 35%, and final replacement rate

Figure 3 . 1 :

 31 Figure 3.1: Model versus Data: Performance Summary.

Figure 3 . 2 :

 32 Figure 3.2: Model versus Data: Between Variation.

Figure 3 . 3 :

 33 Figure 3.3: Capital Flows over Time by Regions/Countries.Notes: This figure depicts the time series of current account over GDP predicted by the model (solid lines) along with their data counterpart (dashed lines) for all regions and selected countries. Predictions are obtained under the baseline calibration described in Section 3.2. See Appendix C.2 for the composition of each region.

  In the model, as Portugal is becoming more similar to France in terms of demographics, the external imbalances narrow down. While these evolutions are qualitatively in line with the data, the model misses the magnitude of external borrowing in Portugal pre-2010-just like it misses the extent of borrowing in the U.S. prior to the 2007-2009 financial crisis and the subsequent rebalancing. The bottom panels of Figure 3.3 depict capital flows for different parts of the developing/emerging world. In the model as in the data, capital flows downhill towards younger regions: Sub-Saharan Africa and, to a lesser extent, Middle East and North Africa (MENA)

Figure 3 . 4 illustrates

 34 the decline in the interest rate predicted by the quantitative model over the period 1990-2030, under the baseline and alternative calibrations. In the baseline, the interest rate falls by about 1.7 percentage points between 1990 and 2015, accounting for almost half of the fall in the 5-year real interest rate observed in the U.S. over this period.

Figure 3 . 4 :

 34 Figure 3.4: Decline in the World Interest Rate: Model versus Data.Notes: The figure depicts the evolution of the real interest rate in the model and in the data (in percentage points, relative to 1990). Model predictions are obtained under the baseline calibration (as per Section 3.2), for higher and lower values of the e.i.s. coefficient (σ = 1 and σ = 1/4), and by running the baseline experiment on a subsample of high-income OECD countries (holding all parameters at their baseline values). The data represents a proxy for the U.S. 5-year real interest rate, constructed using the 5-year nominal Treasury rate and CPI inflation (see Appendix C.1 for data sources and details).

Figure 3 . 5 :

 35 Figure 3.5: The Role of Aging: Performance Summary.

Figure 3 Figure 3 . 6 :

 336 Figure 3.6: Between Variation under Alternative Calibrations.Notes: In each panel, the x-coordinate (resp. y-coordinate) for a given country in the scatter plot corresponds to the average current account over GDP predicted by the model (resp. observed in the data) over 1990-2015. Model and data are demeaned in each period. The solid (grey) line is the 45 degree line and the dashed (red) line is the regression line. In panels (a) and (b), model predictions are obtained by holding demographic parameters constant to their 1950 values in each country, and for common demographic parameters across countries reflecting world average evolutions, respectively; other parameters are set to their baseline values.In panels (c) and (d), model predictions are obtained by removing credit constraints, and by setting credit constraint and social security parameters to their U.S. values in all countries, respectively, other parameters being set to their baseline values.

Figure 3 . 7 :

 37 Figure 3.7: The Role of Credit Constraints and Social Security: Performance Summary.

Figure 4 . 1 :

 41 Figure 4.1: Sensitivity with Respect to the Elasticity of Intertemporal Substitution.

Figure 4 .

 4 Figure 4.1 summarizes the performance of the model under these alternative calibrations, focusing on the between dimension (results for other specifications are qualitatively similar).

Figure 4 . 2 :

 42 Figure 4.2: Sensitivity with Respect to Credit Constraint and Social Security Parameters.

Figure A. 1

 1 Figure A.1 in Section A.4 of the appendix illustrates the magnitude of the threshold τ † as a function of parameter values.

Figure A. 1 :

 1 Figure A.1: Threshold τ † and Implied Replacement Rate.Notes: This figure displays level curves for the threshold τ † defined by (A-30) and for the implied replacement rate , for different values of the e.i.s. coefficient (σ) and of the elasticity (ε) of the steady-state contribution rate to aging. The implied replacement rate is obtained from (A-5) for τ = τ † . The left panel is for n = 1, p = 0.85, and θ = 15%. The right panel is for n = 2, p = 0.7, and θ = 2.5%. Other parameter values are α = 0.3, β = 0.96 (annual), and γ A = 1% (annual). A period lasts for 25 years.

  0

Figure A. 4 :

 4 Figure A.4: Thresholds for η n and η p : Heterogeneity in Credit Constraints.Notes: This figure displays level curves for the thresholds η(θ) n and η (θ) p defined in (A-71) and (A-72), as well as for the differences η n -η n and η p -η (θ) p , as a function of the e.i.s. coefficient σ and of the world average contribution rate τ . Parameter values are α = 0.3, β = 0.96 (annual), and γ A = 1% (annual), n = 1.25, p = 0.8, θ = 10%, and ε = 0.8. A period lasts for 25 years.

-

Figure A. 5 :

 5 Figure A.5: Thresholds for η n and η p : Heterogeneity in Social Security. Notes: This figure displays level curves for the thresholds η (τ ) n and η (τ ) p defined in (A-75) and (A-76), as well as for the differences η n -η (τ ) n and η p -η (τ ) p , as a function of the e.i.s. coefficient σ and of the world average contribution rate τ . Parameter values are α = 0.3, β = 0.96 (annual), and γ A = 1% (annual), n = 1.25, p = 0.8, θ = 10%, and ε = 0.8. A period lasts for 25 years.

Figure C. 1 :

 1 Figure C.1: Cross-Country Distributions of Fertility Rates and Life Expectancy.Notes: The histograms in panels (a) and (c) represent the cross-country distribution of fertility rates adjusted for infant mortality. The histograms in panels (b) and (d) represent the cross-country distribution of life expectancy at birth. See Appendices C.1-C.2 for data sources and country sample.

Figure C. 2 :

 2 Figure C.2: Demographic Composition: Model vs Data.

  capita, log-scale (USD PPP adjusted) (b) Household Debt to GDP and Level of Development

Figure C. 3 :Figure C. 4 :

 34 Figure C.3: Household Debt to GDP across the World in 2005. Notes: The top panel displays average household debt over GDP by regions (2005 population-weighted) for the sample of 70 countries used in the quantitative model (see list in Appendix C.2). The bottom panel represents household debt over GDP against GDP capita for each of the 70 countries. Household debt over GDP data for 2005 are from the BIS, OECD, and Eurostat. When the data is missing, we use predicted values based on financial inclusion (World Bank) and private credit over GDP. GDP per capita in 2005 is from the World Development Indicators.

(

  Figure C.6: Official Replacement Rates: Comparison with Bloom et al. (2007).

Notes:

  Official replacement rates in 2002 from Bloom et al. (2007) on the horizontal axis compared to our own calculations based on SSPTW data on the vertical axis (2003 or 2004 depending on the region), for countries that belong both to the sample of Bloom et al. (2007) and to our sample of 70 countries.

  Figure C.7: Social Security Coverage and Level of Development.

  x • z i ) 1 + exp(a x • z i ) , x ∈ {B, C}. (C-1)This strategy enables us to retain a large country sample for the quantitative evaluation of the theory. Figure C.7 shows the average of the two coverage rates, (χ i B + χ i C )/2, across all the countries in our sample as a function of GDP per capita.Effective Replacement Rates. Having data on official replacement rates (˜ i ) and coverage rates for beneficiaries (χ i B ) and contributors (χ i C ) in 2005, one can compute the effective replacement rate in 2005 for the two different measures of coverage, i x = χ i x ˜ i , x ∈ {B, C}.

Figure C. 8

 8 Figure C.8 illustrates the relation between the effective replacement rates i used in our baseline calibration and income per capita. Three distinct categories of countries emerge:

  Figure C.8: Baseline Effective Replacement Rates and Level of Development. Notes: Effective replacement rates (in %) in our baseline calibration, computed based on 2005 data on public pension systems (SSPTW) and social security coverage (ILO). Sample of 70 countries used in quantitative experiments (see list in Appendix C.2). Real GDP per capita in 2005 is from the World Development Indicators.

Figure D. 1 ,Figure D. 1 :Figure D. 2 :

 112 Figure D.1: Between Variation in the Absence of Social Security.Notes: For each country in the scatter plot, the x-coordinate (resp. y-coordinate) corresponds to the average current account over GDP predicted by the model (resp. observed in the data) over 1990-2015. Model and data are demeaned in each period. The solid (grey) line is the 45 degree line and the dashed (red) line is the regression line. Model predictions are obtained by removing social security ( = 0), other parameters being kept at their baseline values.

Figure D. 3

 3 Figure D.3 depicts the evolution of household debt over GDP in the U.S. over the period 1980-2015. U.S. household debt to GDP has been rising until the 2007-2009 financial crisis.The deleveraging of households in recent years has led to a fall in the household debt-to-GDP ratio. Similar evolutions are observed at the world level, although the magnitude of the swing varies across countries. U.S. household debt data, available over a longer time span, are used to calibrate the evolution of the level of credit constraints worldwide. We introduce a worldwide credit supply shifter θ t , normalized to 1 in 2005, which multiplies at each date t the country-specific level of credit constraint θ i of our baseline calibration, thus setting θ i t = θ t θ i . The credit supply shifter θ t varies over the period 1980-2020 in order for the model to match the U.S. household debt-to-GDP ratio at each date relative to its 2005 value. All other parameters in the simulation are kept at their baseline values. Until 1980 (resp. after 2020), θ t is set to 0.31 (resp. 0.70). The obtained path for θ t mirrors the steep rise in U.S. household debt between 2000 and 2008 and its subsequent fall-rising from 0.48 in 2000 to 1 in 2005 before falling to 0.51 in 2010 and 0.39 in 2015.

Figure D. 3 :

 3 Figure D.3: U.S. Household Debt over GDP.

  Figure D.4 summarizes the performance of the model for different values of ε in the between dimension, while Figure D.5 illustrates the fit of the model for ε = 0.

Figure D. 4 :

 4 Figure D.4: Time-Varying Replacement Rates: Performance Summary.

Figure D. 5 :

 5 Figure D.5: Between Variation with Time-Varying Replacement Rates (ε = 0).

Old-to-middle-aged ratio (L o /L m )

  [START_REF] Buera | Productivity Growth and Capital Flows: The Dynamics of Reforms[END_REF] Figures A.2 and A.3 in Appendix A.4 illustrate the magnitude of these elasticities. For realistic parameter values, η n and η p are positive (as discussed in the context of Lemma 1) and decreasing in σ, capturing the fact that the fall in R as a response to aging is larger for low values of the e.i.s. coefficient (see Remark A-6).

	0.8								0.14		Contribution rate ( )
	0.7								0.12
	0.6
									0.1
	0.5
									0.08
	0.4
	0.3								0.06
	0.2								0.04
	-1	0	1	2	3	4	5	6	-1	0	1	2	3	4	5	6
	0
	-0.02
	-0.04
	-0.06
	-0.08
	-0.1
	-1	0	1	2	3	4	5	6
	17 See Equations (A-71) and (A-72) in the proof of Proposition 1, as well as Figure A.4 in Appendix A.4.

Interest rate (annual, relative to t=0)

	0.02			NFA/GDP
		L
		H
	0.01
	0
	-0.01
	-0.02
	-1	0	1	2	3	4	5	6
	Figure 2.1: Global Aging and NFA with Heterogeneous Credit Constraints.
	Notes: Parameter values are α = 0.3, β = 0.96 (annual), σ = 1/2, γ A = 1% (annual), θ H = 15%, and
	θ L = 2.5%. In the initial steady state, n = 2, p = 0.4, and = 30%. In the final steady state, n = 1.1, p = 0.8,
	and = 23.2% (that is, ε = 0.8). Changes in fertility and longevity occur between periods 0 and 2. A period
	is 25 years, N = 2, and countries H and L are of equal size.

Table 1 :

 1 Parameters Common Across Countries. is set to 0.5, in the mid-range of empirical estimates.

	Preference and Technology
	β	discount factor, per year		0.96
	σ	e.i.s. coefficient		0.5
	α	capital share		0.3
	δ	depreciation rate, per year		0.08
	γ A productivity growth, per year		0.01
	Age-Income Profile
	Age 20-24 25-29 30-34 35-39 40-44 45-49 50-54 55-59 60-64 65-69 70-74 75-79 80+
	e j	0.42 0.71 0.88 0.98 1.03 1.04	1	0.85 0.53 0.22 0.10 0.05 0
	intertemporal substitution σ

[START_REF] De Nardi | Why Do the Elderly Save? The Role of Medical Expenses[END_REF]

However, since the value of the e.i.s. coefficient potentially matters quantitatively, we perform sensitivity analysis around this baseline value. The capital share α is set to 0.3 and the depreciation rate δ to 8% per year. Productivity grows at a constant rate γ A = 1%.

  This figure displays level curves for the elasticity η n of the steady-state interest rate with respect to the fertility rate n, given by (A-47), for different values of the e.i.s. coefficient σ and of the contribution rate τ . The left panel is for n = 1, p = 0.85, and θ = 15%. The right panel is for n = 2, p = 0.7, and θ = 2.5%. Other parameter values are α = 0.3, β = 0.96 (annual), γ A = 1% (annual), and ε = 0.8. A period lasts for 25 years. This figure displays level curves for the elasticity η p of the steady-state interest rate with respect to the survival probability p, given by (A-48), for different values of the e.i.s. coefficient σ and of the contribution rate τ . Parameter values for both left and right panels are set as in Figure A.2.

	0.3			0 . 6 0 . 8	.4				0.3		1	0 . 8	0 . 6	0 .4
	0.1 0.2 0.1 0.15 contribution rate ( ) 0.2	1 . 5 2 2 .5 0 . 6	1					0.1 0.1 0.15 contribution 0.2 rate ( ) 0.2	2 2 .5 3 2 1 . 5 1	0 .5	0 .3	0 .1	-0 .1
	0.2 0 0.05	0 . 7	0.4	0.6 0 .8	0.8 0. 9	1	0.2 0 0.05		0.4	0.6	0.8	1
				eis coefficient ( )					eis coefficient ( )
	0.2 0		0.4 Figure A.2: Elasticity of the Interest Rate to Fertility. 0.6 0.8 1 0.2 0.4 0.6 0	0.8	1
				eis coefficient ( )					eis coefficient ( )
	0.2								0.2
	0.15				-0 . 6			0.15	2.5	2	1. 8	1 .4	1 .3	1 .2
	0.3 0.1			0 . 6 -0 . 5	0 . 4	0 .2			0.3 0.1			0 . 6	0 . 4	0 .2
	0 . 8 1 .5 1 2 2. 5 0.2 0.1 0.2 0.4 eis coefficient ( ) 0.6 0.8 0 -0 .4 0.05 contribution rate ( )	1	1 . 1 5 2 2 .5 3 0.2 0.1 0.2 0 0.05 contribution rate ( )	0 . 8 0.4 eis coefficient ( ) 0.6 0.8	1
	0								0
	0.2		0.4		0.6	0.8	1	0.2		0.4	0.6	0.8	1
				eis coefficient ( )					eis coefficient ( )
				Figure A.3: Elasticity of the Interest Rate to Longevity.

Notes:

Notes:

  The scatter plots in this figure represent the model-implied demographic composition by age groups against its empirical counterpart, pooled across all age brackets and countries, at three different dates: 1950 in panel (a), 1990 in panel (b), and 2015 in panel (c). The fraction of each age group in the population implied by the calibrated model (resp. observed in the data) is shown on the horizontal axis (resp. vertical axis). See Appendix C.2 for the list of 70 countries.Predicting Household Debt over GDP. For many developing countries though, household debt is not observable. To remediate this problem and retain the maximum number of countries in our quantitative evaluation, we use predicted values when the data is missing. To do so, we estimate the following regression over the panel of household debt observations:log(h i,t ) = a • z i,t + φ t + i,t ,where h i,t denotes household debt over GDP in country i and period t, z i,t is a vector of explanatory variables correlated with household debt over GDP, and φ t a period fixed effect. The log of household debt over GDP in country i is assumed to be linear in three explanatory variables (all expressed in log). Two are constant over time-namely, the percentage of individuals above 15 having ever borrowed from a financial institution and the percentage of individuals above 15 with a mortgage (as of 2011 from the Global Financial In-

	100%
	80%
	60%
	40%
	20%
	0%
	Emerging	Advanced Sub-Saharan	Middle East	South &	South-East	Latin America Central &	Old Europe &	US & Anglo-
		Africa	& North	Central Asia	Asia	Eastern	Japan	Saxons
			Africa			Europe
	Because predictors of household debt are available for a larger cross section of countries than
	household debt data themselves, this strategy allows us to consider a significantly larger
	number of countries in our quantitative simulations.
	Household Debt across the World. Panel (a) in Figure C.3 shows the level of household
	debt over GDP across regions in 2005. For each region, we plot the population-weighted aver-
	age of household debt over GDP across countries in the region (for the sample of 70 countries
	considered in the quantitative model, based on 2005 population weights), using predicted val-
	ues when the data is missing. Panel (b) in the figure displays the level of household debt over
	GDP across all countries in our sample.

Notes:

clusion database)-capturing time-invariant differences in credit market development across countries. A third predictor, private credit over GDP (from the Financial Development and Structure dataset, using 5-year averages based on annual data), is time-varying. Coefficients in the regression are all significant at the 5% level with the expected signs and the R 2 of the regression is 83%. Based on this regression, the predicted value of household debt over GDP in country i at date t is

[START_REF] Ruggles | Integrated Public Use Microdata Series[END_REF]

ĥi,t = exp[a • z i,t + φ t ].

  ). Sample of 70 countries used in the quantitative experiments (see list in Appendix C.2).

	100%
		Replacement Rate (official)	% of contributors in working age population	% of recipients among retired
	80%
	60%
	40%
	20%
	0%
	Emerging	Advanced Sub-Saharan	Middle East	South &	South-East	Latin America Central &	Old Europe &	US & Anglo-
		Africa	& North	Central Asia	Asia		Eastern	Japan	Saxons
			Africa				Europe

Figure C.5: Social Security across the World.

Notes: The official replacement rate is computed using SSPTW data (SSA). The rate of coverage is measured as the percentage of contributors in working-age population or the fraction of pension benefit recipients in old-age population, both in 2005 (Source: ILO). For each region, we plot averages across countries (2005 population-weighted) in the sample of 70 countries considered in the quantitative model (see Appendix C.2).

See also Figure C.1 in the appendix, as well as Lee (2003) and de Silva and Tenreyro (2017).

Global aging, although it does affect world savings and investment, should leave capital flows unaffected according to standard theory. For instance, in an OLG setting, if agents are expected to live longer, savings increase on impact. However, since countries cannot all run a current account surplus, the world interest rate adjusts, leaving capital flows unchanged. In the presence of heterogeneity in credit markets and social security, countries' savings respond differently to the common demographic trend, thus triggering capital flows.

See Aguiar and Amador (2011), Bacchetta and Benhima (2015), Benhima (2013), Buera and Shin (2017), Caballero, Farhi, and Gourinchas (2008), Carroll and Jeanne (2009), Coeurdacier, Guibaud, and Jin (2015),

See Remark A-4 in Appendix A for a detailed analysis of how the presence of social security affects the response of the interest rate to aging.

The condition τ < τ † is extremely weak. For reasonable parameter values, the magnitude of the threshold τ † is typically around or above 40%-which is well above the levels of contribution rates observed in practice (see Figure A.1 for a numerical illustration of the magnitude of the threshold). The presence of large countries with poorly developed pension systems tends to lower the world average contribution rate τ .

The expression for country i's NFA position is given by Equation (A-78) in Appendix A.3.

= 31.7%. The SOE is characterized by θ = 2.5%, -2 = 5%, and 6 = 3.6%. Other parameter values are α = 0.3, β = 0.96 (annual), σ = 1/2, and γ A = 1% (annual). A period is 25 years.

Using COMTRADE data, we drop countries for which net exports of oil and gas are above 15% of GDP on average post-1990. Russia and Bolivia, despite being fairly large energy exporters, remain in our sample.

Using data from the Uppsala Conflict Data Program, we drop countries that have suffered severe conflicts on their soil, with a casualty rate that exceeds 1/1000 of the population at the start of the conflict.

In any period, capital markets clear globally in the model but not in the data. Equivalently, one could consider the regression: ca d i,t = γ ca m i,t + φ t + i,t , where φ t is a period fixed effect.

We focus on the period 1995-2015 for the time difference since 1990 current account data are missing for a few countries, and countries were also arguably less financially integrated in 1990 than in the later periods.

This experiment is related to the work of Carvalho et al. (2016), Eggertsson et al. (2017), Gagnon et al. (2016), and Lisack et al. (2017) who, in exploring the extent to which demographic factors can account for the prolonged decline in real interest rates, focus on the U.S. and other advanced countries in a closed-economy context.

This finding echoes the results of[START_REF] Krueger | On the Consequences of Demographic Change for Rates of Returns to Capital, and the Distribution of Wealth and Welfare[END_REF], who investigate the impact of faster aging in the rest of OECD relative to the U.S. on future interest rates. In our study, the impact of including emerging countries on the current and future fall in the interest rate is an order of magnitude larger. By 2080, the world interest rate falls by one percentage point more in the baseline compared to the rich-country experiment.

As a result of the increased dispersion in net foreign asset positions caused by global aging, uphill flows are almost twice as large in this experiment as they would be if the world were not aging.

For consistency with the calibration of social security, we focus on household debt over GDP for the year 2005. When household debt over GDP in country i is missing in 2005 but available at a later date, the predicted value ĥi,2005 is adjusted by a country-specific factor-e.g., if we observe a debt-to-GDP ratio h i,2010 in 2010 while the predicted value for that year would be ĥi,2010 , the adjustment factor is equal to h i,2010 / ĥi,2010 .

For the coverage of contributors (resp. beneficiaries), data are missing for 13 countries (resp. 14 countries) in our country sample.

This non-linearity may reflect a tradeoff at play in the design of pension systems: for political economy reasons, transfers towards elderly are initially higher when their fraction in the overall population increases-up to a certain point where the sustainability of the system comes into question.

The old-dependency ratio is constructed as the population above 60 divided by the population aged 20-60.

For countries with fully private systems in 2005 ( i 2005 = 0), i t is set to zero at all dates.

where the second equality uses L y,t = n t-1 L m,t as well as the social security balanced budget constraint (2), and the last equality uses (1) to substitute for the interest rate and wages. Market clearing requires that W t = K t+1 . Given the fact that K t+1 = A t+1 L m,t+1 k t+1 = n t-1 (1 + γ A,t+1 )A t L m,t k t+1 , this condition is equivalent to

(A-3)

Remark A-1. The expression (A-1) for the asset holdings of the young assumes that the credit constraint is binding. The constraint faced by a young household in period t is indeed binding if their optimal consumption level c * y,t in the absence of constraint is such that c * y,t > θ t w t /R t+1 . Solving the household's unconstrained optimization problem, this condition can be written as

(A-4)

In the special case where σ = 1 and τ t+1 = t+2 = 0, the condition simplifies to:

We proceed under the assumption that parameter values are such that (A-4) is satisfied in all periods, which we check in all the numerical illustrations. See also Remark A-3 for a discussion of this condition in the autarky steady state.

In what follows, we consider a steady-state configuration in which all parameters are constant, that is n t = n, p t = p, γ A,t = γ A , θ t = θ, and τ t = τ, implying a constant replacement rate

steady-state interest rate R = R(n, p, γ A , θ, τ ; α, β, σ) ∈ ]0, ∞[. The steady-state value of the capital-effective-labor ratio is given by

The implicit definition (A-6) follows immediately from (A-9). In the special case σ = 1, the steady-state interest rate admits the explicit expression

For future reference, we note that (A-9) implies the inequalities

and

Convergence. The transition dynamics of the interest rate is determined implicitly by the difference equation (A-8), which we rewrite here in the form

For a given value of R t > 0, the left-hand side of the equation is strictly decreasing in R t+1 , goes to ∞ as R t+1 ↓ 0, and goes to -∞ in the limit R t+1 → ∞. Hence, there exists a unique solution R t+1 ∈ ]0, ∞[. Suppose that R < R t . Using (A-9), it is immediate to see that the left-hand side of (A-13) evaluated at R t+1 = R is strictly positive. Likewise, the left-hand side of (A-13) evaluated at R t+1 = R t is strictly negative. Therefore,

Comparative Statics. Differentiating (A-9) written as

with respect to R and θ yields

where the inequality follows from (A-12), according to which

Likewise, differentiating (A-14) with respect to R and τ yields

where the sign of the expression is again established by using (A-12).

Remark A-2. It is useful to also determine the dependence of the equilibrium steady-state interest rate with respect to the e.i.s. coefficient. To do so, we differentiate (A-14) with respect to R and σ. Noting that

we obtain

it is immediate to see that ∂R/∂σ < 0 if and only if βR > 1. Since the left-hand side of (A-9) is strictly decreasing in R, the inequality R > 1/β holds if and only if the evaluation of its expression at R = 1/β is strictly greater than one, which is equivalent to

Intuitively, the condition βR > 1 ensures that the middle-aged tilt their consumption upwards.

The negative impact of σ on R arises because a higher e.i.s. increases their willingness to postpone consumption through savings. Condition (A-18) constitutes a very mild restriction on parameter values. The left-hand side of the inequality is increasing in n, γ A , θ, τ , α, and β, and decreasing in p. For β = 0.96 (annual), γ A = 1% (annual), and α = 1/3, the inequality remains satisfied under the unfavorable assumption that θ = τ = 0, n = 1.1, and p = 0.9, assuming a 25-year period.

Remark A-3. In the steady state, the credit constraint on the young binds if and only if

For any given value of τ ∈ [0, 1[, one can show that the following statements hold.

ii. If σ = 1/2 and n(1

Hence, when σ ≤ 1/2, the assumption that the credit constraint on the young is binding is automatically satisfied under weak restrictions on parameter values. Furthermore, when condition (A-18) holds, the interest rate response to demographic changes is stronger when the e.i.s. coefficient σ is lower.

Proof: We start from (A-9), which we rewrite as

In order to compute the sensitivity of the interest rate R with respect to the fertility rate n, we differentiate this equation with respect to n, R, and τ . Taking into account the fact that ∂τ /τ ∂n/n = -ε, i.e., dτ = -ετ n dn, we obtain

it is immediate to see that the inequality ∂R/∂n > 0 holds if and only if

In particular, this condition is trivially satisfied when τ = 0 or ε = 0. More generally, using (A-20) and (A-21), we can write

Likewise, in order to compute the sensitivity of the interest rate to the survival probability, Hence, the following statements hold.

(i) If ε = 0, or if ε ∈ ]0, ε † [ and τ < τ * (ε), the social security channel strictly reinforces the fall in R in response to aging. For any fixed level of τ , this is less likely to occur for higher values of ε (as the threshold τ * becomes closer to zero), and this never occurs when ε ≥ ε † . In particular, since ε † < 1, this never occurs when ε ≥ 1.

(ii) In the knife-edge case where ε ∈ ]0, ε † [ and τ = τ * (ε), the effects driven by the simultaneous adjustment of τ and play in opposite directions and exactly compensate each other, so that the overall social security channel is neutral.

(iii) If ε ∈ ]0, ε † [ and τ > τ * (ε), the social security channel counteracts the direct impact of aging on the interest rate-as the effect driven by the rise in the contribution rate dominates the effect of the cut in the replacement rate.

(iv

, the social security channel counteracts the direct effect of aging, for any level of τ > 0. In particular, when ε > 1, aging is accompanied by an increase in the replacement rate , so that the increase in the contribution rate must compensate for both the rise in the old-dependency ratio and the rise in . In this case (ε > 1), the contribution and replacement channels play in the same direction-i.e., both dampen the equilibrium fall of the interest rate in response to aging.

In cases (iii) and (iv), aging may still very well be associated with a fall in the interest rate if the direct effect of demographics dominates the counteracting social security channel. As shown in the proof of Lemma A-2, this occurs when τ < τ † . That is, when ε ∈ ]0, † [ and τ ∈ ]τ * , τ † [, or when ε ≥ ε † and τ ∈ ]0, τ † [, the equilibrium interest rate falls in response to aging despite the counteracting effect driven by the social security adjustment.

Remark A-5. It is useful to also express the response of the interest rate to demographic variables in terms of elasticities. We thus define the quantities

Using (A-23), we compute

of the equilibrium world interest rate R = R(n, p, γ A , θ, τ ; α, β, σ) and its comparative statics with respect to θ and τ , follow exactly the same steps as in the proof of Lemma A-1. The elasticity of the average contribution rate τ to aging being equal to ε, Lemma A-2 implies that a drop in fertility n, or a rise in longevity p, causes a fall in R as long as τ < τ † ≡ τ † (n, p, γ A , θ; α, β, σ, ε), where τ † is defined by (A-30).

Remark A-6. Inspection of (A-6) and ( 11) reveals that the world steady-state interest rate coincides with the interest rate that would prevail under autarky in a country with credit constraint and social security parameters θ and τ , respectively. In the remainder of this appendix, we use the notation R to refer to the world interest rate, and we denote by η n and η p its elasticities with respect to demographic variables, as defined in (A-46). The derivations in Remark A-5 imply that, if τ < τ † and

the fall in interest rate in response to aging is stronger when the e.i.s. coefficient σ is lower.

Condition (A-53) holds for reasonable parameter values. It also implies that βR > 1 and that R is decreasing in σ (see Remark A-2).

We now characterize countries' net foreign asset positions in the integrated steady state.

Lemma A-3. The net foreign asset (NFA) position of country i = 1, ..., N, is given by

In particular, a country that has tighter credit constraints than the world average (θ i < θ), and/or lower social security than the world average (τ i < τ ), tends to export capital.

Proof: The net foreign asset position of country i at the end of period t is defined as

where W i t denotes the total asset holdings of country i in period t. In view of (A-2), the latter where Ψ i is defined in (A-58). This implies that

The expressions for ∆ N F A given in Section 2.2 (in the context of the particular configurations considered in the discussion) follow immediately from (A-54), combined with (10) in the case of heterogeneous social security. Throughout this section, we denote by ψ the propensity to save of the middle-aged, as defined by (A-60).

Proof of Proposition 1. We consider two countries, H and L, such that θ L < θ H , τ H = τ L , and ε H = ε L . To assess the impact of a change in world fertility on the dispersion in foreign asset positions, we use (A-70) along with (A-66) and the stated assumptions on the characteristics of the two countries to obtain

The inequality ∂∆ N F A /∂n < 0 holds if and only if

which is equivalent to the condition

n .

(A-71) Therefore η n ≥ 1 is a sufficient condition for a fall in world fertility to induce a larger dispersion in net foreign asset positions. Likewise, we use (A-70) along with (A-69) to obtain

Therefore η p ≥ 0 is a sufficient condition for an increase in world longevity to induce a larger dispersion in net foreign asset positions. This condition is trivially satisfied under the realistic assumption that τ < τ † ≡ τ † (n, p, γ A , θ; α, β, σ, ε). More generally, one can see that Likewise, we use (A-70) along with (A-69) to obtain

Hence, the inequality ∂∆ N F A /∂p > 0 holds if and only if

Conditions (A-73) and (A-74) can be rewritten as

respectively. It is worthwhile to note that η (τ ) n > η (τ ) p , i.e., the condition on η n is tighter than the one on η p , reflecting the fact that an increase in longevity directly contributes to an increase in the dispersion of NFA positions-whereas a drop in fertility only affects capital flows indirectly through the interest rate and social security channels. n , η (τ ) p , as well as the difference η n -η (τ ) n and η p -η (τ ) p , and their dependence in σ and τ .

Sufficient Conditions on Parameter Values. From (A-75), we see that

(A-77)

Therefore, if τ < τ † and (A-53) holds, a sufficient condition for a drop in n to generate uphill capital flows is

Likewise, from (A-76), we see that η (τ ) p ≤ 0 if

.

Under condition (A-53), using (A-77) and R > 1/β, this yields the sufficient condition

Therefore, if τ < τ † and (A-53) holds, then given any ε ≥ 0, a sufficient condition for a rise in p to generate uphill capital flows is βn(1 + γ A ) ≤ 1. This condition is satisfied, e.g., for [START_REF] Cihak | Benchmarking Financial Development Around the World[END_REF] and n ≤ 2.16, which maps into an actual fertility rate of 4.32.

A.3 Country-Specific Aging

We proceed under the assumptions of Section 2.3, i.e., country i is a small open economy (SOE). The world interest rate R t+1 between periods t and t + 1, as well as the capitaleffective-labor ratios k t and k t+1 in these periods, are taken as given. To start with, we derive If instead countries are financially integrated in period t, then rates of return are equalized

and so are the capital-effective-labor ratios

The market clearing condition in period t is

Thus market clearing in period t pins down k t+1 given

• lagged and future values,

• age-income profiles, i.e., {e i j,s+j } J j=0 for s = t -J + 1, ..., t and i = 1, ..., N ,

• replacement rates { i s } t+ J s=t-J+J+2 for i = 1, ..., N ,

• contribution rates

• demographics, summarized by {L i 0,s } t s=t-J+1 and {p i j,s+j } J-1 j=0 for s = t -J + 1, ..., t, and i = 1, ..., N ,

• total amounts of unintentional bequests

B.5 Shooting Algorithm

Consider an experiment where countries start in financial autarky and integrate in period X (say, X = 0). Hence for t ≥ X + 1, k i t = k t , for all i. Around the integration period, we feed the model with 'shocks' to demographics, credit constraints, and social security. We allow for shocks over the window [X -T, X + T]. All shocks are perfectly anticipated. The sequence of replacement rates { i t } is taken as given. Adjustments to the contribution rates {τ i t } are obtained as part of the equilibrium construction.

In order to determine how the global economy responds to financial integration and other shocks, we use the following algorithm.

1. We assume that each country starts at its autarky steady state, and that the economy does not react to future shocks before period X -T , for T > T large. That is, k i t = k i * for t ≤ X -T -1. The initial steady state for country i, including asset holding positions by age groups, is determined for given parameters {e i j } J j=0 , (γ i A , γ i L ), {p i j } J-1 j=0 , and (θ i , i ) as described in Section B.2. From the initial steady state, we obtain unintentional bequests

where Qi [k i * ] is obtained as a fixed point as explained in Step 1 of Section B.2.

2. We assume that the world economy has converged to its final integrated steady state

The final steady state is determined, along with other parameters, by countries' relative weights {λ i } N i=1 , as described in Section B.3. Unintentional bequests in period X + T + 1 are

where Qi [k * ] is obtained as a fixed point as explained in Step 1 of Section B.3.

3. The transition path of the economy between periods X -T and X + T is obtained iteratively as follows.

(a) We start with a guess (indexed by 0) for the paths of capital-effective-labor ratios -We obtain {k (n+1) t } X t=X-T by iterating on the autarkic forward-backward difference equation (FBDE) in each country (see Section B.4). Specifically, for each country i, and for t = X -T, . . . , X, we compute k i(n+1) t as the solution to the autarkic FBDE, given

, and

-We determine the common path {k (n+1) t } X+T t=X+1 by iterating on the integrated FBDE. Specifically, for t = X + 1, . . . , X + T , we compute k (n+1) t as the solution to the integrated FBDE given

ii. Given {k (n+1) t } X+T t=X-T , the updated sequence of contribution rates {τ

is obtained from the balanced budget condition, Eq. ( 12).

iii. Finally, we obtain the updated path of aggregate bequests {Q (n+1) t

} X+T t=X-T as per Eq. ( 13), where the asset holdings of all generations in each period are computed given {k

} X+T t=X-T , and {Q

(c) We iterate on n until convergence, based on the distance between two consecutive paths {k

4. We verify that T is large enough for the distances |k

X+T -k * | to fall below some convergence threshold.

C Data and Quantitative Calibration

This appendix provides details on the data and the calibration of the quantitative model.

C.2 Country Sample and Regions

The 193 countries for which demographic data are available from the United Nations World Population Prospects are listed below. The grouping of countries into regions corresponds to the one used in the figures (e.g., Figures 1 and3.3). Advanced countries ( †) refer to OECD members considered as High-Income by the World Bank (World Development Indicators).

Countries appearing in bold are those that are included in the quantitative evaluation of the model in Section 3. Our sample selection procedure is detailed below.

Anglo-Saxon Countries

Old Europe and Japan: Austria † , Belgium † , Cyprus, Denmark † , Finland † , France † ,

Central/Eastern Europe: Albania, Belarus, Bosnia and Herzegovina, Bulgaria, Croatia, Czech Republic † , Estonia † , Hungary † , Latvia, Lithuania, Macedonia, Moldova, Montenegro, Poland † , Romania, Russian Federation, Serbia, Slovak Republic † , Slovenia † , Ukraine.

Latin America and the Caribbean: Antigua and Barbuda, Argentina, Aruba, Bahamas, Barbados, Belize, Bolivia, Brazil, Chile, Colombia, Costa Rica, Cuba, Curacao, Dominica, Dominican Republic, Ecuador, El Salvador, Guatemala, Grenada, Guyana, Haiti, Honduras, Jamaica, Mexico, Nicaragua, Panama, Paraguay, Peru, Puerto Rico, Saint Lucia, Saint Vincent and the Grenadines, Suriname, Trinidad and Tobago, St. Kitts and Nevis, United States Virgin Islands, Uruguay, Venezuela.

Conflicts. Using data on the location of conflicts and the corresponding casualties over the period 1989-2016, we compute the total number of deaths in a given conflict by summing the battle-related deaths over the duration of the conflict (best estimates from UCDP). Then, we compute a measure of the intensity of the conflict ('deaths per capita'), dividing the total number of casualties by the population of the countries involved in the conflict. This measure of conflict intensity is attributed to the countries where the conflict is Lastly, for a country involved in several conflicts on its soil, deaths per capita are added by country.

Countries are removed from our sample when the country-specific measure of deaths per capita exceeds 1/1000 over the period of the conflict. On top of countries dropped due to missing data, the following countries are excluded: Angola, Burundi, Chad, El Salvador, Rwanda, Sri Lanka, Sudan, Syrian Arab Republic, Tajikistan.

Oil and gas exporters. Using COMTRADE data over 1990-2016, we compute, for a given country, net exports of oil and gas normalized by its GDP in a given year. Because the time coverage varies across countries, we compute for each country the average of net exports over GDP over the years for which this ratio is observed. When the average exceeds 15% of GDP, the country is excluded from the sample. On top of countries dropped due to missing data or deadly conflicts (e.g., Angola, Iraq), the following additional countries are excluded: Algeria, Azerbaijan, Iran Islamic Rep., Kazakhstan, Nigeria, Saudi Arabia, and Yemen. Russia, with net exports of oil and gas accounting for 11% of its GDP, remains part of the sample.

The 70 countries included in our final sample account for 85% of world population in 1990.

C.3 Demographics

Worldwide Demographic Evolutions.

C.5 Social Security across the World

Official Replacement Rates. To calculate country-specific official replacement rates, ˜ i , we first code the pension system of each country based on data made available by the U.S. Social Security Administration (Social Security Programs Throughout the World, abbreviated as SSPTW). Starting from 2002, data are available every other year depending on the region. [START_REF] Samwick | Is Pension Reform Conducive to Higher Savings?[END_REF] We collected data for the period 2002-2010 for our sample of countries. We restrict our attention to social security systems and abstract from private pensions (e.g., defined-contribution plans). [START_REF] Sandri | Growth and Capital Flows with Risky Entrepreneurship[END_REF] In a given country, depending on the system in place, the pension received can be a flat amount (often expressed in national currency), or a flat amount plus a fraction of previous earnings. These two components depend on the number of years of contribution, which we denote by y. In order to calculate ˜ i , we thus need to obtain, for each country, the average former real wage and the average number of years of contribution, y i . For OECD countries, the average wage (in national currency) is directly available. For other countries, we proxy the average wage by two thirds of the GDP per worker from the Penn World Tables (PWT), also expressed in national currency. For OECD countries, our proxy measure for the wage is quite close to the average wage from OECD data (the correlation between the two in a given period is around 0.95). Real wages are then computed by deflating the nominal wage with the national consumption price index (using World Bank Development Indicators). For each country, the flat amount of pensions (expressed in real terms, CPIdeflated) is then converted as a percentage of the average real wage ten years before the date at which benefits are received. This flat amount is often conditional on the number of years of contribution. Pension benefits that come on top of this flat amount are directly expressed as a fraction of previous wages-which also depends on the number of years of contribution y. [START_REF] Scholz | Are Americans Saving Optimally for Retirement[END_REF] Summing the two components gives a schedule of official replacement rates as a function [START_REF] Samwick | Is Pension Reform Conducive to Higher Savings?[END_REF] Namely, even years for Europe, Asia, and the Pacific, and odd years for Africa and The Americas. See https://www.ssa.gov/policy/docs/progdesc/index.html. [START_REF] Sandri | Growth and Capital Flows with Risky Entrepreneurship[END_REF] One country in our final sample, Cambodia, is not described in the SSPTW dataset. According to coverage data from ILO, Cambodia has one of the lowest coverage rate in the world (3% for beneficiaries). Indeed, the social security system, destroyed in the genocide era, only covers civil servants until 2008. According to the recently created National Social Security Fund (see http://www.nssf.gov.kh), the system offers fairly high replacement rates (63%). However, with such a low coverage rate, a precise measure of the official replacement rate is quite irrelevant for our purpose-which is why we keep Cambodia in our final sample. [START_REF] Scholz | Are Americans Saving Optimally for Retirement[END_REF] For many countries, the official replacement rate increases by a small percentage per year of contribution (often up to a maximum), conditionally on a minimum number of years of contribution. Some countries exhibit more sophisticated schedules of benefits as a function of y, with replacement rates increasing with y in a non-linear fashion. For countries with a 'point' system (Romania and Slovakia in our sample), the value of a point is converted into a percentage of the average national wage.

(private, semi-private, etc.). Still, when focusing on countries with fully public systems in 2008 (mostly European countries), the correlation between the two measures is very high, above 0.8. Our measure, which essentially captures replacement rates with full contributions, is slightly above the corresponding OECD measure, which imputes less than full pensions for a fraction of the working population-a discrepancy partly corrected for when controlling for coverage, as we do next. for the vast majority of countries, which corresponds to the year 2005 in our calibration. [START_REF] Taylor | Capital Flows to the New World as an Intergenerational Transfer[END_REF] Two different measures of coverage are available for slightly different samples of countries: the percentage of active contributors in the working age population, χ i C , available for a crosssection of 133 countries, and the percentage of pension recipients in the population above retirement age, χ i B , available for 131 countries. Figure C.5 shows the two measures of coverage (percentage of active contributors and percentage of pension recipients) across regions, along with official replacement rates. [START_REF] Vissing-Jørgensen | Limited Asset Market Participation and the Elasticity of Intertemporal Substitution[END_REF] Not surprisingly, the coverage of pension systems is significantly lower in emerging than in developed countries-about 3 times lower.

Social Security

Coverage data are available for the majority of our sample of 70 countries, but not for all of them. [START_REF]World Social Security Report 2010-11[END_REF] Following the same strategy as to deal with missing household debt data, we use variables that are correlated with social security coverage to predict coverage for countries with missing observations. In the data, coverage is highly correlated with the level of development of countries as measured by GDP per capita in 2005 (Figure C.7) and depends in a non-linear way on the old-dependency ratio: coverage tends to be higher in countries with a higher fraction of elderly, but less so in the oldest countries. We do not aim at explaining this pattern of the data, [START_REF] Yogo | Estimating the Elasticity of Intertemporal Substitution When Instruments Are Weak[END_REF] and only use demographic variables and income per capita as useful predictors of coverage. Since the coverage rate is between 0 and 1, we run the following logistic 58 For each region, we plot the population-weighted average across countries (2005 population weights).