François Le Grand
email: legrand@em-lyon.com.

Xavier Ragot
email: xavier.ragot@sciencespo.fr.

Refining the truncation method to solve heterogeneous-agent models *

Keywords: Heterogeneous agents, truncation method, aggregate shocks. JEL codes: D31, D52, E21

 to solve heterogeneous-agent models with aggregate shocks. The method consists in providing a finite state-space representation of such economies by truncating idiosyncratic histories. The innovation compared to the uniform method is to allow for truncated histories of different lengths. This offers a finer representation when needed, while considerably reducing the model dimensionality. The method reproduces the steady-state distribution of any heterogeneousagent model and solves for its dynamics in the presence of aggregate shocks. As the uniform method, the refined method can be solved using perturbation methods and hence implemented with standard software, such as Dynare. We show that the refined truncation method provides accurate results that improve on those of the uniform method.

Introduction

Models with incomplete insurance markets for idiosyncratic risks are now a standard workhouse in quantitative macroeconomics. The application of these so-called heterogeneous-agent models is not limited to macroeconomics since it also covers household finance, corporate finance, or international finance, among other fields. This paper presents a refinement of the uniform truncation method of [START_REF] Legrand | Managing Inequality over the Business Cycle: Optimal Policies with Heterogeneous Agents and Aggregate Shocks[END_REF] to solve these models in the presence of aggregate shocks. The uniform truncation of [START_REF] Legrand | Managing Inequality over the Business Cycle: Optimal Policies with Heterogeneous Agents and Aggregate Shocks[END_REF] assumes that the N last periods are sufficient statistics to capture the relevant heterogeneity (and not the whole idiosyncratic history). This parameter N is called the truncation length. The method then aggregates in each period all agents sharing the same history for the last N periods as if they were the same agent. Since the method truncates histories at the same date, this results in so-called uniform truncated histories. Compared to other computational solution methods, a first interest of the truncation is to generate a finite state-space representation.

This property considerably eases the simulation of the model dynamics, as the simulations can rely on standard packages, such as Dynare [START_REF] Adjemian | Dynare: Reference Manual, Version 4.6[END_REF]. As a consequence, introducing additional frictions -that are sometimes called "bells-and-whistles" in the DSGE literatureis straightforward. A second interest of the truncation method is to allow one to solve optimal Ramsey programs in incomplete-market environments, what is of independent interest.1 However, the main drawback of the uniform truncation method is that the number of truncated histories -and hence the model dimensionality -increases exponentially with the truncation length. If there are k idiosyncratic states, the number of histories is proportional to k N , which can be large. We present in this paper a new method, called the refined truncation method that differs from the uniform one by allowing for truncated histories of various lengths. Instead of truncating all histories after N periods, the refined method offers to truncate some histories after a longer length, which yields a finer and more precise representation for these histories. This finer representation is obtained in spite of a small number of truncated histories to track. Indeed, the number of truncated histories increases linearly with the refinement length, instead of increasing exponentially with the uniform length. The refined method has thus two main advantages compared to the uniform one: targeted finer representation for some histories and overall small number of histories. Furthermore, it preserves the benefits of the uniform method: finite state-space representation and tool to solve Ramsey models.

We present the refined truncation method and its implementation in practice. We illustrate its simplicity and accuracy through an example, in the spirit of Den Haan et al. (2010). We study a model where households facing idiosyncratic productivity risk have to decide their consumption-saving trade-off. We compare the solution implied by the refined and uniform truncation methods to those of standard alternative methods such as [START_REF] Reiter | Solving Heterogeneous-Agent Models by Projection and Perturbation[END_REF]. The refined truncation method appears to be accurate, even when it only involves a parsimonious finite state-space representation.

Numerical accuracy of the method is obtained thanks to a generalization of the aggregation procedure developed inLeGrand and Ragot (2022) for the uniform truncation method. In the full-fledged incomplete-market model, there are different agents with the same truncated history, but these agents generally have different complete histories (in particular prior to the truncation date). Each truncated history thus features within-heterogeneity that the truncation method accounts for using residual-heterogeneity parameters. With the refined truncation, we can control the magnitude of this within-heterogeneity and extend the truncation length for histories in which the within-heterogeneity is too large. The combination of refinement with residual-heterogeneity parameters leads to a very accurate dynamics for the truncated representation, even when the number of truncated histories remains small. In our quantitative exercise, we show that a short uniform truncation length, coupled with long refinement lengths (that thus keeps an overall small number of truncated histories) provides accurate results that are comparable to those of other standard methods (such as Reiter's).

This paper belongs to the literature on solution techniques for heterogeneous-agent models.

After the seminal contributions of [START_REF] Krusell | Income and Wealth Heterogeneity in the Macroeconomy[END_REF] and [START_REF] Rios-Rull | Computation of Equilibria in Heterogenous Agent Models[END_REF], different solutions have been proposed in the literature. Den Haan (2010) presents a comparison of these methods. Since then, the method of [START_REF] Reiter | Solving Heterogeneous-Agent Models by Projection and Perturbation[END_REF] has become the most popular technique to solve for heterogeneous-agent models in discrete times. This method has been refined in posterior developments, in [START_REF] Ahn | When Inequality Matters for Macro and Macro Matters for Inequality[END_REF], [START_REF] Winberry | A Method for Solving and Estimating Heterogeneous Agent Macro Models[END_REF], [START_REF] Bayer | Precautionary Savings, Illiquid Assets, and the Aggregate Consequences of Shocks to Household Income Risk[END_REF] among others.

Recently, [START_REF] Boppart | Exploiting MIT Shocks in Heterogeneous-Agent Economies: The Impulse Response as a Numerical Derivative[END_REF] and [START_REF] Auclert | Using the Sequence-Space Jacobian to Solve and Estimate Heterogeneous-Agent Models[END_REF] present new methods that are both based on the deterministic non-linear simulations of the economy following small "MIT shocks" that are then used to linearly approximate equilibrium solutions. These methods are known to be quantitatively close to each other and to the one of [START_REF] Reiter | Solving Heterogeneous-Agent Models by Projection and Perturbation[END_REF]. Some other methods use continuous-time techniques to facilitate the resolution (see Kaplan et al., 2018 or Nuño andMoll, 2018 among others). Finally, the current paper provides a refinement on the initial presentation of the truncation method in [START_REF] Legrand | Managing Inequality over the Business Cycle: Optimal Policies with Heterogeneous Agents and Aggregate Shocks[END_REF]. We offer a solution to control for the magnitude of the heterogeneity within truncated histories, while their number remain small. The paper is organized as follows. Section 2 presents the environment. The truncation method is presented in Section 3. A numerical example is provided in Section 4. Section 5 is the conclusion.

The environment

The objective of this paper is to present the truncation methodology in a simple setup, so as to make the exposition of the method transparent. We rely on the same environment as the one of Den Haan et al. (2010), which is a simple heterogeneous-agent economy with aggregate productivity risk. This will allow us to compare the truncation method with other simulations techniques, which are known to provide accurate results. 2 The focus of the paper being the quantitative implementation of the truncation method, we do not provide mathematical convergence results. (see LeGrand and Ragot, 2022 for a more technical presentation of a similar setup).

We consider a one-good economy populated by a group of ex-ante identical agents. Time is discrete and indexed by t = 0, 1, . . .

Risks

The economy is affected by two types of risk: an aggregate risk and an individual one. The aggregate risk, denoted Z t solely affects TFP. . It takes values in a possibly continuous set.

Finally, the aggregate risk is assumed to be Markovian. Its precise dynamics will be specified when needed.

The other risk is the idiosyncratic risk. While each agent is assumed to provide an inelastic labor supply normalized to 1, labor productivity is individual and stochastic. The productivity risk is agent-specific and we assume that agents cannot insure against it. Asset markets are thus incomplete with respect to this productivity risk. The productivity is denoted y and assumed to take value in a finite set Y, where the productivity levels are assumed to be ordered. Higher values of y correspond to higher productivity levels. The productivity process of a given agent follows a first-order Markov chain with constant transition probabilities (Π yy ) y,y ∈Y , that are in particular assumed to be independent of the aggregate risk. The probability that an agent currently endowed with productivity y will have productivity y in the following period is equal to Π yy ∈ [0, 1]. Furthermore, transition probabilities verify: Π yy ≥ 0 and y ∈Y Π yy = 1, reflecting that probabilities must be nonnegative and that independently of the current productivity y, the agent will be endowed with some productivity level y in the next period. Finally, an individual history of productivity shocks up to date t is denoted by y t = {y 0 , . . . , y t } ∈ Y t+1 .

Production

The production sector is standard. A representative profit-maximizing firm produces the sole consumption good of the economy, by combining labor and capital. We consider a Cobb-Douglas production function with constant returns-to-scale, a capital share α ∈ (0, 1), and a capital depreciation rate δ ∈ (0, 1). Since individual labor supply is fixed and normalized to 1, aggregate labor supply is constant and denoted by L > 0. The TFP Z t is stochastic. Formally, the production at date t of Y t units of good is defined as:

Y t = Z t K α t-1 L 1-α -δK t-1 , (1)
where the capital K t-1 is requested to be installed one period in advance. The firm rents labor and capital at respective factor prices w t and r t . The profit maximization conditions of the firm implies the following expression for factor prices:

w t = (1 -α)Z t K α t-1 L -α and r t = αZ t K α-1 t-1 L 1-α -δ.
(2)

Agents' preferences and program

The instantaneous utility function over consumption is denoted by u. As is standard, u : R + → R is assumed to be twice continuously differentiable, strictly increasing, and strictly concave, with

u (0) = ∞.
Agents are expected-utility maximizers who maximize the expected sum of discounted utility:

E 0 ∞ t=0 β t u(c t )
, where: 0 < β < 1 is a constant discount factor, (c t ) t≥0 a consumption path, and E 0 an expectation operator over future aggregate and individual shocks.

Agents can save in each period by trading capital shares that pay off the real interest rate r t . . Agents are furthermore prevented from short-selling capital shares and hence face possible borrowing constraint. The combination of market incompleteness with exogenous borrowing limits is the usual market imperfection in the heterogeneous agent literature [START_REF] Bewley | A Difficulty with the Optimum Quantity of Money[END_REF][START_REF] Imrohoroğlu | The Welfare Cost of Inflation under Imperfect Insurance[END_REF][START_REF] Huggett | The Risk Free Rate in Heterogeneous-Agent Incomplete-Insurance Economies[END_REF][START_REF] Aiyagari | Uninsured Idiosyncratic Risk and Aggregate Saving[END_REF]. Given an initial endowment a -1 and an initial productivity level y 0 , the agent chooses her consumption path (c t ) t≥0 , and her saving plans (a t ) t≥0 so as to maximize her intertemporal utility, subject to per-period budget constraints and borrowing limits. Formally, the agent's program can be written as:

max (ct,at) t≥0 E 0 ∞ t=0 β t u(c t ),
(3)

c t + a t = (1 + r t )a t-1 + w t y t , ( 4
)
a t ≥ 0, a -1 given. ( 5
)
The budget constraint (4) states that the agent finances consumption c t and savings purchases a t out of saving payoffs (1 + r t )a t-1 and labor earnings w t y t -where we recall that labor supply is normalized to 1. Equation ( 5) is the borrowing constraint.

Denoting by β t ν t the Lagrange multiplier on the credit constraint, the agent's Euler equation can be written as:

u (c t ) = βE t (1 + r t+1 )u (c t+1 ) + ν t , ( 6
)
where ν t = 0 if the agent saves a positive amount, i.e., if a t > 0.

Resource constraints and equilibrium definition

All agents are ex-ante identical but experience different productivity histories. This means that agents are endowed with different streams of income and hence make different choices for the trade-off between consumption and savings. So, though identical ex-ante, agents will be heterogeneous ex post.To distinguish between agents, we add a superscript i to refer to an agent i in the population. 3 In the initial period, agents are distributed along a set I with measure (•) : Since the population of every agent i is (di), the financial market clearing condition can be written as:

ˆi a i t (di) = K t , ( 7
)
that formalizes that the sum of all individual savings is equal to aggregate capital. Similarly, the equilibrium on the goods markets state that the sum of all individual consumption plus the current capital should equal the production and pasty capital. Formally:

ˆi c i t (di) + G t + K t = Y t + K t-1 . (8)
Finally, the labor market clearing condition implies a relationship between aggregate labor L and individual productivity levels:

ˆi y i (di) = L, (9)
that can also be seen as a definition of L.

We can now state our market equilibrium definition.

Definition 1 (Sequential equilibrium) A competitive equilibrium is a collection of individual plans (c i t , a i t ) t≥0,i∈I , of aggregate quantities (K t , Y t ) t≥0 , and of price processes (w t , r t ) t≥0 , such that, for an initial wealth and productivity distribution (a i -1 , y i 0 ) i∈I , and for initial values of capital stock verifying K -1 = ´i a i -1 (di), we have:

1. given prices, the functions (c i t , a i t ) t≥0,i∈I solve the agent's optimization program in equations ( 3)-(5); 2. financial and goods markets clear at all dates: for any t ≥ 0, equations ( 7) and ( 8) hold; 3. factor prices (w t , r t ) t≥0 are consistent with condition (2).

The standard recursive approach

A difficulty with the equilibrium of Definition 1 is that it features an infinite number of different agents' consumption and saving levels. These agents indeed differ along their productivity history, and therefore along savings and consumption choices. However, the formulation of Section 2 is unhelpful to tackle the computation of the equilibrium as the distribution (•) offers very little structure and suggests that we should solve for all individual programs and then iterate on prices until the financial market clears. Obviously, given the dimensionality of the problem, this is not an achievable goal.

The standard approach in the literature since [START_REF] Imrohoroğlu | The Welfare Cost of Inflation under Imperfect Insurance[END_REF] and [START_REF] Huggett | The Risk Free Rate in Heterogeneous-Agent Incomplete-Insurance Economies[END_REF] consists in taking advantage of the recursive formulation. More precisely, the heterogeneity in productivity histories is summarized in two idiosyncratic state variables: the beginning-ofperiod asset holding and the current productivity level. In other words, instead of reasoning on sequences of productivity level realizations, the recursive method focuses on the pair of beginning-of-period asset holding and current productivity level. That the individual sequential program admits an equivalent recursive formulation in an economy without aggregate shocks is proved in [START_REF] Huggett | The Risk Free Rate in Heterogeneous-Agent Incomplete-Insurance Economies[END_REF] and generalized in [START_REF] Açikgöz | On the Existence and Uniqueness of Stationary Equilibrium in Bewley Economies with Production[END_REF]. The recursive formulation lends itself to computing the equilibrium quite easily without aggregate shocks (Z being constant). There are several methods to compute the policy function (Endogenous Grid Method of [START_REF] Carrol | The Method of Endogenous Grid Points for Solving Dynamic Stochastic Optimization Problems[END_REF] being one of the most efficient one, see https://julia.quantecon.org/dynamic_programming/egm_ policy_iter.html for lecture notes). Once policy functions have been calculated, a stationary distribution can be computed by simulating a population of N agents over a given number of periods T (see [START_REF] Rios-Rull | Computation of Equilibria in Heterogenous Agent Models[END_REF] or using the policy rules to construct a transition matrix over the distribution of wealth. The steady-state distribution is the fixed-point of this transition matrix [START_REF] Young | Solving the Incomplete Markets Model with Aggregate Uncertainty using the Krusell-Smith Algorithm and Non-Stochastic Simulations[END_REF]. This distribution can then be aggregated to check whether the financial market clears or not. If the market does not clear, the interest rate is updated and the procedure repeated until market clearing. When the market clears, the equilibrium interest rate and asset distribution are known. 4The introduction of aggregate shocks greatly complexifies the resolution of heterogeneousagent models, since the distribution of wealth becomes time-varying. Seminal contributions for approximating the model solution are [START_REF] Krusell | Income and Wealth Heterogeneity in the Macroeconomy[END_REF] and [START_REF] Rios-Rull | Computation of Equilibria in Heterogenous Agent Models[END_REF], who relied on simulations techniques. Den Haan (2010) proposes a comparison of the different methods available at that date. Since this comparison, [START_REF] Reiter | Solving Heterogeneous-Agent Models by Projection and Perturbation[END_REF] has developed a method that is now widely adopted. More recently, [START_REF] Boppart | Exploiting MIT Shocks in Heterogeneous-Agent Economies: The Impulse Response as a Numerical Derivative[END_REF] and [START_REF] Auclert | Using the Sequence-Space Jacobian to Solve and Estimate Heterogeneous-Agent Models[END_REF] have developed similar methods that yield results close to the method of Reiter. The truncation method will also generate results close the ones obtained with other solution techniques. Its interest relies on its simplicity, allowing for new applications as the derivation of optimal policies mentioned above.

The truncation method in practice

The truncation method is based on an aggregation procedure in the history-representation (or sequential representation). We detail in this section how to use this method and compare it numerically with other solution techniques in Section 4.

Constructing the truncated model

The truncation requires to come back to the sequential model formulation instead of the recursive formulation. Its core idea is to group together agents who share the same productivity history over the recent past and to express the model using these groups of agents, which will act as history-specific representative agents. We present two methods to group agents according to their recent productivity history: (i) the uniform truncation, which involves an identical history length for all agents, and (ii) the refined truncation, which allows one to consider histories of different lengths. The refined-truncation model is the specific contribution of this paper.

The uniform truncation. In the uniform truncation, initially proposed in LeGrand and Ragot (2022), agents, who share a common productivity of a given length, will be grouped together into so-called truncated histories. Such agents will be called companions. This length, which is identical for all agents, will be called the truncation length and is a method parameter. For instance, if the truncation length is set two periods, and if there are two productivity levels y H > y L , the truncated representation will feature four truncated histories: {(y H , y H ), (y L , y H ), (y H , y L ), (y L , y L )}. Each agent will then be assigned to one of these four truncated histories, depending on her current and past productivity status. We will use the convention that (y L , y H ) corresponds to agents who currently have productivity y H and had productivity y L in the previous period.

More generally, if we denote by N > 0 the truncation length, a truncated history will be a vector y N = (y -N +1 , . . . , y -1 , y 0 ), where y 0 represents the current productivity status, and y -N +1 the productivity N periods ago. The truncation method will then consist in assigning agents with infinite history y ∞ = (. . . , y -N -1 , y -N , y -N +1 , y -N +2 , . . . , y -1 , y 0 ) at date t to the truncated history y N , independently of productivity levels having occurred more than N periods ago (such as the value of y -N -1 or y -N ). The infinite history of a given agent is updated in every period and the composition of truncated histories does not remain fixed through time. For instance, if we assume that an agent with history y ∞ at t draws the productivity ỹ0 at date t + 1, her history at t + 1 will become: ỹ∞ = (. . . , y -N -1 , y -N , y -N +1 , . . . , y -1 , y 0 , ỹ0 ). 5 The agent will thus be assigned at date t + 1 to truncated history ỹN = (y -N +2 , . . . , y 1 , y 0 , ỹ0 ). With this construction, if n y = Card(Y) denotes the number of productivity levels, there will be N tot = n N y truncated histories of length N .

It is noteworthy that in each period, the uniform truncation that assigns an agent with history y ∞ to truncated history y N is well defined. Indeed, for any agent (more precisely for any history y ∞ ), there exists one, and exactly one, truncated history y N ∈ Y N to which the agent will be assigned. The fact that the the uniform truncation assignment is well defined makes the model representation with truncated histories (y N ) y N ∈Y N feasible. In particular, we can define the quantities Π y N ỹN , as follows:

Π y N ỹN = 1 ỹN y N Π y 0 ỹ0 , ( 10
)
where Π y 0 ỹ0 is the (time-independent) probability to transit from productivity y 0 to productivity ỹ0 , 1 ỹN y N = 1 if ỹN is a possible continuation of y N (i.e., if y N is a possible past history for ỹN , formally: ỹ-1 = y 0 , ỹ-2 = y -1 ,. . ., ỹ-N+1 = y -1 ), and 0 otherwise. The quantities Π y N ỹN are positive and verify ỹN ∈Y N Π y N ỹN = 1 for all y N . The matrix (Π y N ỹN ) y N ,ỹ N ∈Y N is thus a well-defined transition matrix for truncated histories -with Π y N ỹN being the transition probability from y N to ỹN . Truncated histories can thus be thought of as a first-order Markov chain with the state space Y N and the transition matrix (Π y N ỹN ).

The refined truncation. The uniform truncation has the drawback that the number of truncated histories grows exponentially with the length of the truncation. To avoid this exponential growth, this paper proposes a refined truncation method that allows considering truncated histories of unequal length. The intuition is to use longer lengths for some truncated histories that are particularly large or heterogeneous. The constraint is twofold: (i) obtain a well-defined mapping between agents (i.e., infinite histories) and these unequal-length truncated histories, and (ii) obtain a well-defined transition probability matrix between truncated histories. First, an arbitrary set of truncated histories of unequal lengths is unlikely to yield a well-defined mapping. For instance and to provide intuition, still in the case of two productivity levels, the ). This yields the set R(N, N + 1, N ) that contains

2 N + 1 histories. Going from R(N, N + 1, N ) to R(N, N + 2, N ) involves substituting y N +2 H and (y L , y N +1 H ) to y N +1

H

. These steps can be repeated until we obtain R(N, N H , N ). Overall, this refinement has consisted to substitute to y N H the set {y N h H } ∪ {(y L , y k H ) : k = N, . . . , N H -1}, while preserving by construction a well-defined mapping between infinite and truncated histories, as well as a well-defined transition probability matrix. The longest history is of length N H and the set of refined histories includes 2 N + N H -N history: increasing the maximal history length implies a linear increase in the number of truncated histories. The construction of R(N, N H , N L ) is analogous and involves refining the history y N L instead of y N H . 7 The number of truncated histories in the set

R(N, N H , N L ) is 2 N + N H + N L -2N .
A key implication is that it is possible in practice to combine a small value for N with large values for N L and N H to obtain an accurate solution. The increase in the number of histories is now linear instead of exponential.

Compared to the uniform truncation, the refined truncation enables us to target the truncated histories that deserve a more precise representation, while preserving a small total number of truncated histories. We will see in the quantitative section that the refined truncation improves the precision of the uniform truncation. We will also explain in this section how the lengths N , N H , and N L can be chosen -where N L can be chosen independently of N H as long as

N H , N L ≥ N .
Similarly to equation ( 10), we can define for any two histories h and h of R(N, N H , N L ) the quantity Π h h as follows:

Π h h = 1 h h Π y h 0 y h 0 , ( 11
)
where y h 0 is the current productivity for truncated history h, and as previously, Π y h 0 y h 0 is the (time-independent) probability to transit from productivity y h 0 to productivity y h 0 , and 1 h h = 1 if h is a possible continuation of h and 0 otherwise. Since histories h and h can be of unequal lengths, checking that h is a possible continuation of h is more involved that in the continuous case. 8

Importantly, with our refined truncation, it can be checked that the matrix

(Π h h) h, h∈R(N,N H ,N L )
is a well-defined transition matrix for refined truncated histories, with Π h h being the transition probability from h to h.

Truncated history representation.

We now present the construction of the truncated model based on the truncated histories. The construction is identical whether we consider a uniform or a refined truncation. We consider as given a set of truncated histories constructed based on an arbitrary number of productivity levels. The cardinal of R is denoted N tot its elements will be indexed h k , with k = 1, . . . , N tot .

Truncated histories can thus be thought of as representative agents, whose inside composition evolves through time -but this will be mostly hidden in model equations by the law of large numbers. In particular, the size of a truncated history h k , denoted by S h k , can be defined recursively as:

S h k = Ntot k=1 S h k Π h k h k , ( 12
)
which reflects that agents with truncated history h had truncated history ĥ in the previous period with probability Π h k h k .

We can also assign to each truncated history its own consumption level and its own endof-period savings, that will be denoted c t,h k and a t,h k respectively. There is a link between

8 If we denote h = (y h -n h +1 , . . . , y h -1 , y h 0 ) and h = (y h -n h +1 , . . . , y h -1 , y h 0 ), h h iff: (i) either nh > n h and y h -k = y h -k+1 for all k = 1, . . . , n h , (ii) or n h ≥ nh and y h -k = y h -k+1
for all k = 1, . . . , nh -1. The latter case supersedes the uniform case.

individual consumption and truncated history consumption, since the latter is defined as the average of consumption levels of individuals whose infinite history maps onto the truncated history under consideration. The beginning-of-period savings, denoted ãt,h k , reflect the fact that these savings are actually savings at the end of the previous period of agents having a possibly different truncated history. Similarly to the recursion (12) for sizes, end-and beginning-of-period savings are connected through the following relationship:

ãt,h k = 1 S h k Ntot k=1 S h k Π h k h k a t-1,h k . ( 13
)
We then deduce that the budget constraint at the truncated history level can be written as:

c t,h k + a t,h k = (1 + r t )ã t,h k + w t y h k 0 . ( 14
)
The interpretation is similar to the individual budget constraint (4) and the underlying movement of individual agents between history is not visible once the expression of ãt,h is understood.

The second equation characterizing the truncated-history economy is the Euler equation. If

we denote by C t the set of credit-constrained truncated histories, we have:

∀h k ∈ R \ C t , ξ t,h k u (c t,h k ) = βE t (1 + r t+1 ) Ntot k=1 Π h k h k ξ t+1,h k u (c t+1,h k ) , ( 15
)
∀h k ∈ C t , a t,h k = 0, (16)
where the expectation is over aggregate shocks only -the expectation over future truncated histories having been written explicitly. The parameters (ξ t,h ) h that appear in (15) can be understood as residual heterogeneity parameters, which capture the fact that the truncated history features within-heterogeneity. Indeed, although companions having the same truncated history share by construction the same history over some periods, they differ along their productivity levels in the distant past (prior to the length of the truncated history). The truncated history therefore gathers partly heterogeneous individuals and this heterogeneity is taken care off in the Euler equation through the so-called ξs. Finally, equation ( 16) reveals that truncated histories in C t,N,N h ,N l are credit-constrained, and that this corresponds to zero asset holdings.

Role of the ξs. The ξs capture heterogeneity among companions. In the full model, the ξs are time-varying, while in our method, they will be computed using the steady-state allocation and will be kept constant in the presence of aggregate shocks. With this key assumption, the model simulation simplifies into the simulation with a finite set of agents (i.e., the truncated histories) and standard perturbation techniques can be used. Moreover, when heterogeneity is small among companions of the same truncated history h, the corresponding ξ h will be close to 1. We explore below the quantitative cost of imposing ξ = 1 as an approximation (instead of the steady state values of ξ). This cost appears to be very small for well chosen truncation, as shown in Section 4.3.1.

To summarize, the truncated model is characterized by parameters (ξ h ) k , the probabilities (Π h k h k ) k k derived from the initial transition matrix and equation ( 10), the sizes (S h k ) k of (12) and allocations (c t,h k , a t,h k , ãt,h k ) h k determined in equations ( 13)-( 15). Importantly, the number of unknowns and equations is finite (and equal to 5N tot + N 2 tot ), which offers a limited-heterogeneity model. The truncated model can be thought of as a model with N tot representative agents with different relative sizes and some within-heterogeneity that is addressed by the ξs.

We now present the practical implementation of the truncation method to solve models with aggregate shocks. The method relies on three steps. First, we explain how to select the ξs parameters. In particular, we show how to derive these ξ-parameters from any given steady-state distribution of wealth across histories (a t,h k ) k , for a given set R of truncated histories. This initial distribution can be given by different sources, but it is more consistent to derive it from a well-defined Bewley model. The second step is thus to derive this initial distribution of wealth across histories from he aggregation of a full-fledged Bewley model. Third, knowing the ξs, one can use simple perturbation techniques to compute the dynamics with aggregate shocks, using packages like Dynare. The comparison of the outcome of the truncation model with other solution techniques will be done in Section 4.

Implementation: From allocation to the determination of the ξs

We focus here on the steady-state which corresponds to a fixed TFP: Z t = Z for some Z > 0 at all dates. Steady-state variables are denoted without time subscript. We denote by C the set of credit-constrained truncated histories. We consider as given a steady state distribution of end-of-period wealth, that we denote by a h k , 1 ≤ k ≤ N tot . Our objective is to obtain the

corresponding ξ h k , 1 ≤ k ≤ N tot .
The first step is to use this distribution to determine the set of credit-constrained truncated histories C. A truncated history will be assumed to be credit constrained when end-of-period saving is null: If a h k 0, then h k ∈ C. We deduce from equations ( 12)-( 16) that the steady-state economy is then characterized by the following set of equations

ãh k = 1 S k Ntot k =1 S h k Π h k h k a h k , ( 17
)
c h k + a h k = (1 + r)ã h k + wy h k 0 , ( 18
)
h k / ∈ C, ξ h k u (c h k ) = β(1 + r) Ntot k =1 Π h k h k ξ h k u (c h k ), ( 19
)
h k ∈ C, a h k = 0. ( 20
)
A very convenient way to express the truncated model allocation involves using matrix notation.

We introduce the following notations:

• S = (S h k ) k=1,...,Ntot the N tot -vector of sizes;

• Π = (Π h k h k ) k,k =1,.
..,Ntot the N tot × N tot matrix of transition probabilities across histories;

• c = (c h k ) k=1,...,Ntot , a = (a h k ) k=1,...,Ntot , ã = (ã h k ) k=1,...,Ntot , the N tot -vectors of allocations (consumption, end-of-period and beginning-of-period savings);

• y 0 = (y h k 0 ) k=1,...,Ntot is the vector of current productivity levels across histories

• ξ = (ξ h k ) k=1,...,Ntot the vector of residual-heterogeneity parameters;

• P = diag(p k ) k=1,...,Ntot , with p k = 1 if h k / ∈ C and p k = 0 if h k ∈ C, is a diagonal N tot × N tot -matrix; • D u (c) = diag(u (c h k )) is the diagonal N tot × N tot -matrix with u (c h k )
on the diagonal at rank k, and 0 elsewhere.

• I is the identity matrix.

• 1 Ntot is the N tot -vector of 1.

We also introduce the following operations:

• the term-by-term product of two vectors of the same size, which is another vector of the same size:

x z = (x h k ) (z h k ) = (x h k z h k ); 9
• × the usual matrix product: e.g., for a matrix M and a vector x (of length equal to the number of columns of M ), M × x is the vector

( k M h k h k x h k ) k .
To avoid heavy notations, we still denote without a sign the usual scalar multiplication -that is assumed to apply to matrix and vectors (e.g., λM = (λM h k h k ) k,k =1,...,Ntot ) and with + the addition -that is extended to matrices and vectors of same size (e.g., x + z = (x k + z k )).

We also keep the same notation for functions that apply element-wise to vectors:

f (x) = (f (x h k )) k=1,...,Ntot .
We can rewrite equations characterizing the steady-state of the truncated economy using this notation and explain how to construct the vector ξ. We start with equation ( 12):

S = Π × S, ( 21
)
which makes it clear that the vector of sizes, S, is the eigenvector of matrix Π associated to the eigenvalue 1, where the sum of the eigenvector coordinates is normalized to 1. 10 The vector S is thus straightforward to compute.

Second, equation ( 17) for per capita beginning-of-period wealth ã, which yields:

ã = (1/S) (Π × (S a)), ( 22
)
where 1/S = (1/S h k ) k=1,...,Ntot is the vector of size inverses and a is the given vector of end-ofperiod wealth. Note that if the size of truncated history is S h k = 0, we can set 1/S h k = 0, which will be consistent that a null-size history will get a null wealth.

Third, the budget constraint (18) becomes:

c + a = (1 + r)ã + wy 0 , ( 23
)
which allows one to obtain consumption levels using the given vector a of end-of-period wealth, and the vector of beginning-of-period wealth of equation ( 22).

The final step is to compute the residual heterogeneity parameters, ξ. We proceed in two steps. First, as a normalization, we set to 1 the ξs in constrained histories:

ξ h k = 1 if h k ∈ C.
This can be written as:

(I -P )ξ = (I -P )1 Ntot . ( 24
)
To understand ( 24), observe that the matrix I -P is a diagonal matrix with a 1 coefficient for constrained histories and a zero coefficient for constrained histories. In other words, P is a projection matrix on the set of constrained histories. For a generic vector x, the product (I -P )×x therefore selects the coordinates of x corresponding to constrained histories (completed by zeros for unconstrained histories, such that the whole vector is of length N tot ). This explains why equation ( 24) means ξ h k = 1 if h k ∈ C. Second, the Euler equation ( 19) for unconstrained histories can be written as:

P × D u (c) × ξ = P × β(1 + r)Π × D u (c) × ξ, ( 25
)
The intuition for equation ( 25) parallels the one for equation ( 24). Since P is a projection matrix on the set of unconstrained histories, it means that the relationship (25) only holds for unconstrained histories. Equation ( 25) can be written as P × (I -

β(1 + r)Π) × D u (c) × ξ = 0.
Adding it to (24), we obtain:

ξ = P × (I -β(1 + r)Π) × D u (c) + I -P -1 (I -P )1 Ntot , ( 26
)
where it can be shown that the matrix P × (I -

β(1 + r)Π) × D u (c) + I -P is invertible. 11
The determination of the vector ξ thus involves solving a linear system, which is fast in our applications.

We summarize these results in the following Algorithm.

Algorithm 1 (Calibration of the ξs) Consider a given initial distribution a. The set of credit constrained histories C can determined as:

C = {k = 1, . . . , N tot : a h k = 0},
while the steady allocation and the residual heterogeneity parameters ξ, can be found through the following set of equations:

ã = (1/S) (Π × (S a)), c = (1 + r)ã -a + wy 0 , ξ = P × (I -β(1 + r)Π) × D u (c) + I -P -1 (I -P )1 Ntot .
Algorithm 1 allows one to easily find the vector ξ and the equilibrium allocation, that corresponds to a given equilibrium wealth distribution a. Even though Algorithm 1 works for any acceptable distribution a (such as the one coming from some empirical estimation), we can derive further results on the convergence of this algorithm with the truncation length N when the distribution a is derived from the aggregation of the steady-state wealth distribution of a full-fledged Bewley model (LeGrand and Ragot, 2022). We now explain how to obtain such a distribution.

Deriving the steady-state wealth distribution for a Bewley model

The initial wealth distribution a is the vector of end-of-period wealth for all truncated histories h ∈ R. For each h, to obtain the component a h in a from a Bewley model, the intuition is to apply the proper sequence of policy rules that is consistent with truncated history h.

Let us proceed with a more formal description. The solution of a Bewley model is characterized by a steady-state wealth distribution and a set of policy rules for savings. The steady-state wealth distribution is a mapping µ : (a, y) ∈ [0; +∞) × Y → µ(a, y) ∈ R + , such that µ(da, y) corresponds to the (steady-state) measure of agents having a wealth lying in interval [a, a+da) and productivity level y. Similarly, saving policy rules are mappings g a : (a, y)

∈ [0; +∞) × Y → g a (a, y) ∈ R + ,
where g a (a, y) corresponds to the end-of-period wealth for an agent having the beginning-of-period wealth a and the current productivity level y.

To obtain the vector a of Algorithm 1, we need to compute the wealth distribution μ : (a, h) ∈

[0; +∞) × R → μ(a, h) ∈ R +
, where μ(da, h) is the measure of agents with wealth in interval [a, a + da) and truncated history h = (y h -n h +1 , . . . , y h -1 , y h 0 ). Such a measure can be computed by starting from the wealth distribution of agents in state y

h -n h +1 , which is µ(•, y h -n h +1
) and then applying successively the sequence of policy corresponding to h = (y h -n h +1 , . . . , y h -1 , y h 0 ).

Applying first g(•, y h

-n h +1 ) yields the end-of-period wealth distribution of agents in state y h -n h +1 .

We then apply the policy rule g(•, y h -n h +2 ) to obtain the end-of-period wealth distribution for agents with history (y h -n h +1 , y h -n h +2 ). Finally, we apply the remaining sequence of policy rules, g(•, y h -n h +3 ), . . . , g(•, y h 0 ), which ultimately yields the end-of-period wealth distribution of agents with truncated history h. The computational implementation of this procedure amounts to multiply an initial distribution with n h different transition matrices, which is very fast.

On the theoretical side, the ξ-parameters constructed from the aggregation of a Bewley model can be shown to converge toward 1 when the length of the uniform truncation N increases (see [START_REF] Legrand | Managing Inequality over the Business Cycle: Optimal Policies with Heterogeneous Agents and Aggregate Shocks[END_REF]. However, this asymptotic result is of little practical use, since N remains small in practice. Fortunately, as we check in Section 4, the ξ-parameters allows one to generate accurate results for short truncation lengths. As we will see, the refined truncation further offers accuracy gains.

Solving the model with aggregate shocks

Once the steady-state allocation is found following Algorithm 1, the simulation of the model in the presence of aggregate shocks is simple. Standard packages, such as Dynare, can be used to solve the model using perturbation techniques. We provide the Algorithm 2, but the simulation is direct.

Algorithm 2 (Simulating the model with aggregate shocks) We consider as given a truncation length, N > 0, a target steady-state wealth distribution, a ss , and the TFP is Z t = exp(z t ) with:

z t = ρ z z t-1 + ε t , where ε t iid ∼ N (0, σ 2 z ). ( 27
)
1. We use Algorithm 1 to obtain the vector ξ and the set of credit-constrained histories C that correspond to the steady-state wealth distribution a ss . The elements ξ and C are assumed to remain constant in the presence of aggregate shocks.

2. The model in the presence of aggregate shocks is thus determined by equation ( 27) and the following set of equations:

k = 1, . . . , N tot : ãh k ,t = 1 S h k Ntot k =1 S h k Π h k h k a h k ,t-1 , ( 28
)
c h k ,t + a h k ,t = (1 + r t )ã h k ,t + w t y 0 , ( 29
)
h k / ∈ C : ξ h k u (c h k ,t ) = βE t (1 + r t+1 ) Ntot k =1 Π h k h k ξ h k u (c h k ,t+1 ) , ( 30
)
h k ∈ C, a h k ,t = 0, ( 31
)
3. The model in equations ( 27)-( 31) can be simulated by perturbation method around the steady-state wealth distribution a ss .

Algorithm 2 provides a straightforward path to simulate the model in the presence of aggregate shocks. It is assumed that the log of the TFP follows a standard AR(1) process (actually, the algorithm easily extends to a more complex dynamic). The core of the simulation relies on off-the-shelve software, such as Dynare, that are already popular in macroeconomics. The two main assumptions of Algorithm 2 is that: (i) the ξs remain constant in the presence of aggregate shocks; (ii) the set-of credit-constrained truncated histories is also unaffected by aggregate shocks.

The second assumption is not directly related to our method and comes from the fact that the model simulation relies on a perturbation method that does not lend itself to time-variations in credit-constrained truncated histories. The first assumption regarding the ξs means that the within-heterogeneity remains constant over time and equal to its steady-state value. However, it is noteworthy that this assumption does not mean the absence of within-heterogeneity.

From a practical aspect, the ξs and the set of credit-constrained histories are determined using Algorithm 1. The model in equations ( 27)-( 31), featuring constant ξs and a constant set of credit constrained can then be input in Dynare.

4 Quantitative exercise

The calibration

Preferences. The period is a quarter. The discount factor is set to β = 0.98 to obtain a realistic capital-output ratio in our environment. The period utility function is log(c).

Technology and TFP shock. In the production function of (1), the capital share is set to α = 36% and the depreciation rate to δ = 2.5%, as in [START_REF] Krueger | On the Distribution of the Welfare Losses of Large Recessions[END_REF] among others. The TFP process is standard: Z t = exp(z t ), with z t = ρ z z t-1 + ε z t , where ε z t iid ∼ N (0, σ 2 z ). We use the standard values ρ z = 0.95 and σ z = 0.31% to obtain a deviation of the TFP shock z t equal to 1% at the quarterly frequency (see e.g., Den Haan, 2010).

Idiosyncratic risk. Idiosyncratic productivity risk is the key ingredient for the model to generate a realistic earning and wealth distribution. We opt for an AR(1) productivity process: log y t = ρ y log y t-1 + ε y t , with ε y t iid ∼ N (0, σ 2 y ). We calibrate the parameters ρ y and σ y , such that the persistence and variance of the labor income y match some estimated values.

Two discuss the accuracy of the method, we consider two calibrations, with two values for the persistence of the idiosyncratic risk. Indeed, this last parameter appears to be crucial to calibrate the truncation, as discussed below. 12In the first calibration, we use a quarterly persistence of ρ y = 0.99 and a quarterly standard deviation of σ y = 10.1%, which generate, for the log of earnings, an annual persistence of 0.9617 and an annual standard deviation of 3.96%. This first calibration, which is in line with [START_REF] Krueger | On the Distribution of the Welfare Losses of Large Recessions[END_REF], generates a very high persistence of the idiosyncratic risk. In the second calibration, we reduce the persistence of the idiosyncratic risk to ρ y = 0.97, keeping the standard deviation constant. This second calibration is introduced to discuss the impact of some key parameters of the model on the accuracy of the method.

In both cases, we use the [START_REF] Rouwenhorst | Asset Pricing Implications of Equilibrium Business Cycle Models[END_REF] procedure to discretize the productivity process into 2 idiosyncratic states with a constant transition matrix, to be consistent with the theoretical part. Table 1 2: Parameters for the labor process for the two persistences of the idiosyncratic labor process, discretized using the Rouwenhorst procedure.

The probability to switch from one state to another is 3 times lower, when the persistence increases from 0.97 to 0.99.

Steady-state results

In the first calibration (ρ y = 0.99), we find a steady-state capital-output ratio equal to K/Y = 2.15 and a consumption-output ratio is C/Y = 0.79, which are standard statistics in the US. In the second calibration (ρ y = 0.97), the capital output ratio is K/Y = 2.09 and a consumption-output ratio is unchanged to C/Y = 0.79.

We now report the steady-state values of the parameters ξs for two truncation strategies and for the two parameters in Table 3. In the first calibration (ρ y = 0.99), we consider two truncation strategies. The first one (entitled Uniform) corresponds to the general truncation procedure, where all histories have the same length. This corresponds to the set of uniform truncated histories R(N, N, N ) for different truncation lengths N (see Section 3.1 for the definition of R).

In the second strategy, we consider a refined truncation, with the set R(1, N H , N H ), where all truncated histories have a common length of 1 (i.e., two states only), and where the refinement length N H is identical for both states. To make the two strategies comparable, we report them for a given total number of histories (N tot ). We then report for different values of N tot , the standard deviation of the ξs (in percents) for each of the persistence values and two truncation strategies. For instance, when the truncation have only four histories, the standard deviation of ξ is 10.2% for the two strategies when ρ y = 0.99 and 7.3% when ρ y = 0.97. When we consider 1024 histories, the standard deviation in the case when ρ y = 0.99 decreases to 3.3% for the refined truncation, but only 9.0% for the uniform truncation. When the persistence is ρ y = 0.97, these two values ate 4.1% and 6.5%, respectively.

We observe that the Uniform truncation is dominated by the Refined truncation in all cases.

Moreover, the standard deviation of the ξs decreases faster with the number of histories N tot for the refined strategy than for the uniform one. A final remark is that for the refined strategy, the standard deviation does not decrease much beyond N tot = 256. Decreasing it further would require to increase the length of common histories (for instance R(2, N H , N H )).

ρ y = 0.99 ρ y = 0.97

N

Results in the presence of aggregate risk with ρ y = 0.99

We now report model outcomes in the presence of aggregate risk when the idiosyncratic risk persistence is ρ y = 0.99. The case ρ y = 0.97 provides very similar results and is presented in Appendix A to save some space. We compare the outcomes of the refined truncation method to those of the histogram representation and perturbation methods, developed by Rios-Rull (2001), [START_REF] Reiter | Solving Heterogeneous-Agent Models by Projection and Perturbation[END_REF][START_REF] Young | Solving the Incomplete Markets Model with Aggregate Uncertainty using the Krusell-Smith Algorithm and Non-Stochastic Simulations[END_REF] among others, which we call the Reiter method for brevity.13

The method is known to provide accurate results, when compared to the global method of Krusell and Smith (1998), as shown in [START_REF] Boppart | Exploiting MIT Shocks in Heterogeneous-Agent Economies: The Impulse Response as a Numerical Derivative[END_REF] or in [START_REF] Auclert | Using the Sequence-Space Jacobian to Solve and Estimate Heterogeneous-Agent Models[END_REF]. We also compare these results to those of a complete market economy, labeled RA for Representative Agent. This last economy is a simple RBC model, where the representative agent supplies one unit of labor with the average productivity. This allows us to quantify the effect of market incompleteness and heterogeneity on model outcomes. We compare the three cases (truncation, Reiter and RA) along three dimensions: (i) Impulse Response Functions (IRFs), (ii) Simulation paths of the economy, and (iii) Second-order moments.

Choice of the truncation lengths. We consider a refined truncation method corresponding to truncated histories R(1, N H , N L ), with a one-length common history and a length N L and N H for the refined histories in the low and the high productivity states, respectively. To choose N L and N H , we progressively increase the refinement length for each state to simulate the dynamics, until the dynamics of the main variables barely change. As can be seen in Table 3, the standard deviation of t he ξs reaches a plateau but the dynamics of aggregate variables stops being affected before the minimal standard deviation is reached. In Table 4 , we report for each of the two truncation persistences the chosen truncation, the total number of histories N tot , and the associated standard deviation of the ξs.

Persistence ρ y Set of truncated histories N tot std(ξ)

ρ y = 0.99 R(1, 5, 150) 155 3.46 ρ y = 0.97 R(1, 5, 90) 95 4.32
Table 4: Choice of the optimal truncation for two calibrations.

First, the refined truncation features different lengths for the high and low states. For the case ρ y = 0.99, the chosen truncation corresponds to R(1, 5, 150), implying that a maximal history length of 5 for the low productivity state and a maximal history length of 150 for the high productivity state. The reason for this asymmetry is that low productivity agents decumulate rapidly their assets, whereas high productivity agents accumulate their assets progressively. As a consequence, the length of the history of high productive agents needs to be high, while a relatively short history for the low productivity is sufficient to capture the relevant heterogeneity.

Thanks to the refinement procedure, the total number of history remains low and equal to N tot = 155. The corresponding standard deviation of ξs is 3.46%, which is higher than the minimal value of Table 3, but decreasing it further has little impact on the economy dynamics.

When the persistence is ρ y = 0.97, the chosen truncation is R(1, 5, 90). As the persistence is lower, a shorter history length for high-productive agents is sufficient, as they the share of the population remaining in the high productivity state decreases faster than in the ρ y = 0.99. The total number of histories is now 95 and the standard deviation of the ξs is 4.32.

We now show that these two truncations deliver very accurate results.

IRFs. IRFs for a selection of key variables are plotted in Figure 1. We focus on the following aggregate variables: GDP (GDP ), per-capita aggregate consumption (C), capital (K), and investment (I), as well as the real gross interest rate (R). We also plot the IRF for the per-capita consumption of the bottom 10% in the wealth distribution (C bot ).

We can draw several lessons from thus generate very close model outcomes.

Second-order moments

The final element of comparison between the three solution methods is the second-order moments of key aggregate variables, as well as the auto-correlations of consumption and GDP. Each economy is simulated over 10,000 periods to compute those moments. The results are reported in Table 6. The results confirm what was said for IRFs and simulation paths. The truncation and the Reiter methods generate very similar results, and only very small differences in the second-order moments generated by the two methods can be observed.

Are the ξs useful?

Using the refined-truncation method, we set the ξs = 1 (instead of their computed value) and simulate the economy. The result is reported in the last column of Table 6. We find that the simulation outcomes are not quantitatively different when we set ξ = 1 when we used the refined-truncation method. The result is different from LeGrand and Ragot (2022) who find the ξs are key for the accuracy of the uniform-truncation method. The difference in the results comes from the refined truncation. We indeed find that the standard deviation of ξs is as small as 3.46%. As a consequence, setting ξ = 1 is a second-order change in the results. We consider From these experiments, we conclude that the refined-truncation method generates very accurate results, with a small number of histories to follow. We provide in Appendix A the simulation results for the case ρ y = 0.97, which confirms what we found for ρ y = 0.99.

Conclusion

We have presented a refined-truncation method to for solve heterogeneous-agent models with aggregate shocks. This method elaborates on the uniform truncation method of LeGrand and Ragot (2022), which consists in providing a finite state-space representation of heterogeneous-agent economies by truncating idiosyncratic histories. The core idea involves considering considering finite-length (truncated) idiosyncratic histories instead of infinite ones. The refinement consists in allowing for truncated histories of different lengths. This allows one to better control the withinheterogeneity of finite-length histories, while keeping a small total number of histories to follow.

In the quantitative exercise, the refined method is shown to yield an accurate representation of the model. As the uniform truncation, the implementation of its refinement can rely on perturbation methods and standard packages (as Dynare). We propose examples in Julia, Matlab and Dynare as supplementary materials.

Figure 1 :

 1 Figure 1: Comparisons of IRFs for the main variables after a technology shock of 1%. The black line is the Reiter method. The blue dashed line is the truncation method.

Figure 2 :

 2 Figure 2: Simulation of aggregate variables for different simulation methods.

Figure 4 :

 4 Figure 4: Simulation of aggregate variables for different simulation methods.

  being more persistent that the state L). This means that when we focus on the set of uniform truncated histories {(y H , y H ), (y L , y H ), (y H , y L ), (y L , y L )}, a (sizably) larger share of agents will be assigned to truncated histories (y H , y H ) and (y L , y L ). A similar observation for the uniform truncation of length 3, where truncated histories (y H , y H , y H ) and (y L , y L , y L ) are also the largest ones. The idea of the refined truncation is to use a longer length for these larger histories. We can illustrate it based on the 2-period uniform truncation, where we perform two refinement rounds. In the first refinement step, the history (y H , y H ) will be refined into (y H , y H , y H ) and (y L , y H , y H ), simply by adding one extra past period. This yields the set {(y H , y H , y H ), (y L , y H , y H ), (y L , y H ), (y H , y L ), (y L , y L )}, which by construction corresponds to a well-defined truncation mapping and a well-defined transition probability matrix.6 In the second step, the history (y H , y H , y H ) can be refined into (y H , y H , y H , y H ) and (y L , y H , y H , y H ). We then obtain the set of truncated histories

	precisely the state H
	What we propose here is a construction of an unequal length truncation that enables us
	to obtain by construction a well-defined mapping. The starting point of our construction
	is the observation that only particular truncated histories deserve a longer length. Continu-
	ing the 2-state example, quantitative exercises typically involve persistent states (and more

set {(y H , y H , y H ), (y L , y H ), (y H , y L ), (y L , y L )} does not able to assign agents whose terminal history is (y L , y H , y H ). Oppositely, with the set {(y L , y H , y H ), (y H , y H ), (y L , y H ), (y H , y L ), (y L , y L )}, the same agent with terminal history (y L , y H , y H ) can be assigned to two truncated histories. Second, even in the case of a well-defined mapping, we need to check that the transition matrix between truncated histories is also well-defined. Consider for example the set {(y H , y H ), (y H , y L , y H ), (y L , y L , y H ), {y L }}, which corresponds to well-defined mapping. In that case, the transition matrix is not well-defined (the row associated to {y L } will not sum to 1), reflecting that agents with truncated history {y L } getting the productivity y H (and hence history {y L , y H }) cannot be assigned to any truncated history.

{(y H , y H , y H , y H ), (y L , y H , y H , y H ), (y L , y H , y H ), (y L , y H ), (y H , y L ), (y L , y L )}. Starting from a common length of 2 periods and a set of 4 truncated histories, a 2-round refinement leads to a longest history of 4 periods and a set of 6 truncated histories. A similar refinement can be conducted for history (y L , y L ).

We now provide a more formal construction of a set of refined truncated histories, when there are two productivity levels. We denote a set of refined truncated histories by R(N, N H , N l ),

where N is the uniform truncation length (on which the refinement is based), N H ≥ N is the longest refinement history for the state h and N L ≥ N is the longest refinement history for the state l. The recursion starts from the set R(N, N, N ) of uniform truncated histories that are all of length N . The first refinement step consists in substituting to the history y N H = (y H , . . . , y H N ) the histories y N +1 H and (y L , y N H ) = (y L , y H , . . . , y H N

Table 1 :

 1 provides a summary of the model parameters. Parameter values in the baseline calibration. See text for descriptions and targets.

	Parameter	Description	Value
	β	Discount factor	0.98
	α	Capital share	0.36
	δ	Depreciation rate	0.025
	ρ y	Autocorrelation idio. income	0.99 0.97
	σ y	Standard dev. idio. income	10.1%
	ρ z	Autocorrelation TFP	0.95
	σ z	Standard deviation TFP shock	0.31%

Table 2

 2 provides the details of the two labor processes used in the paper.

	Parameter	ρ y = 0.97	ρ y = 0.99
	y	[0.60, 1.39]	[0.38, 1.62]
	Π	0.985 0.015 0.015 0.985	0.995 0.005 0.005 0.995
	Table

Table 3 :

 3 Standard deviations of the ξs as a function of the number of histories N tot , for two persistence values.

	tot Refined Uniform Refined Uniform
	4	10.2	10.2	7.3	7.3
	8	9.9	10.0	7.1	7.2
	16	9.3	9.9	6.7	7.1
	32	8.2	9.7	6.0	7.0
	64	6.4	9.6	4.9	6.9
	128	4.1	9.5	4.1	6.8
	256	3.3	9.3	4.1	6.7
	512	3.3	9.2	4.1	6.6
	1024	3.3	9.0	4.1	6.5

Table 5 :

 5 Table5provides the median and maximum absolute deviations between the two simulations for the main variables. Comparison of simulated variables for the two computational techniques.

		Y	C	K
	Median abs. dev. ( %) 0.01 0.01 0.04
	Max. abs. dev. (%)	0.05 0.03 0.26

Table 6 :

 6 Second-order moments for different computational techniques this result as an additional gain of the refined truncation. 17

	Methods	RA	Reiter	Ref.Trunc ξ = 1
	GDP Mean	3.20	3.35	3.35	3.35
		Std/mean (%)	1.36	1.33	1.32	1.32
	C	Mean	2.57	2.63	2.63	2.63
		Std/mean (%)	1.12	1.08	1.08	1.08
	K	Mean	25.40	28.55	28.55	28.55
		Std/mean (%)	1.38	1.30	1.28	1.28
	corr(C, C -1 ) (%)	99.5	99.4	99.4	99.4
	corr(GDP, GDP -1 )	97.4	97.2	97.2	97.2

Table 7 :

 7 Moments of the simulated model for the two computational techniques and the Representative Agent economy.

	Methods	RA	Reiter	Trunc
	Economies	(1)	(3)	(4)
	GDP Mean	3.20	3.35	3.35
		Std/mean (%)	1.36	1.33	1.32
	C	Mean	2.57	2.63	2.63
		Std/mean (%)	1.12	1.09	1.08
	K	Mean	25.40	28.55	28.55
		Std/mean (%)	1.38	1.30	1.27
	corr(C, C -1 ) (%)	99.5	99.4	99.4
	corr(GDP, GDP -1 )	97.4	97.2	97.2

See[START_REF] Legrand | Should Monetary Policy Care About Redistribution? Optimal Fiscal and Monetary Policy with Heterogeneous Agents[END_REF] and[START_REF] Legrand | Managing Inequality over the Business Cycle: Optimal Policies with Heterogeneous Agents and Aggregate Shocks[END_REF] for the application of the uniform truncation method to solve for optimal policies in these environments. See also[START_REF] Bhandari | Inequality, Business Cycles, and Monetary-Fiscal Policy[END_REF] for an alternative method in environments without binding credit constraints.

It is interesting to note that since the comparison of Den Haan (2010), the literature has evolved to mostly use the method of Reiter (2009) (with possible improvements) and the recent method of[START_REF] Boppart | Exploiting MIT Shocks in Heterogeneous-Agent Economies: The Impulse Response as a Numerical Derivative[END_REF] using the simulation of transitions.

To simplify the exposition, we discuss the recursive representation below.

Several lecture notes provide a precise exposition of the resolution of the standard model. See for instance https://alisdairmckay.com/Notes/HetAgents/ or https://notes.quantecon.org/submission/

5f5f811909e80c001bbd6eaf.

For the sake of simplicity, we will denote with a tilde future truncated histories, with a hat past ones, and without decoration current ones.

Extending an arbitrary truncated history (different from (yH , yH ) or (yL, yL)) is unlikely to yield a well-defined transition matrix. See for instance the above counter-example {(yH , yH ),(yH , yL, yH ), (yL, yL, yH ), {yL}} that corresponds to the refinement of history (yL, yH ) in the set {(yH , yH ), (yL, yH ), (yL, yH ), {yL}}.

Obviously, we can also similarly refine histories when the number of productive states is arbitrary (though finite).

This operation is also known as Hadamard product.

The existence of a positive eigenvector vector is guaranteed by the Perron-Frobenius theorem for the positive matrix Π whose rows sum to 1.

The matrix I -β(1+r)Π is always invertible. Indeed, the Gershgorin circle theorem implies that all eigenvalues of Π are of modulus smaller than 1. Since β(1 + r) < 1 at the steady state (see[START_REF] Açikgöz | On the Existence and Uniqueness of Stationary Equilibrium in Bewley Economies with Production[END_REF] for instance), the eigenvalues of β(1 + r)Π remain strictly below 1. It is then straightforward to deduce that the columns of P × (I -β(1 + r)Π) × D u (c) + I -P are independent and hence the matrix is invertible.

We considered various changes in parameters such as the volatility of the idiosyncratic risk or the risk aversion, without any significant changes in the results.

The perturbation of Reiter can be used with bases other than histograms, such as in[START_REF] Winberry | A Method for Solving and Estimating Heterogeneous Agent Macro Models[END_REF] or[START_REF] Bayer | Precautionary Savings, Illiquid Assets, and the Aggregate Consequences of Shocks to Household Income Risk[END_REF].

With the truncation method, C bot is defined as the sum of consumption of truncated histories whose which approximately account for the bottom 10% of the consumption distribution.

In a previous version, we also simulated the model with the uniform truncation method with a similar number of histories. Results were very similar, except for the consumption bottom 10% which was less accurate with the uniform truncation.

We don't plot the outcomes for the RA economy as levels are very different.

We don't plot the IRFs with ξs = 1 because they are indistinguishable from those of Figure1obtained with the truncation method.

comments of many participants to seminars, where the truncation method has been presented. We also thank Diego Sousa for outstanding research assistance. We acknowledge financial support from the French National Research Agency (ANR-20-CE26-0018 IRMAC).

Appendix

A The case ρ y = 0.97

We report the simulation results for the case ρ y = 0.97. All other parameters are the same as the ones of Table 1. We report IRFs, simulation paths, and second-order moments with the same variables as in the main text (with ρ y = 0.99). All conclusions are the same: the Reiter and the RT-method are very similar, and both are different from the RA-economy.