First and foremost, I would like to express my sincere gratitude to my advisor Professor Étienne Wasmer for his invaluable guidance, patience, and open-mindedness throughout my graduate studies. Starting with my master thesis on the propagation of social norms and my initial Ph.D. research proposal, he has always been supportive of my research endeavor as it was evolving. Throughout this time, he conveyed indelible lessons that I will carry with me in my life as an economist.

Iw o u l dl i k et ot h a n kS c i e n c e sP op r o f e s s o r s ,g r a d u a t es t u d e n t sa n dt h ea d m i nistrative staff for creating this community of knowledge in which I could learn so much. I am indebted to Professor Nicolas Coeurdacier and Professor Stéphane Guibaud for their insights, rigor, and support. I want to thank my fellow cohortmates Jean-Louis Keen and Assia Elgouacem, with whom I shared my entire graduate experience. I could not overemphasize how much I valued our endless kitchen discussions and laughter. The same extends to the ones that came (or finished) before, Andreea, Aseem, Camilo, Charles, Clement, Dylan, Edoardo, Elisa, Emanuele, Eve, Etienne, Guillaume, Jamil, Jean-Benoît, Jean-Baptiste, Joanne, Marion, Nicolo, Paul, Pierre D., Pierre C., Riccardo, Simon, and Tyler. Thanks to them, I never felt lonesome on this journey.

Intellectually, this thesis owes immensely to Professor Markus Brunnermeier, Professor Yulyi Sannikov, Professor Lars Peter Hansen, Professor Andrew Lo, Professor Monika Piazzesi, and Mr. Tobias Adrian. When I started my graduate studies, I was fascinated by their invaluable contribution which played an important role in convincing me to devote my professional life to studying topics at the intersection of macroeconomics and finance. Thanks to the Macro-Financial Modeling group, the Alfred P. Sloan Foundation, the CME Group Foundation, Fidelity Management & Research and its generosity, I could eventually meet and interact with them during various visits in the US. These discussions were then incredibly impactful on my research and I would like to express my gratitude for their time. In this regard, I am particularly in debt to Professor Markus Brunnermeier for inviting me to Princeton University and offering me so much of his time. Similarly, I warmly thank Professor Ji Huang for inviting me to the National University of Singapore and for our thoughtful discussions. I am also very grateful to the members of the jury for giving of their valuable time and providing me with relevant feedback and comments.

Of course, this thesis wouldn't be what it is today without my invaluable collaboration with Adrien d'Avernas. We decided to work together from the start of our theses when we realized that we shared similar interests. We experienced both this daunting moment in the middle of a suffocating evening in Los Angeles when, after two entire months of intense coding, we realized that our approach was wrong and the fierce joy when we eventually witnessed the algorithm converging to the solution we had envisaged. Throughout, he has always shown confidence that our teamwork would allow us the reach our goals. It is, therefore, not an accident if all of the chapters of this thesis are based on work in which he took part but rather the consequence of the incredible synergies we built these last five years.

I wrote the last pieces of this thesis while working at the European Central Bank, first as a Ph.D. trainee in the monetary policy directorate and then as an economist in the research directorate. I am grateful to the institution and my colleagues from whom I learned how monetary policy can be a fascinating topic, often remote from university classes. I would like to mention in particular Matthieu Darracq-Pariès for his contribution in the second chapter of the thesis, his remarkable intellectual curiosity and all our enlightening discussions. I am equally thankful to Nordine Abidi for his genuine friendship and accurate comments on this thesis. I couldn't have written this thesis without the support of my family and friends who I would like to warmly thank. To my parents, Marie and Marc to whom Io w ee v e r y t h i n g . T om yg r a n d p a r e n t sP i e r r e ,F r i d a ,C é c i l ea n dL o u i sw h ow i l l always be the lighthouses of my life. To Anne, Monique, William, Françoise, Philippe, Cathy, Elise and Aria for the backing that only family can bring. To my friends which made Louvain, Paris and Frankfurt feel like home: Abder, Adriana, Andreea, Brahim, Charles, Eric, Iana, Jolan, Karine, Laurent, Lea, Lisa, Louay, Luc, Marie-Pier, Miguel, Nathalie, Oana, Olivier, Pierre, Quentin B., Quentin W., Romain, Rosa, Sandra, Sarah, Satyajit, Valeria, Yves-Emmanuel and Zuzanna. Last but certainly not least, I thank Éléonore, my love and life-accomplice, for her unfaltering support and everything else that she brings to my life.

Introduction: Risk as an Endogenous Variable

The financial crisis of 2008-2009 was a defining event for the academic field of economics. Its macroeconomic consequences, of the magnitude of the Great Depression, led to considerable social sorrow and political polarization across the world.

From the viewp oint of economists, the depth of the crisis came largely as a surprise as existing paradigms were mostly not capable of explaining its mechanisms. This led the profession to call into question existing approaches to macroeconomic models. Particular attention has been devoted in years that followed to understand better the interaction between financial markets, macroeconomic risks, and macroeconomic variables. In the rediscovered words of Hyman Minsky:

Unless we understand what it is that leads to economic and financial instability, we cannot prescribe -make policy -to modify or eliminate it. Identifying a phenomenon is not enough; we need a theory that makes instability a normal result in our economy and gives us handles to control it. [Hyman Minsky (2008, p111)]

The prime principle of this approach is to consider risk itself as an endogenous variable that is determined in the model by the actions of economic agents and the frictions they face. How much risk are agents willing to take on depends on perceived stability and may lead to the build-up of future instability down the road. Moreover, the relationship between endogenous risk and asset prices may feature strong non-linearities through its interaction with the financial sector. For instance, in the model of Brunnermeier and Sannikov (2014), when banks are wellcapitalized, they play their role in absorbing shocks to the fundamental value of assets. Yet, after reaching some thresholds banks cannot absorb further shocks and asset prices have to drop sharply in equilibrium. This drop is then reflected as higher endogenous volatility and leads to a strong amplification mechanism. This thesis follows a similar direction by adopting the methodology of quantitative finance to study macroeconomic questions that are related to the dynamics, the distribution and the price of macroeconomic risk.

In the second chapter, we focus on the effect of funding liquidity risks on asset prices. A central and singular amplification factor in the financial crisis of 2008 was the sharp increase in the tensions in money markets-where highly liquidity short-term financial instruments are traded-that resulted in high uncertainty in the ability of financial institutions to manage a sudden outflow of funding. During the crisis, frictions in money markets were very high due to the combination of high counterparty risk and high uncertainty on the value of a large set of securities traditionally used as collateral in these markets. This had particularly striking consequences for the shadow banking sector that did not have access to the traditional liquidity operations of central banks and this high degree of funding liquidity risk bore by the financial sector was associated with large risk premia in credit markets. In an attempt to ease these tensions, central banks over the world reacted by both injecting large amounts of reserves in the banking sector and directly purchasing long-maturity assets. Despite its importance in many of the narratives of the crisis, the surge in frictions in money markets and the corresponding increase in funding liquidity risk for financial institutions still remains largely absent from macro-financial models leaving questions open. How does increasing uncertainty in money markets affect asset prices and credit spreads? How can monetary policy counter this funding liquidity risk in the financial sector?

To answer these questions, we prop ose in the second chapter a macro-financial model with financial intermediaries subject to funding shocks, money markets requiring collateral posting and a central bank with the ability to issue reserves. We find that increasing disruptions in money markets can play a large role in amplifying a small increase in non-performing loans into a large surge in risk premia and decrease in credit through the pricing kernel of financial intermediaries taking into account their exposure to funding liquidity risk. The model also provides a theory linking injections of reserves and direct purchase of illiquid securities from the central bank to a reduction in downward pressures to asset prices through a decrease of the funding liquidity risk that intermediaries have to bear when the functioning of money markets is impaired. Liquidity injection and discount window policies help alleviate stresses in the traditional banking sector but fail to reach to the shadow banking sector. Securities purchases by the central bank decrease the stock of funding risks through a general equilibrium effect and therefore has al a r g e rr e a c hi nt h ee c o n o m y . I ft h es h a d o wb a n k i n gs e c t o ri sl a r g e ,s e c u r i t i e s purchases may, therefore, be necessary to stabilize asset prices. Ultimately, these results are derived from recognizing the key role of central bank money as the ultimate means of settlement for interbank claims.

In the years that followed the burst of the subprime bubble, output growth has been consistently lower than predicted by forecast across most advanced economies. Even in the US where the real GDP growth rate has reverted back to its pre-crisis level, the recovery from the crisis has been much slower than in all previous postwar recessions. This phenomena, referred to as hysteresis,appearstobeassociated with recessions that were triggered by a financial crisis as opposed to other factors. It is, for example, reminiscent of what happened two decades earlier in Japan after the burst of a large asset bubble in 1990. Analyzing a large set of recessions across countries in the 20th century, [START_REF] Blanchard | Inflation and activity: two explorations and their monetary policy implications[END_REF]fi n d st h a tt w ot h i r d so ft h e recessions triggered by the financial crisis were followed by hysteresis.

In the third chapter of this thesis, we provide a potential explanation for this association between slow recoveries and financial crises. Here again, the key idea is to allow for aggregate risk-taking to be endogenous and depend on agents' behavior. At a micro-level, a high-risk taking behavior is often associated with high growth once conditioned on the surviving of the firm. This principle is the core business of venture capital firms willing to invest in a portfolio of risky companies with the perspective that the few surviving would grow fast enough to compensate the losses of the failed ones. The same proposition also applies to R&D investment that usually captures a high return, a high-risk trade-off.

We investigate how such micro-behavior may be aggregated to determine endogenous productivity growth in a macro-finance model and examine the link between financial crisis, endogenous risk and the innovation process. In this framework, the ability of the financial sector to absorb and diversify risk is key in sustaining the diffusion of innovation and productivity growth. This ability can be hindered after the financial crisis for a prolonged period as, in a financial crisis, risk-taking agents (the ones willing and able to take risks) are the ones to that bear the larger impact. For this reason, the overall risk-taking capacity in the economy is decreased and the economy may shift to a slow growth regime where risk premia are high and productivity growth is slow.

This theory is consistent with the observation that access to finance for young innovative firms was strongly cut-down following the crisis. In the years following the crisis, these companies faced difficulties in accessing financing due to their inherent riskiness and lack of tangible collateral. Banks and venture capital appear to have become more risk-averse and are reluctant to stream loans to start-ups and firms (OECD, 2015). These concerns are directly linked to productivity growth as several empirical studies at the firm-level have documented the central role of young firms in creating jobs [START_REF] Bartelsman | Measuring and analyzing cross-country differences in firm dynamics[END_REF](Bartelsman et al., , 2013;;[START_REF] Foster | Reallocation in the Great Recession: Cleansing or not? Working Papers 13-42[END_REF]).

In the model, two channels are linking financial crises to the slowdown in productivity growth. First, a rise in endogenous volatility can push agents to take less fundamental risk and lead to lower productivity growth. Second, financial crises redistribute wealth from financial intermediaries-which are less risk-averse and better project screeners-to risk-averse households with inadequate financial expertise. Therefore, the risk-aversion of the average investor increases and lowers the aggregate risk taken in technology diffusion.

In the first two parts of this thesis, we benefit largely from formulating our models in continuous time. First, when a Brownian information structure is assumed, continuous time allows using Ito's lemma to describe risk in the economy as a tractable variable (i.e. the Brownian loading of a return process). Second, being interested in risk dynamics requires the use of a global solution method when solving the model as risk is by nature a second-order object. A second-order approximation around the steady-state is often not a satisfying option as this would mechanically shut down all possible amplification appearing through this risk dynamics. In the fourth chapter, we propose a method to solve for the global solution of a heterogeneous agent asset pricing model efficiently.

At their core, a macro-financial model consists of a system of Elliptic Partial-Differential Equations coupled with algebraic constraints. These equations are known to feature some numerical instability that makes them difficult to solve. We follow the traditional approach in the physics literature of approximating the derivatives on a finite grid in a way that preserves the monotonicity of the equation that we want to solve. With two correlated state variables as in many macro-financial models, the problem is significantly more complex because the right direction can be within the state-space but not necessarily on the discrete grid. In this case, we use the method developed by Bonnans et al. (2004)t ou s ea degree of freedom available in the interpolation problem to create a rotation in the state-space in reduced computation time. Finally, we must also deal with the nonlinearities arising from the regulated part of the HJB equation. We follow [START_REF] Candler | Finite-Difference Methods for Continuous-Time Dynamic Programming in Computational Methods for the Study of Dynamic Economies[END_REF]andtre attheproble masifitw e reline arandtore le asethenon-linearpart at each iteration. We then solve the system in the time dimension using a fully implicit Euler algorithm until convergence. This method allows us to solve a wide range of existing models in record time and with a meager failure rate in clear improvement over commonly used techniques.

Unconventional Monetary Policy and Funding Liquidity Risk

Abstract: This article investigates the efficiency of different monetary policies to stabilize asset prices in a liquidity crisis. We propose a macro-finance model featuring heterogeneous banks subject to funding risk. When banks are well capitalized, they have access to money markets and efficiently mitigate funding shocks. When bank capital is low, an endogenous haircut spiral between declining asset prices and funding risks arises. The central bank can partially counter these dynamics with monetary policies. Liquidity injection and discount window policies help alleviate stresses in the traditional banking sector but fail to reach to the shadow banking sector. Large-scale asset purchases (LSAP) decrease the stock of funding risks through a general equilibrium effect and therefore have a larger reach in the economy. If the shadow banking sector is large, LSAP may be necessary to stabilize asset prices.

Introduction

Financial institutions holding illiquid assets rely on the existence of liquid money markets-in which short-term financial instruments are traded-to mitigate the impact of funding shocks. When these markets are impaired, banks face the risk of having to meet a sudden outflow of funds by selling some of the illiquid assets at a discounted price. In most macro-financial models, this fire-sale price comes as the consequence of assets being sold to economic agents with a lesser ability to manage these assets (see Shleifer and Vishny, 1992). In this case, aggregate cash flows are directly impacted as the productivity of underlying assets deteriorates. Under alternative theories1 ,t h ed i s c o u n t e dp r i c ei ss e e na sat e m p o r a r y deviation from its fundamental value such that a fire-sale is rather characterized by an idiosyncratic transfer of wealth from the seller to the buyer. In practice, this fire-sale risk is not insured by financial institutions such that increasing frictions in money markets may result in financial losses for individual institutions (Brunnermeier and Pedersen, 2005). In this chapter, we investigate the consequences of this idiosyncratic component of the risk of lacking funding and having to fire-sale assets-in short, funding liquidity risk -for asset prices and monetary policy.

To do so, we build an asset pricing model in which heterogeneous financial intermediaries facing funding shocks that lead to fire-sales whenever they cannot borrow in money markets. First, we find that an increase in idiosyncratic funding liquidity risk leads to a sharp decline in asset prices as financial intermediaries take into account the liquidity mismatch of their balance sheets when discounting assets. We then investigate how various monetary p olicies can reverse this dynamics and stabilize asset prices.

Taking into consideration the idiosyncratic component of fire-sales turns out to have important consequences for understanding the efficiency of large scale asset purchases (LSAP) by a central bank. In our model, by buying long-term assets, the central bank extracts funding liquidity risk from the economy. This funding liquidity risk channel of unconventional monetary policy differs from the existing literature for two reasons. First, contrary to other asset pricing models in which LSAP has an effect, this channel does not work through a redistribution of wealth to the banking sector-its back-door recapitalization-as in Brunnermeier and Sannikov (2014) (2015). Due to its idiosyncratic nature, the asset purchase can directly affect the quantity of risk that financial intermediaries have to bear in equilibrium without having to transfer it to other agents. This is an important theoretical argument as central banks are usually averse to generate redistribution which they see as not part of their mandates. Second, we show that purchasing illiquid assets have a similar effect as traditional liquidity injections in reducing funding risks but with aw i d e rr e a c h . I np a r t i c u l a r ,w h e nc o n v e n t i o n a ll e n d e ro fl a s tr e s o r tp o l i c i e sd o not reach to the shadow banking sector, the central bank can still boost asset prices by purchasing illiquid securities. The key for this result to hold is the general equilibrium nature of the mechanism. This provides a formalization of the argument that the crisis has pushed central banks to take responsibility as a liquidity back-up for the shadow banking sector that developed outside its reach, with potential benefits for financial stability [START_REF] Mehrling | The New Lombard Street -How the Fed Became the Dealer of Last Resort[END_REF].

Our intermediary asset pricing model is set up in continuous time in the vein of He and Krishnamurthy (2013a)a n dBrunnermeier and Sannikov (2014)w i t h two additional features and three explicitly distinct monetary policies. Our first addition is to assume that financial intermediaries are subject to funding shocks and have to solve a liquidity management problem in the spirit of [START_REF] Bianchi | liquidity management and monetary policy[END_REF]Bigio (2014)andSchneider and[START_REF] Schneider | Payments, credit and asset prices[END_REF]. The effects of these funding shocks vary as the economy can enter into a liquidity crisis regime in which money markets are impaired and asset prices drop. Our second addition is to introduce shadow banks that only differ from traditional banks by not having access to public sources of liquidity. 2The model provides a tractable environment in which the central bank can counteract adverse dynamics by reducing funding liquidity risks in three different ways. First, by increasing the supply of excess reserves to banks (liquidity injection policy), the central bank creates an ex-ante buffer in banks' balance sheets to absorb funding shocks. Second, by providing access to emergency liquidity facilities (lender of last resort policy), the central bank provides an ex-post relief of the impact of funding shocks. Third, by buying and holding risky long-term securities (asset purchase policy3 ), the central bank removes funding risk from the market. For these three p olicies, the critical assumption that emp owers the central bank is its ability to create reserves that is the ultimate means of settlement in the economy.

The first contribution of this article is to provide a tractable model linking funding risks-on the liability side of the balance sheet of financial institutions-to asset prices through the balance sheet of financial intermediaries. In our model, intermediaries engage in liquidity transformation by holding assets that are less liquidity than their liabilities. After a realization of a negative funding shock, an intermediary has to cover a funding gap-the difference between illiquid assets and after-shock funding-by either acquiring funding in money markets (at a negligible cost) or to sell securities at a fire-sale price (at a high cost). Due to information asymmetry, money market lenders require their counterparty to post a sufficient amount of securities as collateral to secure the trade. This assumption endogenously creates two regimes in the economy. In normal times, banks can use money markets efficiently to avoid a costly fire-sale of assets. Funding liquidity risk is therefore low and does not show up in the aggregate pricing kernel. In a crisis, volatility may force margins to become so high that overall available collateral falls short of the requirements to access money markets (a mechanism akin to the haircut spiral in [START_REF] Brunnermeier | Market liquidity and funding liquidity[END_REF]. Because financial intermediaries take into account their funding structure when pricing securities, an increase in this funding liquidity risk affects asset prices negatively.

We use the mo del to investigate the efficiency of different monetary p olicies in various liquidity regimes (with and without well-functioning money markets) and under different financial structures (size of the shadow banking sector). As in the monetary policy implementation literature (Poole, 1968;[START_REF] Frost | Banks' demand for excess reserves[END_REF], we assume that central bank reserves are used for interbank settlement. By holding reserves, banks can reduce their exposure to funding risk. We show how this non-pecuniary benefit of holding reserves break [START_REF] Wallace | A modigliani-miller theorem for open-market operations[END_REF]n e u t r a l i t ys u c ht h a tm o n e t a r y policies affect asset prices and macro variables by reducing the aggregate level of funding liquidity risk. This result applies to liquidity injections, lender of last resort policy and asset purchase policy. Both injecting reserves and lowering the cost of the discount window helps to alleviate the liquidity risk in the traditional banking sector but fail to reach to the shadow banking sector. In contrast, as the central bank buys and holds illiquid assets, it destroys stocks of funding risks from the economy as a consequence of the central bank not facing liquidity risk due to its ability to issue reserves. This latter form of policy has the advantage of operating through a general equilibrium channel with a broader reach.

Our analysis concludes that, in the presence of a sizeable shadow banking sector and impaired money markets, liquidity injection and lender of last resort policies may not be sufficient to alleviate funding stresses. Stabilizing asset prices requires extending lending facilities to shadow banking institutions and engaging in asset purchases policy.

Literature Review This work belongs to the macro-finance literature with a financial sector. Our model builds on the work of Brunnermeier and Sannikov (2014), He and Krishnamurthy (2013a)a n ds h a r e sw i t ht h e s ea r t i c l e sa ni n c o mplete financial markets structure such that the stochastic discount factor of financial intermediaries is pricing the risky assets. As in [START_REF] Brunnermeier | The i-theory of money[END_REF], our model features both inside and outside money that adapts endogenously to the demand of heterogeneous agents. The main distinction between the two articles appears in the function given to money. In their work, it is held by agents as a second-best instrument to share aggregate risk. In ours, the value of money is derived from its role as the ultimate means of settlement between banks. The model in Drechsler, Savov, and Schnabl (2017)a l s of e a t u r e sf u n d i n g liquidity shocks affecting risk premia and asset prices through the balance sheet of intermediaries. In their model, banks always fully insured against funding risks by holding enough reserves, and monetary policy affects asset prices by varying the cost of this insurance through changes in the inflation rate. We diverge by looking at the direct effect of funding risk on risk premia and asset prices in a model where full insurance is not always feasible due to the existence of shadow banks. As in [START_REF] Silva | The risk channel of unconventional monetary policy[END_REF], we model asset purchases policy as affecting asset prices by changing the stochastic discount factor of some agents in the economy. In our model, this happens through a change in funding risk of banks instead of being the consequence of the redistribution of risks to agents without access to financial markets.

In the banking literature, Holmstrom and Tirole (1998)andDiamond and Rajan (2001, 2005) characterize optimal liquidity provision when interbank markets are affected by liquidity shocks. By focusing on money markets and having central bank reserves as an interbank settlement asset, our work also relates to Heider, Hoerova, and Holthausen (2015)a n dAllen, Carletti, and Gale (2009)t h a ts h o w that money markets can cease to operate when credit risk is too high. [START_REF] Afonso | The over-the-counter theory of the fed funds market: A primer[END_REF]a n dBech and Monnet ( 2016)d e v e l o po v e r -t h e -c o u n t e rm o d e l so f the interbank market with random matching to understand its trading dynamics. Close to this article, Bianchi and Bigio (2014), [START_REF] Schneider | Payments, credit and asset prices[END_REF], and [START_REF] Fiore | Money markets, collateral and monetary policy[END_REF]i n c l u d ei n t e r b a n km a r k e t si nm a c r o e c o n o m i c models and study the effect of liquidity injection and lender of last resort. We extend their work by introducing a shadow banking sector, central bank asset purchases, and focusing on asset prices stability with a full-fledged consumption asset pricing model. Our paper is also linked to the literature on shadow banking: [START_REF] Huang | Banking and shadow banking[END_REF], [START_REF] Ordoñez | Sustainable shadow banking[END_REF]a n dPlantin (2015)s t u d yt h ee m e r g e n c eo ft h e phenomena as a consequence of regulatory arbitrage while [START_REF] Gennaioli | A model of shadow banking[END_REF]a n dLuck and Schempp (2014) investigate the consequences for creditors of shadow banks that default. Our model is also close to Moreira and Savov (2017)a sw es h a r et h ev i e wt h a tfi n a n c i a lf r a g i l i t ym a ya r i s ef r o m tightening in the collateral constraint of the shadow banking sector. We differ by characterizing shadow banks as not having access to the balance sheet of the central bank and considering different monetary policy tools through the special role of reserves as a settlement asset.

Finally, our paper relates to the macroeconomic literature that incorporates financial frictions in Neo-Keynesian models and creates a role for unconventional monetary policy as a substitute for impaired lending [START_REF] Cúrdia | Credit spreads and monetary policy[END_REF][START_REF] Gertler | A model of unconventional monetary policy[END_REF]. In particular, [START_REF] Cúrdia | The central-bank balance sheet as an instrument of monetary policy[END_REF]alsoinclude both central bank reserves and direct lending to non-financial companies. We depart from this literature in three ways. First, we focus on the financial stability effect of monetary policy rather than price stability. Second, in our framework, monetary policy operates by reducing liquidity risk in a context where money markets are not-functioning rather than by substituting private credit with public credit when a constraint becomes binding. Third, we discriminate between the different policies and investigate how they perform with various sizes of the shadow banking sector.

Model

The model is an infinite-horizon stochastic production economy with heterogeneous agents and financial frictions. Let (Ω, F, P)b eap r o b a b i l i t ys p a c et h a t satisfies the usual conditions. Time is continuous with t 2 [0, 1). The model is populated by a continuum of households, regular bankers, and shadow bankers and one central bank. Figure 2.1 provides a sketch of the balance sheet of these agents in equilibrium. The banking sector (shadow and regular) funds risky longterm securities holding partly through issuing instantaneous risk-free deposits to households, partly with its net-worth. The central bank operates monetary policies through its balance sheet by holding securities, lending to banks, and issuing reserves.

Environment

Demographics Following Drechsler, Savov, and Schnabl (2017), we assume a continuous-time overlapping generation structure à la Gârleanu and Panageas (2015)i nw h i c ha l la g e n t sd i ea tr a t eκ to avoid that the economy converges to a balanced growth path in which financial intermediaries own all the wealth. New agents are born at a rate κ with a fraction η ss as regular bankers, a fraction η ss as shadow bankers, and 1 -η ss -η ss as households. The wealth of all deceased agents is endowed to newly born agents equally. We denote variables specific to shadow banks with an overline and to the central bank with an underline.

Preferences All agents have [START_REF] Epstein | Substitution, risk aversion, and the temporal behavior of consumption and asset returns: A theoretical framework[END_REF]p r e f e r e n c e sw i t ht h es a m e parameter of risk aversion γ,i n t e r t e m p o r a le l a s t i c i t yo fs u b s t i t u t i o nζ and time preference ρ which implicitly takes into account the probability of death κ:

V t = E t Z 1 t f t du
where f (c t ,V t ) is a normalized aggregator of consumption and continuation value in each period defined as:

f t = ✓ 1 -γ 1 -1/ζ ◆ V t " ✓ c t [(1 -γ)V t ] 1/(1-γ) ◆ 1-1/⇣ -ρ # .
We use this formulation in order to separate risk aversion from intertemporal elasticity of substitution. When γ =1 /ζ,t h ef e l i c i t yf u n c t i o nc o n v e r g e st ot h e constant relative risk aversion utility function.

Technology There is a positive supply of productive capital K t in the economy yielding a constant flow of output return Y t = aK t . All units of capital are pooled into an economy-wide diversified asset-backed security vehicle with total value S t . We write the law of motion of the sto ck of securities as:

ds t =(Φ(ι t ) -δ) s t dt + σs t dZ t .
Where ι t is the investment per unit of capital made by the vehicle on the behalf of the securities holders, δ is the depreciation rate and σs t dZ t is a geometric capital quality shock where dZ t is an adapted standard Brownian. 4 The investment technology Φ (•)t r a n s f o r m sι t s t units of output into Φ (ι t ) s t units of new securitized capital. As standard in the literature, we assume this function satisfies Φ(0) = 0, Φ 0 (0) = 1, Φ 0 (•) > 0, and Φ 00 (•) < 0.

Returns As the economy only features one aggregate stochastic process dZ t ,w e postulate that the stochastic law of motion of the price of a unit of securities q t follows:

dq t q t = µ q t dt + σ q t dZ t ,
where µ q t and σ q t are to be determined endogenously through equilibrium conditions. We use Ito's lemma to write the flow of return on securities holdings as:

dr s t = ✓ a -ι t q t +Φ(ι t ) -δ + µ q t + σσ q t | {z } µ s t ◆ dt + σ + σ q t | {z } σ s t dZ t
The drift of this process, µ s t , is composed of the dividend price ratio of holding au n i to fs e c u r i t i z e dc a p i t a la f t e ri n v e s t m e n tp l u st h ec a p i t a lg a i n s . T h i sf o r m ulation assumes, without loss of generality, that the product of new investments is distributed proportionally to securities holdings. The loading factor σ s t consists in the sum of the exogenous (fundamental shock) and endogenous volatilities (corresponding response in asset prices).

Liquidity Management

The two types of banks are subject to idiosyncratic funding shocks. Upon the arrival of a shock, a quantity σ d t d t of deposits in a given bank is reshuffled to another bank. This creates a funding gap for one (the deficit bank) and a funding surplus for the other (the surplus bank). As in Drechsler, Savov, and Schnabl (2017), this sequence takes place in a short period of time interval ∆ d in which loans are illiquid and can only be traded at a discount fire-sale price as compared to their fundamental value. 5Having to fire-sale securities is costly for deficit banks. To avoid having to do so, they have the possibility to use the securities on their book as collateral to borrow from surplus banks in money markets. This process is subject to some frictions and haircuts are applied to collateral such that the amount borrowable may fall short of the funding need. In this case, shadow banks will still have to fire-sale the remaining part.

Regular banks, however, have two more options to mitigate this risk. First, they can hold central bank reserves, the ultimate interbank settlement asset, as a buffer against liquidity shocks. When the funding shock hits, reserves are immediately transferred from the deficit bank to the surplus one. Therefore, the size of the funding gap is reduced proportionally to reserves holdings. Second, they have access to the discount window facility at the central bank which makes it less costly for regular banks when they cannot access money markets. We show in Appendix 4.6 that such a problem can be written in continuous-time with the following overall transfer of wealth from a deficit to a surplus bank as: shadow banks:

dN t =(1-α t )λσ d d t d e Z t ,
regular banks:

dN t =(1-α t )λ t max σ d d t -m t , 0 d e Z t .
The variable α t is the part of the funding gap for which the deficit bank is able to cover by acquiring new fund on money markets. On this amount, the deficit bank pays a small amount ε to the surplus bank corresponding to the cost of substituting deposit funding for money market funding for the short period time ∆ d . This amount is quantitatively negligible and we simplify the model by assuming that ε∆ d ⇡ 0. In order to settle the remaining amount 1 -α t ,b a n k sh a v et o acquire means of payment at a higher cost by fire-selling some of their securities or accessing the discount window. This is captured by λ t for regular banks and λ for shadow banks. The fact that only banks have access to the discount window yields that the cost of not accessing the money market is never lower for shadow banks as compared to regular banks λ ≥ λ t ≥ 0. Because everything lost by the deficit bank is gained by the surplus one, the funding risk is idiosyncratic. This idiosyncratic liquidity shock is represented by the Brownian motion d e Z t . 6 We assume that these transfers of wealth are instantaneous instead of lasting from t to t +∆ d such that we do not have to keep track of the distribution of idiosyncratic shocks.

Central Bank Private agents in the economy own the central bank. To facilitate the exposition, we assume that it operates with zero net worth and instantaneously redistributes any positive (negative) realized return through a positive (negative) transfer to private agents. 7 For this reason, we scale the decision variables of the central bank by the size of the economy q t S t and write the balance sheet identity of the central bank as:

⌫ t + b t = m t .
In this expression, m t = M t /N t is the supply of reserves, ⌫ t = q t s t /N t the share of securities held by the central bank and, b t = B t /N t is quantity of loans from the central bank to banks. Each of these variables is scaled by the total wealth in the economy, N t = q t S t .C o n s i d e r i n gt h i si d e n t i t y ,t h ec e n t r a lb a n kc a nc o n t r o lt w o out of these three variables. For instance, the central bank could control both the size and the composition of its balance sheet. Moreover, the central bank also sets the cost of not accessing the money market for the regular banks λ t as discussed previously. We therefore define the set of monetary policy decision as {m t , ⌫ t ,λ t }.

The distinctive role of the central bank in our economy is its capacity to issue reserves that are considered as the ultimate means of settlement in the economy. This assumption translates in our model in three ways that correspond to our three policies. First, as discussed earlier, banks can hold reserves to hedge funding shocks. Second, this is what allows the central bank to lower λ t in crisis: it can always grant a loan to banks after a negative shock which allows it to settle without fire-sales. Third, the central bank does not face idiosyncratic liquidity risk. This latter feature will play an important role when in for asset purchases policy.

Last, we assume that the central bank may be less efficient than the private financial sector in managing securities holding and does so at a real cost of Γ(⌫) that is a convex function of actual securities holdings. As in [START_REF] Cúrdia | Credit spreads and monetary policy[END_REF], this assumption allows us to characterize a trade-off according to which it is not trivially always optimal for the central bank to hold all the assets in the economy. It is meant to capture all potential reasons why private markets may be more efficient in managing financial assets as compared to a public bank.

Agent's problems

Regular Banks Regular bankers face a Merton's (1969)portfolioc hoiceproblem augmented with the liquidity management component. Bankers maximize their life-time expected recursive utility:

max {w s ⌧ ,w b ⌧ ,w m ⌧ ,w d ⌧ ,c⌧ } ∞ ⌧ =t E t Z 1 t e -⇢⌧ f (c ⌧ ,V ⌧ )d⌧ , (2.1)
subject to the law of motion of wealth:

dn t = w s t µ s t + w b t r b t + w m t r m t -w d t r d t -c t + µ ⌧ t n t dt +(w s t σ s t + σ ⌧ t )n t dZ t +(1-↵ t )λ t max σ d w d t -w m t , 0 d e Z t , (2.2)
and the balance sheet constraint:

w s t + w b t + w m t =1+w d t .
Regular bankers face a portfolio choice problem with four different assets: securities portfolio weight w s t , interbank lending with portfolio weight w b t ,c e n t r a lb a n k reserves portfolio weight w m t ,a n dd e p o s i t sp o r t f o l i ow e i g h tw d t .I ne q u a t i o n( 2.2), r b t is the interest rate on interbank lending, r m t the interest rate paid by the central bank on its reserves, and r d t the interest rate on deposits. Banks also choose their consumption rate c t .B a n k e r sr e c e i v eafl o wo ft r a n s f e r sp e ru n i to fw e a l t ho f d⌧ t = µ ⌧ t dt + σ ⌧ t dZ t from the central bank. The last term of equation (2.2)r e fl e c t s the effect of the liquidity management problem of the regular banks on the flow of returns as described previously.

Shadow Banks Shadow bankers face a similar problem as banks except for the difference in their access to the central bank balance sheet:

max {w s ⌧ ,w b ⌧ ,w d ⌧ ,c⌧ } ∞ ⌧ =t E t Z 1 t e -⇢⌧ f (c ⌧ , V ⌧ )d⌧ , (2.3)
subject to the law of motion of wealth:

dn t = w s t µ s t + w b t r b t -w d t r d t -c t + µ ⌧ t n t dt +(w s t σ s t + σ ⌧ t )n t dZ t +(1-↵ t )λσ d w d t nd e Z t ,
and the balance sheet constraint:

w s t + w b t =1+w d t .
The interpretation of the variables, now overlined to denote shadow bankers, is the same as for regular bankers.

Households Households maximize their life-time utility function subject to the additional assumption that they can only invest in bank deposits: (2.4) subject to the law of motion of wealth:

max {c h ⌧ } ∞ ⌧ =t E t Z 1 t e -⇢⌧ f (c h ⌧ ,V h ⌧ )d⌧ ,
dn h t = r d t -c h t n h t dt,
where the h index refers to households.

Equilibrium Definition

Definition (2.4).

2. Markets for securities, interbank lending, reserves, and consumption goods clear:

(a) securities:

Z I w s t n s t di + Z J w s t n t dj =(1-⌫ t )S t (b) interbank lending: Z I w b t n t di + Z J w b t n t dj = b t q t S t , (c) reserves:
Z I w m t n t di = m t q t S t , (d) output:
Z I c t n t di + Z J c t n t dj + Z H c h t n h t dh =(a -◆ -Γ(⌫))S t .

Discussion of Assumptions

Market Segmentation We view the market segmentation hyp othesis as a parsimonious way of writing down a model where there is some constraint on the risk sharing between the two sectors that is binding when there is a crisis such that the stochastic discount factor of intermediaries is pricing the risky assets in the economy (a feature for which there is strong empirical support; see for instance Adrian, Etula, and Muir, 2014;[START_REF] He | Intermediary asset pricing: New evidence from many asset classes[END_REF]. We refer to Brunnermeier and Sannikov (2016a)a n dHe and Krishnamurthy (2013a) for a micro-foundation of such a constraint originating from agency frictions forcing bankers to keep some skin in the game when holding risky assets and preventing optimal risk sharing. We could allow for the constraint to b e only o ccasionally binding without affecting our main results as we are interested in states where this constraint would be tight anyways.

Shadow Banks As in [START_REF] Pozsar | Shadow banking[END_REF]a n dAdrian and Ashcraft (2012), we see the lack of access to public sources of liquidity as an essential distinction between the shadow and traditional banking sector. In order to be able to focus on this aspect, we model shadow banks as exactly similar to traditional banks in all other accounts. This assumption corresponds to two existing institutional features. First, in most countries, only institutions licensed as banks (in the US, called depository institutions) have an account at the central bank and, hence, can hold reserves. Second, access to lender of last resort facilities (such as the Fed discount window) is usually also restricted to the same set of institutions. In this setting, we interpret a policy that extends the lender of last resort function to a larger set of institutions, such as the creation of the Primary Dealer Credit Facility or Central Bank Swaps8 lines in 2008, as transforming some shadow banks into traditional banks.

Discount Window Policy

We mo del the discount window p olicy by having the central bank affecting the overall cost of being illiquid for banks rather than the discount window rate. The reason behind this modeling choice is that we see the discount window policy as a multiple dimension object. In reality, various variables affect the cost of a liquidity shortage for a traditional bank. For instance, the literature has documented a strong negative stigma in accessing the discount window at the Fed, especially during a financial crisis [START_REF] Armantier | Discount window stigma during the 2007-2008 financial crisis[END_REF]. In an attempt to reduce the stigma of borrowing funds at the discount window, the Fed introduced a new lending facility for banks, the Term Auction Facility (TAF), in 2007. 9 Moreover, discount window loans are, in practice, collateralized. This means that for the policy to be effective, the central bank needs to be less restrictive than markets in the set of eligible collateral. By accepting more or less securities as collateral, the central bank may have significant impact on the funding risks of banks. This channel has been particularly important in Europe when Treasuries of peripheric countries were applied sizable haircuts [START_REF] Bindseil | Central bank collateral, asset fire sales, regulation and liquidity[END_REF]. We capture these different dimensions in which the central bank can affect the availability and cost of discount window policy through the variable λ t .

Transfers Rules Our assumption regarding the transfer rules is set-up in order to shut down any redistribution channel of monetary policy. As we will show later, with this rule, asset purchase policies are Wallace neutral in absence of liquidity risk. We do so for two reasons. First, distributional effects of monetary policy in this class of model have already been studied extensively (Brunnermeier and Sannikov, 2014;He and Krishnamurthy, 2013a;[START_REF] Silva | The risk channel of unconventional monetary policy[END_REF]. Second, this allows us to focus on the liquidity risk channel of monetary policy which is the focus of this article.

Solving

Each agent's optimal decision depends on the functioning of money markets, monetary policy, and equilibrium market prices. The homotheticity of Epstein-Zin preferences generates optimal strategies that are linear in the net worth of a given agent. Therefore, the distribution of net worth within each sector does not affect the equilibrium. We characterize the equilibrium as in Brunnermeier and Sannikov (2014)a n dDi Tella (2017)b yu s i n gar e c u r s i v ef o r m u l a t i o no ft h ep r o b l e m and look for a Markov formulation, taking into account the scale invariance of the model which allows to abstract from the level of aggregate capital stock. We guess and verify that the value function of each agent has the following power form:

V (n t )= (⇠ t n t ) 1-γ 1 -γ , V (n t )= (⇠ t n t ) 1-γ 1 -γ ,V h (n h t )= (⇠ h t n h t ) 1-γ 1 -γ .
for some stochastic processes {⇠ t , ⇠ t ,⇠ h t } capturing time variations in the set of investment opportunities for a given type of agent 10 .Au n i to fn e tw o r t hh a sa higher value for a regular bank, a shadow bank, or a household in states where ⇠ t , ⇠ t or ⇠ h t are respectively high. Without loss of generality, we postulate that the law of motion for these wealth multipliers follows an Ito Process:

d⇠ t ⇠ t = µ ⇠ t dt + σ ⇠ t dZ t , d⇠ t ⇠ t = µ ⇠ t dt + σ ⇠ t dZ t , d⇠ h t ⇠ h t = µ ⇠,h t dt + σ ⇠,h t dZ t .
Recursive Formulation As a consequence of the homotheticity of preferences and linearity of technology, all agents of a same type choose the same set of control variables when stated in proportion of their net worth. Hence, we only have to track the distribution of wealth between types and not within types. The two state variables of the economy are the share of wealth in the hands of the regular and shadow banking sectors:

⌘ t ⌘ n t n t + n t + n h t , ⌘ t ⌘ n t n t + n t + n h t ,
where the total net worth in the economy is given by n t + n t + n h t = q t S t .F r o m here on, we characterize the economy as a recursive Markov equilibrium.

Definition 2 (Markov Equilibrium) A Markov equilibrium in (⌘ t , ⌘ t ) is a set of functions f t = f (⌘ t , ⌘ t ) for (i) prices q t ,r d t ,r m t ,
⌧ t , σ ⌧ t ,µ ⌧ t , µ ⌧ t } such that: 1. Wealth multipliers {⇠ t , ⇠ t ,⇠ h
t } solve their respective Hamilton-Jacobi-Bellman equations with optimal controls (ii), given prices (i), monetary policy and transfer policy (iv).

2. Markets for securities, interbank lending, reserves, and consumption goods clear:

(a) securities:

w s t ⌘ t + w s t ⌘ t + ⌫ t =1 , (b) interbank lending: w b t ⌘ t + w b t ⌘ t = b t , (c) reserves: w m t ⌘ t = m t , (e) output: c t ⌘ t + c t ⌘ t =(a -◆ t -Γ(⌫ t ))/q t .
3. Monetary policy m t ,⌫ t ,λ t are set only as functions of the state variables.

Transfers rules σ

⌧ t , σ ⌧ t ,µ ⌧ t , µ ⌧ t are
given by:

σ ⌧ t = σ ⌧ t = ⌫ t ⌘ t + ⌘ t σ s t , µ ⌧ t ⌘ t = ⌘ ⌘ t + ⌘ t (µ s t -r d t )⌫ t +(r b t -r m t )b t -(r m t -r d t )m t , µ ⌧ t ⌘ t = ⌘ t ⌘ t + ⌘ t (µ s t -r d t )⌫ t .
5. The laws of motion for the state variables (⌘ t , ⌘ t ) are consistent with equilibrium functions.

First Order Conditions

The optimality conditions for the control variable are derived in the appendix by writing the stationary Hamilton-Jacobi-Bellman equations. With a little bit of algebra, we can write these conditions for securities holdings as:

regular banks: µ s t -r b t = γ(w s t σ s t + σ ⌧ t )σ s t -(1 -γ)σ ⇠ t σ s t , (2.5)
shadow banks:

µ s t -r b t = γ(w s t σ s t + σ ⌧ t )σ s -(1 -γ)σ ⇠ t σ s t . (2.6)
The excess return on the risky asset must be equal to minus the covariance between the return process and the stochastic discount factor. More precisely, excess returns compensate for taking exposure in two types of risks. The first term takes into account variations in marginal utility originating purely from the additional wealth volatility. The second term corresponds to the compensation for correlated changes in the set of investment opportunities. So far, these conditions corre-spond to the traditional portfolio problem. We can similarly derive the first order conditions for the portfolio weights on deposit holdings:

regular banks: r b t -r d t = γ(1 -↵ t ) 2 λ 2 t max{σ d w d t -w m t , 0}σ d (2.7) shadow banks: r b t -r d t = γ(1 -↵ t ) 2 λ 2 w d t (σ d ) 2 (2.8)
From the p oint of view of banks, issuing short-term dep osits is risky as it creates an exposure to funding shocks. As deposits are a liability of banks, this additionnal exposure needs to be compensated by a negative premium with respect to the risk-free interbank market rate r b t .F o rb o t ht y p e so fb a n k s ,t h i sn e g a t i v ep r e m i u m is equal to the marginal cost of the corresponding increase in liquidity risk. This effect is increasing in money markets frictions ↵ t and disappears when money markets are working perfectly (↵ t =1 ) . W ec a nd e r i v eas i m i l a rc o n d i t i o nf o r reserves holdings from regular banks:

r b t -r m t = γ(1 -↵ t ) 2 λ 2 t max{σ d w d t -w m t , 0}. (2.9)
This equation looks similar to the one for deposits but has an opposite interpretation. In this case, central bank reserves are an asset from the perspective of banks and holding it reduces the effect of funding shocks on wealth. Therefore reserves also require a negative premium with respect to the risk-free interbank market rate r b t (the marginal cost) that is equal to the marginal reduction in the impact of the funding shock (the marginal benefit). As all agents have the same preferences, their optimal consumption choices are given by:

c t = ⇠ 1-⇣ t (2.10) c t = ⇠ 1-⇣ t (2.11) c h t =(⇠ h t ) 1-⇣ (2.12)
Agents' consumption rates depend on their set of investment opportunities and their intertemporal elasticity of substitution parameter ⇣. When ⇣>1, the substitution dominates the wealth effect and agents react to an improvement of their set of investment opportunities by decreasing consumption. The reverse holds when ⇣<1a n dbo t he ff e c t sc a n c e lo u tw h e n⇣ =1.

Static Results

In this section, we first study how money market frictions affect the economy. In particular, we show that an increase in money market frictions results in a drop in asset prices as higher funding liquidity risk impacts the stochastic discount factor of banks. We then investigate how the different types of monetary policy may affect allocations and prices under various liquidity regimes. We show how the different policies may break [START_REF] Wallace | A modigliani-miller theorem for open-market operations[END_REF] neutrality result in the presence of impaired money markets. We then show that, in the presence of a large shadow banking sector, liquidity injections and better discount window conditions may not be sufficient to alleviate funding risk and asset prices stabilization may require asset purchase policy in order to affect the whole banking sector.

To facilitate the exp osition, we make a technical assumption to shut down the distribution of wealth as state variables as it is inessential for the results. More explicitly, assume that the death rate  !1such that ⌘ t = ⌘ ss ⌘ ⌘ and ⌘ t = ⌘ ss ⌘ ⌘.11 and, consequently, drop the subscript t for all variables. We release this assumption in the next section and show that our results are not impacted.

Benchmark Without Liquidity Risk

Without liquidity risk, i.e. in a world where there are no money market frictions (↵ =1),themodelyieldsthefollo wingsolution: Lemma 3 (Prices without Liquidity Risk) In the absence of money market frictions (↵ =1), equilibrium prices along the balanced growth path are given by:

q = a -◆ ⇢ -(1 -⇣ -1 ) ⇣ Φ(◆) -γ 2 σ 2 ⌘+⌘ ⌘ , r m = r b = r d = ⇢ -⇣ -1 Φ(◆)+(1-⇣ -1 ) γ 2 σ 2 ⌘ + ⌘ .
Proofs are relegated to the Appendix.

This benchmark corresponds to the traditional consumption-based asset pricing equation adjusted for recursive preferences and the wealth share of the aggregate banking sector ⌘ + ⌘. As intermediaries are the only agents that can bear fundamental risk, the precautionary motives take into account that banks are levered and have to bear a risk of γσ 2 /(⌘ + ⌘)perunitofwealth. Therestoftheequations is standard. The price of securities is the discounted value of the flow of future dividends a. When the intertemporal elasticity of substitution is above one, ⇣>1, the substitution effect dominates such that an increase the drift of the capital accumulation process Φ(◆)r e s u l t si nh i g h e rp r i c e sw h i l ea ni n c r e a s ei nu n c e r t a i n t y σ 2 /(⌘ + ⌘)d e c r e a s e sa s s e tp r i c e s . W ef o c u so nt h i sc a s ea si ti ss t a n d a r di nt h e macro-finance literature. For completeness, note that when the converse holds, ⇣<1, the wealth effect dominates such that these relationships go in the opposite direction. The deposit rate also depends on the intertemporal elasticity of substitution. In particular, when the substitution effect dominates, an increase in uncertainty or decrease in the banking sector relative wealth yields a reduction in the rate on deposits.

Proposition 4 (Neutrality of Monetary Policy Instruments without Liquidity

Risk) In the absence of money market frictions (↵ =1 ), any change in the monetary policy decision set {m,⌫,λ} has no effect on any equilibrium variables.

This result is straightforward for both liquidity injection policies (a change in m) and discount window policy (a change in λ)astheonlyequationinwhichthese variables appear is the first-order condition for deposits and reserves of banks and is always scaled by 1 -↵ =0 . I no t h e rw o r d s ,t h eo n l ye ff e c to ft h e s ep o l i c i e s is to lower the liquidity risk of banks. Yet, when money markets functioning perfectly, this liquidity risk is already null such that any liquidity or discount window policy change is inconsequential. The reason behind the neutrality of asset purchases policy is different. Whenever the central bank purchases risky securities, banks keep their exposure to the underlying fundamental risk through the transfer functions. This can be seen by first noting that market clearing conditions and the symmetry between two types of banks absent liquidity risk implies that:

w = ⌘ ⌘ + ⌘ (1 -⌫), w = ⌘ ⌘ + ⌘ (1 -⌫).
After substituting for both portfolio weights and transfer rules, we can rewrite the asset pricing equations for optimal risky securities holdings as:

µ s -r d = γ ✓ ⌘ ⌘ + ⌘ (1 -⌫)σ s + ⌘ ⌘ + ⌘ ⌫σ s ◆ σ s , µ s -r d = γ ✓ ⌘ ⌘ + ⌘ (1 -⌫)σ s + ⌘ ⌘ + ⌘ ⌫σ s ◆ σ s ,
in which central bank holdings of risky securities ⌫ cancels out. As agents understand this exposure they adjust their demand for securities exactly such that the aggregate demand remains unaffected. These results are simply a restatement of the seminal Wallace's ( 1981)n e u t r a l i t yr e s u l ti nt h er i s ks p a c e .

Money Markets Frictions

In this subsection, we focus on equilibrium with money market frictions ↵<1but without monetary policy ⌫ = m = 0 and λ = λ.F o rs i m p l i c i t y ,w ea l s oa s s u m e that σ d =1a n du s et h ed e g r e eo ff r e e d o mt h a tw eh a v ei nλ and ↵ to vary the scale of the funding shock. We first combine the first-order conditions for securities and deposits for the two banks by substituting out the risk-free interbank money market rate r b :

µ s -r b = γw s σ 2 -γ(1 -↵) 2 λ 2 w d .
(2.13) Equation ( 2.13)alreadyshowsthatbankstakeintoaccountthattheyneedtoraise deposits that generates liquidity risk when choosing their demand for securities. Thus, they trade-off an increase in both fundamental and funding liquidity risk for excess returns.

We can now write the closed form solution of the mo del in the case where there is liquidity risk and no monetary policy.

Proposition 5 (Prices with Liquidity Risk and No Central Bank) In an economy without asset purchase ⌫ =0 , without reserves m =0 , and without discount window facility λ = λ, equilibrium securities prices along the balanced growth path are given by:

q = a -◆ ⇢ -(1 -⇣ -1 ) Φ -γ 2 (Ωσ 2 +Ψ) , (2.14)
where

Ω= 1 ⌘ + ⌘ , Ψ=(1-↵) 2 λ 2 (1 -⌘ -⌘) 2 ⌘ + ⌘ .
When the substitution effect dominates, an increase in funding risks in the economy (due to higher money market frictions) leads to a decrease in asset prices. This can be seen in the extra-term Ψ of equation ( 2.14) as compared to the benchmark without liquidity risk. Idiosyncratic funding liquidity risk is part of the asset price as it is undiversifiable and, therefore, part of the pricing kernel of financial intermediaries. The function Ψ is scaling the funding risk to the equilibrium leverage of the financial sector. Note that when banks hold all the wealth in the economy (⌘ + ⌘ =1 ) ,t h e yh a v en ol e v e r a g ea n dΨ=0s u c ht h a tt h e r ei sn of u n d i n gr i s k component in the asset pricing equation. In figure 2.2,w ec o m p a r ee q u i l i b r i u m for different levels of liquidity risk as a function of ⌘ + ⌘.F o rah i g h e rl e v e lo f liquidity risk due to poorer money market conditions, asset prices are lower and the net interest margin is higher.

Monetary Policy Instruments

In this subsection, we decompose the impact and limitations of the different monetary policy instruments. First, we clarify the position of interest on reserves in our framework and why it is not included in the set of monetary policy instruments. Then, we look at liquidity injections, lender of last resort, and asset purchase policies. We show how both liquidity injection and discount window policies are limited as they cannot reach the shadow banking sector while asset purchases gets in all the cracks by reducing funding liquidity risk through a general equilibrium effect.

Interest Paid on Reserves

In setting up our model, we have not incorporated the interest paid on reserves (IOR) in the toolbox of the central bank but rather as an equilibrium outcome. Today, most central banks decide on and frequently adjust their IOR to economic conditions as a monetary policy tool.12 In order to show that the model is consistent with IOR being a monetary policy variable in an o m i n a lw o r l d ,l e t ' sd e fi n et h en o m i n a li n t e r e s to nr e s e r v e si m = r m + ⇡ t where ⇡ t is the inflation rate. 13 We can combine this equation with the asset pricing condition for reserve (2.9)t ofi n d :

⇡ = i m + γ(1 -↵) 2 λ 2 max{σ d w d -m, 0} | {z } nominal money market rate -r b .
Inflation is uniquely determined by this equation as the deviation between the nominal and real interest rates prevailing in money markets. The nominal money market rate is composed of two terms: the nominal interest on reserves and the real money market spread determined by equation (2.9). The central bank can directly affect this spread as it is the sole supplier of reserves. Thus, the central bank can affect inflation with two different policy tools: the nominal interest rate on reserves i m and the supply of reserves m.14 This equation corresponds to the classic Fischer equation and since the model does not feature nominal rigidities, the relationship between inflation and the risk-free rate is positive. As price stability is not the focus of this article, we abstract from these considerations through assumption 6 that provides a sufficient condition for a model where the central bank controls IOR to reduce to the model described in section 2.

Assumption 6 (Separation Principle) The central bank stabilizes inflation to zero by pinning down the nominal interest rate paid on reserves:

i m = r b -γ(1 -↵) 2 λ 2 max{σ d w d -m, 0} such that ⇡ =0.
Assumption 6 has an intuitive interpretation as it reflects the practice in many central banks during the Great Recession, referred to as the separation principle, according to which the degree of freedom in the monetary policy toolbox allows to have the interest on reserves focused on maintaining price stability while the stock of reserves can be adjusted independently to alleviate liquidity stresses in the interbank market (e.g., [START_REF] Clerc | The art of central banking of the ecb and the separation principle[END_REF].

Liquidity Injections As regular banks hold reserves in order to hedge against funding liquidity shocks, an increase in the supply of reserves can affect asset prices whenever money markets are functioning imperfectly.

Proposition 7 (Prices with Positive Supply of Reserves) In an economy without asset purchase ⌫ =0and without a discount window facility λ = λ, equilibrium securities prices along the balanced growth path are given by:

q = a -◆ ⇢ -(1 -⇣ -1 ) Φ -γ 2 (Ω(m)σ 2 +Ψ(m)) (2.15)
where

Ω(m)=  1+ m 2 (1 -↵) 2 λ 2 σ 2 +(1-↵) 2 λ 2 ⌘ ⌘ 1 ⌘ + ⌘ , Ψ(m)= 8 < : (1 -↵) 2 λ 2 (1-⌘-⌘-m) 2 ⌘+⌘ if m  m ? , (1 -↵) 2 λ 2 (1-⌘-⌘-m ? ) 2

⌘+⌘

otherwise,

m ? =(1-⌘ -⌘) σ 2 +(1-↵) 2 λ 2 σ 2 +(1-↵) 2 λ 2 + ⌘ ⌘ σ 2 .
The supply of central bank reserves enters in two ways in the asset pricing equation (2.15). First, through the term Ψ(m), the stock of funding liquidity risk, an increase in money supply m has a positive impact on asset prices until reaching m ? , which corresponds to the reserve satiation threshold of regular banks. As the central bank increases the supply of reserves, banks have to face lower liquidity risk. This positive effect is dampened through the term Ω(m). The intuition is that, as funding liquidity risk becomes lower for regular banks as compared to shadow banks, the former type of bank starts to hold a large share of the existing stock of securities. The distribution of fundamental risk σ 2 becomes asymmetrical and introduces an inefficiency as compared to what is optimal which has a negative impact on securities prices. This dampening effect is proportional to the relative size of the shadow banking sector ⌘/⌘. represents the benchmark economy without liquidity risk. The red line shows how the supply of reserves affects the variables when there are only traditional banks.

In this case, the central bank is able to inject enough liquidity to make sure that regular banks are fully satiated. At this point m ⇤ ,t h e r ei sn om o r el i q u i d i t yr i s k in the economy and asset prices are equal to the benchmark. When the shadow banking sector is large (blue line), traditional banks may be liquidity-satiated while there is still a significant amount of funding liquidity risk in the economy and asset prices are below the benchmark level.

Discount Window By lowering the cost of using the discount window rate (or facilitating its usage), the central bank reduces the cost of being illiquid for banks λ. In doing so, the central bank affects positively equilibrium prices.

Proposition 8 (Prices with Discount Window) In an economy without asset purchase ⌫ =0and without liquidity injections m =0 , equilibrium securities prices along the balanced growth path are given by:

q = a -◆ ⇢ -(1 -⇣ -1 ) Φ -γ 2 (Ω(λ)σ 2 +Ψ(λ)) (2.16)
where

Ω(λ)= σ 2 + 1 2 (✓ 2 + ✓ 2 ) (σ 2 + ✓ 2 )⌘ +(σ 2 + ✓ 2 )⌘ , Ψ(λ)=⌘✓ 2 + ⌘✓ 2 + ✓ 2 ✓ 2 + σ 2 2 (✓ 2 + ✓ 2 ) -(✓ 2 -✓ 2 ) 2 ⌘⌘ -2✓ 2 (σ 2 + ✓ 2 )⌘ -2✓ 2 (σ 2 + ✓ 2 )⌘ (σ 2 + ✓ 2 )⌘ +(σ 2 + ✓ 2 )⌘ , ✓ ⌘ (1 -↵)λ, ✓ ⌘ (1 -↵)λ.
Although these equations are different from the ones for the liquidity injection policy, they have a close interpretation. The term Ψ(λ)a c c o u n t sf o rt h ed i r e c t reduction of funding risks for traditional banks when ✓(λ)i sl o w e r e d . A tt h e extreme, if the central bank does not set a discount window such that λ = λ,t h e n q reverts back to equation (2.14). On the other hand, if the discount window such that there is no more liquidity risk for traditional banks λ =0,thenΨ(0)reduces to:

Ψ(0) = ✓ 2 ⌘ + σ 2 2 -✓ 2 ⌘⌘ -2σ 2 ⌘ σ 2 ⌘ +(σ 2 + ✓ 2 )⌘ ! ≥ ✓ 2 (1 -⌘ -⌘) 2 ⌘ + ⌘ .
(2.17)

As can be seen from equation (2.17), shutting down the liquidity risk in the traditional banking sector through better lender of last resort conditions may not be sufficient to push asset prices back to the benchmark level without liquidity risk. The variable Ω(λ), here again, takes into account the skewness in the holdings of fundamental risk between traditional and shadow banks that is introduced by the liquidity risk advantage that the central bank is providing to banks. When liquidity risk is symmetric (i.e. absent discount window policy λ = λ), the dampening effect Ω converges to its value in the benchmark case 1/(⌘ + ⌘).

Asset Purchases

The last type of policy we consider is the direct purchase of securities by the central bank. In an economy where money markets function imperfectly (↵<1), asset purchases have a positive impact on asset prices.

Proposition 9 (Prices with Central Bank Securities Holdings) In an economy without a discount window facility λ = λ, equilibrium securities prices along the balanced growth path are given by:

q = a -◆ -Γ(⌫) ⇢ -(1 -⇣ -1 ) Φ -γ 2 (Ωσ 2 +Ψ(⌫)) , (2.18)
where

Ω= 1 ⌘ + ⌘ , Ψ(⌫)= 8 < : (1 -↵) 2 λ 2 (1-⌘-⌘-⌫) 2 ⌘+⌘ , if ⌫  1 -⌘ -⌘ 0, otherwise.
Central bank securities holdings affect the economy in two opposite ways through two different terms in equation (2.18). First, a purchase of securities has positive effect through Ψ(⌫). When the central bank buys securities, it removes a stock of idiosyncratic funding liquidity risk from banks' balance sheets. Because the central bank does not face funding liquidity risk, these risks are extracted from the economy and, unlike fundamental risk, are not passed on to banks through future transfers. This results, in general equilibrium, in a lower stock of funding liquidity risk (see equation ( 9)). The scaling factor of liquidity risk Ψ(⌫)i sa negative function of ⌫ up to the point where the central bank has bought all securities. Importantly, these securities previously funded by short-term deposits are replaced with reserves on the balance sheets of banks. The asset purchase policy also has a negative impact on asset prices through the real resource convex cost Γ(⌫). The overall impact on securities price is a quantitative question that depends on the balance between these two forces as is illustrated in figure 2.4.

Dynamic Results

In this section, we endogenize the frictions in the money market by modeling explicitly the haircut necessary to secure trades given the volatility of assets. Then we show that the resulting collateral spiral strongly amplifies the drop in asset prices subsequent to a series of negative shocks. Finally, we investigate, in the fully dynamic setting, how the different monetary policies may partially counteract the collateral spiral.

Numerical Procedure and Parametrization

We solve numerically for the global solution of the model, that is, the mapping from the pair of state variables {⌘ t , ⌘ t } to all equilibrium variables. The numerical procedure follows the finite-difference methodology introduced in Brunnermeier and Sannikov (2016a)a n de x t e n d e df o rt w os t a t ev a r i a b l e si nt h el a s tc h a p t e ro f this thesis. The procedure decomposes the approximation scheme in two separate parts. We solve for the wealth multiplier

⇠(⌘ t , ⌘ t ), ⇠(⌘ t , ⌘ t )a n d⇠ h (⌘ t , ⌘ t )b a c k -
ward in time by using an implicit Euler method. We evaluate the finite difference approximation of the derivative terms in the right direction to preserve the numerical stability of the scheme following [START_REF] Barles | Convergence of Approximation Schemes for Fully Nonlinear Second Order Equations[END_REF]. In between these time steps, we solve for the system of equations using the Newton-Raphson method.

Endogenous Collateral Constraint

Until this point, we have treated the proportion of available collateral ↵ as a parameter. In reality, this variable varies through time as haircuts have to increase to protect the lender when volatility is high. To capture this link, we write the fraction of the funding gap covered by a loan `t on the collateralized money market ↵ t as:

↵ t =min ⇢ `t σ d d t -m t , 1 .
To b orrow `t on the collateralized money market, we impose a value-at-risk constraint. The annualized probability that the collateral value becomes lower than the value of loan `t has to be at most p. 15 The quantity of collateral χ t required to borrow `t in the interbank market has to satisfy:

P ⇥ χ t exp µ s t -(σ s t ) 2 /2+σ s t (Z t+1 -Z t )  `t⇤ = p. (2.19)
Thus, if a fraction  χ of the securities held by the bank can be used as collateral, the quantity of available collateral is given by

χ t =  χ q t s t .
(2.20)

Combining (2.19)a n d( 2.20), the maximum amount that can be borrowed on the collateralized money market is given by:

`t =  t q t s t , where  t =  χ exp Φ -1 (p) σ s t + µ s t -(σ s t ) 2 /2 .
15 The value-at-risk constraint is evaluated assuming that the drift µ s t and volatility σ s t are constant. That is, bankers approximate

P  χ t exp ✓Z t+1 t (µ s u -(σ s u ) 2 /2)du + Z t+1 t σ s u dZ u ◆  `t = p
with equation (2.19). Also, for parsimony, we do not keep track of the distribution of collateral amongst banks. The figure shows the amplification mechanism when ↵ t is fixed to 1 (blue line) and ↵ t is endogenous (red line). The three panels display the model solution for the price of securities q t , the endogenous volatility σ q t and the index of money market functioning ↵ t as a function of the total share of wealth in hands of regular and shadow banks eta t + ⌘ t along the diagonal line ⌘ t = ⌘ t .

where

q ⌘ = @q(⌘ t , ⌘ t ) @⌘ t ,q ⌘ = @q(⌘ t , ⌘ t ) @⌘ t .
As in Brunnermeier and Sannikov (2014), an amplification spiral arises because of a feedback loop between lower wealth of financial intermediaries and higher endogenous volatility (see Figure 2.5). This can be seen from the denominator of this equation that corresponds to the sum of two geometric series. The size of this amplification factor depends on the derivatives of the securities' price function with respect to the two state variables.

Figure 2.6 displays the solution of the model as a function of the total share of wealth in hands of regular and shadow banks ⌘ t + ⌘ t along the diagonal line ⌘ t = ⌘ t when ↵ t is endogenously fixed to 1 and when it evolves endogenously according to the constraint (2.19). The drop in asset prices arises at a faster pace with the collateral spiral cycle. The mechanism is triggered when collateral becomes scarce-↵ t drops below one-and generates an increase in endogenous volatility and a drop in asset prices. The figure displays the impulse response function for a 30% drop in the wealth of regular and shadow bankers. More precisely, starting from the stochastic steadystate, we plot the average impulse response functions for q t , σ q t ,a n d↵ t after a shock to securities dZ t that destroys 30% of the stock of securities. The blue line corresponds to a no monetary policy benchmark. The red line corresponds to the shock accompanied by an increase of reserves from m =0t om =0 .5 (liquidity injection policy). The yellow line corresponds to the same rise in reserves accompanied by an increase in central bank asset purchases from ⌫ =0to⌫ =0.25 (liquidity injection policy and asset purchase policy).

Monetary Policy in a Dynamic Setting

In this subsection, we investigate, in the fully dynamic setting, how the different monetary policies may partially counteract the collateral spiral. To do so, we present in figure 2.7 the impulse response functions of shock leading to a destruction of 30% of the wealth of the banking sector with and without policy intervention. The blue line shows how the price of securities q t ,t h ee n d o g e n o u s volatility σ q t ,a n dt h ec o l l a t e r a ls c a r c i t y↵ t evolve through time after the initial shock without any monetary policy reaction. The red line shows the same variables when the central bank reacts to the shock by an increase in the supply of the reserves from m =0tom =0.5( l i q u i d i t yi n j e c t i o np o l i c y ) ,e n o u g ht os a t i a t et h e traditional banks. Any further increase in money would, therefore, not change the equilibrium anymore as reserves are Wallace neutral from this point. The yellow line shows how the variables evolve if the central bank decides to complement its liquidity injection policy by an asset purchase policy by increasing its holding of securities from ⌫ =0to⌫ =0.25. The result derived in the static model, that asset purchase policies may have an impact on the economy when liquidity injections do not, also holds in the fully dynamic setting.

Conclusion of the Chapter

In this article, we propose a path for introducing funding liquidity risk in a general equilibrium intermediary asset pricing model. With inspirations from the monetary policy implementation literature, we do so by assuming that leveraging by issuing short-term liabilities to hold long-term capital market assets generate liquidity risk. The framework allows us to study the benefits and limitations of three conceptually different types of monetary policy. Our analysis concludes that the most forceful policy mix implies to first use discount window and liquidity injection policies to alleviate funding stresses up to the point where traditional banks are fully satiated. If the shadow banking sector is large, this may not be sufficient to address all of the downward pressures in asset prices. In this case, the only tool available to go further is for the central bank to directly purchase long-term assets. This suggests that, even when costly, LSAP can be beneficial for the economy in contexts in which money markets are impaired and the shadow banking sector is large. Overall, this article points out the importance of understanding how the development of a more international financial system leads central banks to extend their set of policy tools to address systemic liquidity crises.

High Risk Premia Stagnation

Abstract: How does productivity growth interact with financial cycles? In the years that followed the great recession, the diffusion of new innovation has been particularly low resulting in low productivity growth. This article shows that this pattern can be rationalized in a standard macro-financial model with heterogeneous risk aversion when assuming that implementing new innovation is risky. In the model, large negative shocks to productivity affect risk tolerant agents more than risk-averse ones and therefore increase aggregate risk aversion. Consistent with empirical observations, the model generates large time-varying risk premia and hysteresis following financial crises. *This chapter is based on a joint work with Adrien d'Avernas (formerly Ph.D candidate in UCLA and currently Assistant Professor at the Stockholm School of Economics).

"In itself stagnationism is practically as old as economic thought. In any prolonged period of economic malaise, economists, falling in like other people with the humors of their time, proffer theories that pretend to show that depression has come to stay." Schumpeter (1954, p172)

Introduction

The financial crisis of 2008 has been a major tipping point for the economic trajectory of most mature economies. Recoveries that followed were characterized not only by persistent negative output gaps but also by a significant decrease in potential output. According to [START_REF] Stock | Why has GDP growth been so slow to recover?[END_REF], a large part of the GDP slowdown in the U.S. during the 2010-2016 period can be attributed to an unexpected slowdown in productivity growth. Yet, there is no consensus amongst economists on the drivers behind this phenomenon to which they refer to as the "productivity malaise puzzle". The first set of potential explanations can be termed as the secular stagnation hypothesis. According to [START_REF] Fernald | Productivity and potential output before, during, and after the great recession[END_REF]a n dGordon (2014), the slowdown in productivity growth follows a structural and secular weakening of technological progress. The second set of hypothesis highlights the potential acceleration of the depreciation of human and physical capital of running large negative output gaps for prolonged periods. This chapter investigates a third hypothesis according to which the financial crisis has itself caused a productivity slowdown by destructing the risk-bearing capacities of the economy and consequently altering the rate at which new technologies are implemented.

To do so, we build a continuous-time stochastic dynamic general equilibrium model featuring financial frictions and agents differing in their risk aversion and screening technology. While most macro-finance models treat productivity as an exogenous process that impacts asset prices, growth theory treats financial conditions as the exogenous process. We bridge the two approaches by considering an economy in which both risk premia and productivity growth are endogenously determined. In the model, agents hold a diversified portfolio of firms' equity and have the option to implement new technologies by reallocating some part of the physical capital to new projects. A continuum of projects with different risk and expectation profiles are available to investors. They evaluate the potential of the projects and pick a portfolio of new ventures on the mean-variance frontier according to their preferences for risk. As Gârleanu and Panageas (2015), we assume that intermediaries have lower risk aversion than households.

When well capitalized, financial intermediaries take advantage of the higher mean-variance trade-off in the innovation diffusion technology and lower risk aversion. Because of market incompleteness, they do so by leveraging, which builds fragility into the economic system. After a series of bad productivity shocks, the system enters a crisis regime in which intermediaries sell capital to the households and asset prices decline.

The model highlights three channels linking financial crises to the slowdown in productivity growth. First, during the crisis regime, the rise in endogenous risk crowds out the amount of risk undertaken in the innovation diffusion technology.

Because agents care about their overall risk exposure, whenever endogenous risk rises, they react by deleveraging and decreasing their exposure to innovation risk. Moreover, the series of negative shocks that predate a financial crisis, impact the wealth of risk-tolerant financial intermediaries more than risk-averse households with poor financial expertise. Therefore, the risk-aversion of the marginal investor increases and lowers the aggregate risk taken in technology diffusion. As a consequence, during crisis regimes, financial intermediaries are undercapitalized, and productivity grows at a slower pace.

Our framework rationalizes three singularities that arise in the recessions that follow a financial crisis. First, potential output grows at a slower pace. Over the course of 50 years for 23 advanced economies, [START_REF] Blanchard | Inflation and activity: two explorations and their monetary policy implications[END_REF] d o c u m e n tt h a tp o t e n t i a lo u t p u td e c l i n e ds i g n i fi c a n t l ym o r ed u r i n gr e c e ssions that followed financial crises than other types of recessions. Second, [START_REF] Muir | Financial crises and risk premia[END_REF]fi n d st h a tfl u c t u a t i o n si nr i s kp r e m i af o l l o wt h efi n a n c i a lc y c l er a t h e rt h a n the business cycle. Risk premia are low during economic booms and high following financial crises. Third, [START_REF] Bartelsman | Measuring and analyzing cross-country differences in firm dynamics[END_REF]a n d Bartelsman, Haltiwanger, and Scarpetta (2013)d e m o n s t r a t eas i g n i fi c a n ti m p o r -tant decline in young firms' establishment rates after financial crises, while the bankruptcy rate is not affected.

Literature Review Af e wp a p e r se x p l o r ea l t e r n a t i v em e c h a n i s m sl i n k i n gfi n a ncial crisis to a slowdown in productivity growth. In [START_REF] Benigno | Stagnation traps[END_REF], innovation slowdowns arise in anticipation of a persistently depressed aggregate demand that is not corrected by central bank intervention due to the zero lower bound. Garcia-Macia ( 2015 Our paper is also related to the substantial literature focusing on the importance of wealth distribution during financial distress. [START_REF] Kiyotaki | Credit cycles[END_REF] shows how limited commitment restrains inter-temporal trade across heterogeneous agents and imperfect collateralization generates persistence and amplification. Brunnermeier and Sannikov (2014)andHe and Krishnamurthy (2013a)write models in which financial friction prevents more productive experts to optimally share risk with unproductive households. As in our work, crises are periods with a low capitalization of experts, high risk-premia and, therefore, low rates of investment in physical assets. On the demand side, Caballero and Farhi (2014)s t r e s s how a financial crisis, by redistributing resources away from safe asset creators, can create a shortage of safe assets. In this literature, recessions materialize on the real side by a slow down in capital accumulation and misallocation of capital. These are explanations of why financial crises produce recessions as a deviation from the trend but not why the trend itself is impacted. Our work explicitly features productivity growth as endogenous rather than exogenous.

Our paper is also related to the literature on Schumpeterian growth theory. In particular, Klapper, Laeven, and Rajan (2006), [START_REF] Aghion | Credit constraints as ab a r r i e rt ot h ee n t r ya n dp o s t -e n t r yg r o w t ho ffi r m s[END_REF]d o c u m e n tap o s i t i v er e l a t i o n s h i pb e t w e e nw e l l -d e v e l o p e dfi n a n c i a li n s t itutions and entrepreneurship, higher firm entry as well as firm dynamism and innovation. It is worth noting that the idea that financial conditions can affect the process of creative destruction can already be found in the early work of ) (1934 (2008). Financial expertise is crucial to providing funds to the higher probability of a successful entrepreneurial venture. [START_REF] Greenwald | Information, finance, and markets the architercute of allocative mechanisms[END_REF]e x p l o r e the idea that frictions in equity issuance do matter for productivity growth when it results from the cumulative impact of explicit investments in technology. Our work also relates to King and Levine (1993), De la [START_REF] Fuente | Innovation, bank monitoring, and endogenous financial development[END_REF], Galetovic (1996), [START_REF] North | The quality business: Quality issues and smaller firms[END_REF]a n d , Morales (2003)w h o consider the relationship between finance and growth but focus on cross-country and long-run determinants. Buera, Kaboski, and Shin (2011)a r g u et h a tfi n a ncial underdevelopment distorts the allocation of capital among incumbents and potential innovative entrants.

Last, our work is relate to articles focused on time-varying risk premia, limited market participation, and technological shocks. Basak and Cuoco (1998)p r o p o s e amodelinwhic ht w oagen tsparticipateintheeconom y ,butoneisrestrictedfrom participating in the financial market. As in our model, Bhamra and Uppal (2014), Chabakauri (2013), Gârleanu and Panageas (2015)featuretwoagentswithheterogeneous risk aversion. Moreover, we also related to Gârleanu, Panageas, and Yu (2012)a n dKogan and Papanikolaou (2014)i np r o po s i n gam od e lo fa s s e tp r i c i n g with technological shocks. Our key innovation with respect to this literature is to assume that the parameter of aggregate productivity risk is endogenous and depends on the strategy of firms in implementing or not new technologies.

The Model

The model is an infinite-horizon stochastic production economy with heterogeneous agents and financial frictions. Let (Ω, F, P)b eap r o b a b i l i t ys p a c et h a ts a t i s fi e s the usual conditions. Time is continuous with t 2 [0, 1). The model is populated by a continuum of households h and financial intermediaries i.

Preferences

Both types of agents have stochastic recursive utility functions following [START_REF] Epstein | Substitution, risk aversion, and the temporal behavior of consumption and asset returns: A theoretical framework[END_REF]a n dDuffie and Epstein (1992). The function f j (c j t ,V j t )i san o rmalized aggregator of consumption and continuation value in each period defined as:

f (ĉ j t n j t ,V j t )= ✓ 1 -γ j 1 -1/$ j ◆ V j t 2 4 ĉj t n j t [(1 -γ j )V j t ] 1/(1-γ j ) ! 1-1/$ j -⇢ 3 5
The variable V j t is the value function as defined below and ĉj t is the consumption rate. We write ⇢ =⇢+δ is the subjective rate of time preference which includes the probability of death δ.P a r a m e t e r sγ j and $ j are respectively the coefficient of risk aversion (RA) and inter-temporal elasticity of substitution (IES). As in Gârleanu and Panageas (2015)a n dDrechsler, Savov, and Schnabl (2017), we assume that intermediaries are less risk averse than households.

Assumption 11 (Heterogeneous Risk Aversion) Intermediaries are less risk averse than households: γ i <γ h .

Demographics

As in Gârleanu and Panageas (2015)andDrechsler, Savov, and Schnabl (2017)and in the first chapter, the model is a continuous time OLG. In order to guarantee the existence of non-generated stationary equilibrium, we assume that agents die at rate δ and new agents are born at rate δ with a fraction υ as intermediaries and a fraction 1υ as households. The newly-born receives the wealth of the deceased as an initial endowment irrespective of their types. The model is written in a continuous time and populated by a continuum of agents j of two types, intermediaries i : j 2 I and households h : j 2 H.W e d e n o t e t h e n e t w o r t h of an individual agent j at time t as n j t ,a tt h es e c t o rl e v e la sn i t = R j2I n j t and n h t = R j2H n j t and at the economy wide level as

n i t = R j2I n j t + R j2H n j t .
A similar notation applies to any variables in the model. We write the law of motion of the net worth of intermediaries relative to the size of the economy

⌘ t =( n i t /n i t + n h t )
as:

d⌘ t = (υ -⌘ t )dt + ⌘ t (1 -⌘ t )[µ ⌘,t dt + σ ⌘,t dZ t ] . (3.1)
Where µ ⌘,t and σ ⌘,t are to be determined endogenously according to the portfolio choices of the two types of agents and Z = {Z t 2 R d ; F t ,t ≥ 0} is a standard adapted Brownian motion summarizing aggregate risk in the economy.

Technology and Innovation

As we are concerned with productivity growth rather than capital deepening, we assume that physical capital is fixed and normalized to 1 and growth occurs through increases in capital efficiency. In other words, technological progress is embodied in capital. We use the notation e j t to denote an efficient unit of capital held by investor j and time t and associated with the production function:

y j t = a j e j t ,
The parameter a j is the exogenously fixed productivity. We assume that efficient units of capital held by agent j follow the following diffusion process:

de j t e j t =Φ j σ j t ,g t dt + σ j t dZ t ,
where Φ j σ j t ,g t is the technology diffusion function. It is a positive and concave function of the amount of risk that investor j is taking σ j t and of g t = e t /z t the ratio of economy-wide implemented technologies e t to the technological frontier z t . Average growth of productivity depends positively on the Brownian loading σ j t such that investors are facing a mean-variance trade-off in their technology diffusion choice. The higher the diffusion risk investors are willing to take, the faster productivity grows. Moreover, in an economy with financial frictions, access to financial markets may differ according to agents' type to reflect expertise such that the mean-variance trade-off is better for financial intermediaries.

Assumption 12 (Financial Friction) Intermediaries have access to a better mean-variance trade-off in their innovation implementation function: 8t,8g t , 8σ j t ;Φ i σ j t ,g t ≥ Φ h σ j t ,g t .

The mean variance trade-off interacts with the distance to technological frontier. The further away the productivity is to the frontier, the better is the risk-variance trade-off. A closely related idea of technological diffusion being more costly around the technological frontier can be found in [START_REF] Anzoategui | Endogenous technology adoption and R&D as sources of business cycle persistence[END_REF]. To capture the persistence of the growth rate of the technological frontier, we assume that the frontier z t increases deterministically and exogenously according to the following process:

dz t z t = µ z dt.
The price of a unit of efficient capital is q t . As the economy only features one stochastic process dZ t ,w ecanwritethatthestoc hasticla wofmotionofq t follows:

dq t q t = µ qt dt + σ qt dZ t ,
where µ qt and σ qt are to be determined endogenously in the model using market clearing conditions. Applying Ito's lemma, we find the return of holding a unit of efficient capital for agent j:

dR j t = ✓ a j q t +Φ j σ j t ,g t + µ q t + σ j t σ q t ◆ | {z } µ j Rt (σ j t ) dt + σ j t + σ q t | {z } σ j Rt (σ j t )
dZ t .

Optimization Problem

Agents solve a leveraged [START_REF] Merton | An intertemporal capital asset pricing model[END_REF] problem with an additional choice variable σ j t accounting for the risk exposure agent j is taking in implementing innovation. Each agent chooses its optimal consumption c j t ,i n v e s t m e n tr i s kσ j t ,a n dp o r t f olio weights w j t on efficient capital to maximize their discounted infinite lifetime expected felicity:

V j t =m a x w j t ,σ j t ,c j t E t Z 1 t f j c j s ,V j s ds s.t. dn j t n j t = (1 -w j t )r t + w j t µ j Rt (σ j t ) -ĉj t dt + w j t σ j Rt (σ j t )dZ t .
(3.2) 1. markets for firms' equity, and consumption goods clear (and market for riskfree bill clears by Walras Law):

Equilibrium

⌘ t w i t +(1-⌘ t )w h t =1, (3.3)
⌘ t ĉi t +(1-⌘ t )ĉ h t = a/q t , (3.4)
2. every Households j 2 H and Intermediaries j 2 I solve their problem in (3.2)

Solving the Model HJB Equation

Thanks to the homotheticity of preferences and technology, we guess and verify the value function of an agent j in power form as:

V (⇠ j t ,n j t )= (n j t ) 1-γ j ⇠ j t 1 -γ j ,
where the wealth multiplier ⇠ j t captures time variations in the set of investment opportunities that are not due changes in net worth. We postulate a law of motion for this wealth multiplier which remains to be determined in equilibrium:

d⇠ j t ⇠ j t = µ j ⇠t dt + σ j ⇠t dZ t .
Using Ito's lemma, we can write the Hamilton-Jacobi-Bellman (HJB) equation for any agent j as:

0= max ĉj t ,σ j t ,w j t 1 1 -($ j ) -1 2 4 ĉj t 1-($ j ) -1 ⇠ j t 1-($ j ) -1 1-γ j -⇢ 3 5 +(1-w j t )r t + w j t µ j Rt -ĉj t - γ j 2 w j t (σ j + σ qt ) 2 + µ j ⇠t 1 -γ j + w j t (σ j + σ qt )σ j ⇠t . (3.5)

Optimality Conditions

We apply the optimality principle and derive the set of necessary conditions associated with the inter-temporal maximization problem (3.2).

Proposition 14 (Optimal Exposure to Technological Risk) Agent j's optimal exposure to innovation risk σ j t is the following implicit function:

µ j R,t (σ j t ) -r t σ j R,t (σ j t ) =Φ 1 σ j t ,g t + σ q t . (3.6)
Proof in Appendix 4.6.

Innovation risk and leverage are competing technologies such that their marginal benefits should be equal. The left-hand side of equation (3.6) is the traditional Sharpe ratio representing the marginal benefit of holding a unit of the risky asset on top of the risk-free rate and weighted by its risk exposure to shocks. The right-hand side is the marginal benefit of higher innovation risk exposure on average productivity growth.

Proposition 15 (Optimal Portfolio Weight) Agent j's optimal portfolio weight w j t is the following implicit function:

µ j R,t (σ j t ) -r t σ j R,t (σ j t ) = γ j w j t σ j t + σ q t -σ j ⇠,t . (3.7)
Proof in Appendix 4.6.

For similar reasons as above, the left-hand side of equation (3.7)i se q u a lt ot h e inverse of the volatility of the agent's stochastic discount factor (SDF). 1 As riskfree assets can be traded without restriction, r t must be the same for all agents. The first term of (3.7)i st h em y o p i cc o m p o n e n tc o r r e s p o n d i n gt ot h ev o l a t i l i t y of the SDF when the set of investment opportunities does not change over time. The second term is the state variable hedging component. It corresponds to the volatility of the SDF implied by time-varying shifts in investment opportunities captured by the responses in ⇠ j t to aggregate Brownian shocks.

Proposition 16 (Optimal Consumption Rate) Agent j's optimal consumption rate ĉj t is:

ĉj t = ⇢ $ j ⇠ 1-$ j 1-γ j t . (3.8)
Proof in Appendix 4.6.

The optimal consumption rate depends on the time discounting parameter ⇢,the wealth multiplier ⇠ j t which captures changes in the set of investment opportunities and the IES parameter $ j . Whenever the IES parameter is below (above) one, the income (substitution) effect dominates and the agent reacts to a better set of investment opportunity by increasing (decreasing) the consumption rate. Whenever $ j =1t h et w oe ff e c t sc a n c e le a c ho t h e r ,t h ec o n s u m p t i o nr a t ei sc o n s t a n t and equal to the time discounting parameter. 1 We write the law of motion of stochastic discount factor of agent j as

dΛ j t Λ j t = -r t dt -& j t dZ t .

Markov Equilibrium

As noted in the previous section, thanks to the homotheticity of preferences and technology, every optimality condition is linear in the agent's net worth n j t .F o r this reason, the distribution of wealth within a type of agent does not change the equilibrium. Hence, we can solve the model as a stationary Markov Equilibrium in the two state variables ⌘ t ,t h ed i s t r i b u t i o no fw e a l t hbetween groups, and g t , the distance of the economy to the technological frontier. We rewrite every time dependent equilibrium variables as a time-independent function of the pair of state variables {⌘ t ,g t }2[0, 1]x[0, 1]. We use Ito's lemma to compute the law of motions of the two state variables that are consistent with our general equilibrium definition and define a Markov Equilibrium.

Definition 17 AM a r k o vE q u i l i b r i u min {⌘, g} is a set of functions q(⌘, g), r(⌘, g), w i (⌘, g), w h (⌘, g), σ i (⌘, g), σ h (⌘, g), ĉi (⌘, g), ĉh (⌘, g), ⇠ i (⌘, g) and ⇠ h (⌘, g) and diffusion parameters µ ⌘,t ,µ g,t ,σ ⌘,t ,σ g,t such that:

1. ⇠ i and ⇠ h solve their respective HJB equations (4.2) , 2. taking q,r and the law of motion of ⌘ and g as given, policy variables w i , w h , σ i , σ h , ĉi , ĉh solve their respective optimality conditions (3.6), (3.7) and (3.8), 3. the evolution of state variables ⌘ t and g t are determined jointly by conditions 1., 2. and market clearing conditions (3.3) and (3.4).

Numerical Solution and Parametrization

We solve numerically for the global solution of the model, informally, the mapping from the pair of state variables {⌘ t ,g t } to other variables in the equilibrium definition. The numerical procedure follows the finite-difference methodology developed in the third chapter of this thesis. The procedure decomposes the approximation scheme in two separated parts. We solve for the wealth multiplier ⇠ j (⌘ t ,g t )b a c kward in time by using an implicit Euler method. Appendix 4.6 details the numerical procedure applied to the given problem. For numerical simulation we use the functional form for Φ j :

Φ j σ j t ,g t = log (g t )σ j t +1 (g t )
,

where (g t )=✓ j g t /(1 -g t ).

The function (g t )i sap a r a m e t e rr u l i n gt h ee ffi c i e n c yo ft h em e a n -v a r i a n c e trade-off depending on the distance to technology and an exogenous structural factor parameter ✓. When (g t ) is high, more risk is needed to achieve a similar productivity growth while when the economy gets closer to the technological frontier (g t gets closer to one), the mean-variance trade-off becomes less attractive. The further away from the frontier, the bette the technological diffusion function in trading off higher variance for higher expected productivity growth. The structural factor parameter ✓ should be seen as reflecting all potential exogenous factors traditionally associated with growth and firm dynamics such as infrastructure, legal protection, barriers to entry, product and labor market rigidities, and others. We parametrize the model with values that are standard in the literature when available. We follow Gârleanu and Panageas (2015)i na s s u m i n gγ i =1 .5, γ h =10,Di Tella (2017)i nI E Sp a r a m e t e r s$ i = $ h =2,Brunnermeier and Sannikov (2014)witha =0.07 and [START_REF] Silva | The risk channel of unconventional monetary policy[END_REF]withmortalit yrate⌫ =0.02 and time preference ⇢ =0.02. For the purpose of this thesis, we will focus on the complete market benchmark case, and our parameter ✓ h = ✓ i in order to match annualized average volatility of TFP of 0.04. We leave for future research to investigate the effect of heterogeneity in this parameter.

Asset Pricing with Optimal Technological Risk

To understand the implications of having technological risk as a choice variable, we present here first a simplified model with a representative agent and fixed  which conveniently features a closed form solution. We compare this model with the seminal [START_REF] Lucas | Asset prices in an exchange economy[END_REF] Tree model as a benchmark. We find that both optimal risk-taking and productivity growth are decreasing in risk aversion. Figures 3.1 and 3.2 illustrate how allowing for agents to choose technological risk changes the relationship between the key variables of the model and risk aversion when wealth effect and substitution effect respectively dominate. We first guess and verify that the solution is stationary by setting: σ q t = σ ⇠ t = µ q t = µ ⇠ t =0a n dr e m o v et i m e indices. In equilibrium, the condition for optimal risk-taking is then given by the upper root:

σ = -γ + p γ 2 +4γ 2γ . (3.9)
In the static version of the model, technological risk-taking is a negative function of two parameters: risk aversion γ and the mean-variance parameter .B o t ho f these relations are intuitive. When portfolios are fixed by the market clearing condition w =1,therepresen tativ eagen twillw an ttotak elessriskwhenitsrisk aversion is higher. Similarly, when Φ is such that a similar amount of risk-taking yields a lower increase in productive capital, the agent will take less risk. We can also solve in closed form for ⇠ to find an expression for the price to dividend ratio:

q a = 1 ⇢ + 1 2 (1 -$ -1 )γσ 2 (γ) -(1 -$ -1 )Φ(γ) . (3.10)
This equation looks similar to the traditional asset pricing equation for a Lucas Tree economy with Epstein-Zinn utility function with the addition that both the drift Φ and the variance σ of productivity are endogenous and depend on the risk aversion parameter γ. As in the traditional Lucas Tree model, the way asset prices are affected by changes in the drift and variance of the productivity process depends crucially on the parameter driving the inter-temporal elasticity of substitution $. Whenever $ -1 < 1, the substitution effect dominates such that an increase in the drift of productivity translates into higher prices. When the converse ($ -1 > 1) holds, wealth effect dominates such that the decrease in the future marginal utility that follows an increase in the growth of productivity is such that agents want to consume more and hold less capital. Moreover, when substitution effect dominates $ -1 > 1, an increase in σ 2 ,t h ev o l a t i l i t yo ft h ep r ocess for the productivity of capital, yields to a decrease of the price of capital when agents are risk averse γ>0. Similarly, this effect is dominated by wealth effect when $ -1 < 1 as risk-averse agents want to increase their holdings of capital for precautionary saving motives (ensuring higher consumption in bad states of the world).

As can be seen from the first pannel of figures 3.1 and 3.2,t h es i g no ft h e relationship between the price to dividend ratio q/a and the risk aversion parameter γ is not affected by allowing for technological risk choice for a given IES parameter $.R a t h e r ,t h ee n d o g e n e i t yo fσ shows up as concavity or convexity respectively when wealth or substitution effect dominates. For a low (high) risk aversion σ,the increase in productivity Φ will be high (low) and therefore the decrease in future marginal utility of consumption will be high (low) as well. In other words, the wealth effect is higher when risk aversion is lower. Equations for the equilibrium Sharpe ratio $ and the risk free rate look can be written similarly to the Lucas Tree mo del, taking into account that b oth σ and φ are now endogenous and depend on the parameter of risk aversion γ:

r = ⇢ - 1 2 (1 + $ -1 )γσ 2 (γ)+$ -1 Φ(γ), (3.11)
& = γσ(γ).

(3.12)

As i m i l a re ff e c tf o rt h ee q u i l i b r i u mr i s k -f r e er a t ec a nb es e e ni ne q u a t i o n ( 3.11) and is illustrated in the upper middle pannel of figures 3.1 and 3.2. Whenever risk aversion is high, future marginal utility is high relative to today's because productivity growth is low. This increasing wealth effect in γ therefore generates convexity.

Last, with endogenous technological risk-taking, the equilibrium price of risk & depends twice on risk aversion γ in equation (3.12). First, as in the benchmark model, agents having a higher aversion for risk require higher compensation for it. Second, optimal risk-taking σ is a negative function of risk aversion γ.T h e r e f o r e , lower risk aversion translates into higher aggregate volatility of consumption and consequently a higher price of risk &.C o n v e r s e l y ,w h e nr i s ka v e r s i o ni sl o w ,t h e price of risk is lower than in the benchmark case. Intuitively, as agents have access to a second technology to exchange volatility for return (changing their technological risk choice rather than increasing their leverage), they can adjust risk through this additional channel which impacts the equilibrium price of risk. This effect can be seen in the lower left panel of figures 3.1 and 3.2.

Productivity Cycles

In this section, we analyze the implications of the model for the joint behavior of the financial cycle and productivity growth. We find that assuming complete markets implies that agents with heterogeneous risk aversions choose a similar exposure to technological risk and trade risk-free bonds to adjust their positions to their preferences. In general equilibrium, this common exposure to technological risk depends on the level of aggregate risk aversion which is itself a function of the state variable ⌘ tracking the distribution of wealth. Even absent any financial friction, the model generates an endogenous productivity cycle which fluctuates between states in which risk-tolerant agents are well-capitalized, risk premia are low and productivity growth is high and states in which these agents are undercapitalized, risk premia are high and productivity growth is low.

Equilibrium Variables as a Function of States

In order to analyze the dynamics of the model, we first focus on understanding how endogenous variables evolve as a function of state variables.

Proposition 18 (Uniqueness of Technological Risk Exposure) Without financial frictions (✓ i = ✓ h ), agents of different types pick the same exposure to technological risk:

σ i (⌘ t ,g t )=σ h (⌘ t ,g t )=σ(⌘ t ,g t ).
a sketch of the proof is in Appendix 4.6 for an approximation of the model. We refer to numerical simulations for the complete setting Proposition 18 is a consequence of the ability of agents with different risk aversion to trade risk by adjusting their respective leverage through risk-free debt. Akin to the traditional result from Markowitz, agents with varying aversions to risk pick as i m i l a rpo r t f o l i oc o m po s i t i o no fs t oc k s ,o re x po s u r et ot e c h n o l o g i c a lr i s k ,o nt h e efficient frontier. The main difference with respect to this traditional result is that, in our setting, we model the preferences for risk of investors affect the corporate strategies of firms and ultimately determine the level of macroeconomic risk.

In general equilibrium, this level of aggregate technological risk depends crucially on the level of aggregate risk aversion. In order to see this, let's consider a firstorder approximation of the model by assuming that agents are myopic with respect to shocks to their set of investment opportunities (σ i ⇠ = σ h ⇠ =0 )a n da s s e tp r i c e s (σ q = 0). This technical assumption is equivalent to the one made in the previous chapter. We make this assumption for exposition purposes and relax it later in our numerical estimations. We then show that the qualitative conclusion we draw in this section remains valid.

Proposition 19 (A First Order Approximation) Assume that agents are myopic with respect to shocks to their set of investment opportunities (σ i ⇠ = σ h ⇠ =0 )and asset prices (σ q =0), equilibrium variables can be written as:

w i t = γ(⌘ t ) γ i , (3.13) w h t = γ(⌘ t ) γ h , (3.14) & t = γ(⌘ t )σ(⌘ t ,g t ).
(3.15)

σ t = -γ(⌘ t )+ p (γ(⌘ t )) 2 +4(g t )γ(⌘ t ) 2(g t )γ(⌘ t ) . ( 3

.16)

Where γ(⌘ t )=

γ i γ h
(1-⌘t)γ i +⌘tγ h is the aggregate risk aversion. Proof in Appendix 4.6.

Proposition 19 provides a simple and intuitive characterization of the main variables of the model. Aggregate risk aversion γ is a function of the wealth distribution variable ⌘ represented in the upper left panel of figure 3.3. As the wealth share is shifted towards more risk-tolerant agents (⌘ t increases), aggregate risk aversion decreases. At the edges (⌘ t =0and⌘ t = 1) all the wealth is in the hands of one type of agents and its risk aversion parameters are equal to the aggregate risk aversion. The optimal portfolio choice of both agents is the inverse of the proportion of its own risk aversion to aggregate risk aversion. When aggregate risk aversion is high (when ⌘ is low), both households and intermediaries have a larger part of their wealth in risk assets. Because intermediaries are less risk-averse, their portfolio weight in stocks is always higher than one while households' is always below one. This reflects the fact that intermediaries are leveraged, issuing risk-free bills to households, in order to bear a larger part of aggregate risk. The lower part in the figure 3.3 displays the equilibrium optimal technological risk σ,t h er a t eo f technology diffusion φ and Sharpe ratio & as a function of ⌘ respectively for g =0.2 (dashed line) and g =0 .3( f u l ll i n e ) . T h e s et h r e ev a r i a b l e sd e p e n dn o to n l yo n the distribution of wealth ⌘ but also on the distance to the technological frontier g through the optimal choice for σ. As being further away from the technological frontier (low g)i n c r e a s e st h em a r g i n a lr e t u r nt ob e a r i n gi n n o v a t i o nr i s kΦ 0 (σ), optimal innovation risk is larger.

Moreover, as innovation diffusion Φ gets more productive for any level of optimal risk-taking σ,i tb e c o m e se v e nl a r g e rt h a nt h ei n c r e a s ei nσ resulting in a net in-crease in the Sharpe ratio. In the meantime, the effect of a shift in the distribution of wealth ⌘ works through a shift in aggregate risk aversion γ(⌘). When aggregate risk aversion is high (⌘ low), the choice for optimal risk and, hence, the rate of technology diffusion is low. This intuitive effect is at the core of the mechanism that generates the endogenous cycle in productivity growth. The last panel also shows that, in times when intermediaries have a lower share of aggregate wealth, risk premia will also have to be high to reflect the decrease in macroeconomic appetite for risk.

Endogenous Evolution of State Variables

In order to add to our understanding of the model dynamics, we now focus on the endogenous evolution of the state variables and the overall behavior of the economy.

Proposition 20 (Law of Motion of State Variables ) Absent financial frictions ✓ i = ✓ h , the diffusion parameters of the state variables are given by:

µ ⌘,t = r t + w i t & t (σ t + σ q t ) -ĉi t -Φ t -µ q t -σ t σ q t +(1-w i t )(σ t + σ q t ) 2 σ ⌘,t =(w i t -1)(σ t + σ q t ) µ g,t =Φ t -µ z t σ g,t = σ t Proof in Appendix C.
The evolution of ⌘ t can be decomposed in two parts: the endogenous part depending on equilibrium portfolio choices of both agents and the exogenous part that is given by the demographic process given in the first part of section 3.2.T h e endogenous part is such that ⌘ t growth deterministically as risk tolerant intermediaries are earning the risk premia (µ ⌘,t > 0) and loading on the Brownian is negative (σ ⌘,t < 0) and proportional to the leverage of intermediaries (w i t -1). Whenever as h o c kh i t st h ee c o n o m y ,t h en e tw o r t ho fi n t e r m e d i a r i e si sm o r ea ff e c t e dt h a n households' because they are using leverage to hold a larger share of the risky stocks in the economy. The demographic component counteracts deterministic growth through the assumption that endowments are reshuffled when agents die. The interaction between these two forces determines the locus of the deterministic steady-state.

The evolution of the equilibrium technological gap (1g t )d e p e n d so nt h ed i fference between the rate of technological innovation Φ and the rate at which the frontier grows. A growth rate of productivity above (below) the growth rate at the frontier reduces (increases) the gap. The deterministic steady-state is reached when these two growth rates are equals. Figure 3.4 displays the phase diagram of the model. The deterministic steady state at the intersection of the two black lines is globally absorbing. The red arrows starting from the steady-state represents the two possible directions of a shock to efficient capital. A negative shock pushes the economy to the lower-left (upper-right) direction, as a negative (positive) shock to efficient capital will simultaneously reduce (increase) the net worth of intermediaries relative households and push the economy further away from (closer to) the technological frontier.

Global Dynamics

In this subsection, we illustrate how the combination of the dynamics of the state variables and the mapping with the rest of the equilibrium variables can create an integrated financial and productivity growth cycle.

The economy is constantly hit by positive and negative Brownian shocks to the efficiency of capital. A series of positive shocks has two different effects. First, it moves the economy closer to the technological frontier (increase in g t ). Second, it benefits mainly the risk-tolerant intermediaries as these agents were ex-ante more exposed to technological risks (increase in ⌘ t ). In the ⌘ dimension, the economy, therefore, moves in a locus where aggregate risk aversion is lower such that both technological risk and technological diffusion rate are high (the upper side in the three panels of figure 3.5). This high risk-bearing capacity in the economy also corresponds to low-risk premia &.T h i ss t a t eo ft h ee c o n o m yw o u l d ,f o re x a m p l e , resemble the 90s in the US that were characterized by high levels of risk-taking and high productivity growth driven by the implementation of the recent progress in information technologies. The g dimension mitigates these developments. As the economy moves closer to the technological frontier, the marginal return to innovation decreases.

Conversely, as a series of adverse shocks hits, the economy moves into states where risk premia are high, risk-taking is low and innovation is implemented slowly such that productivity growth is low. The economy, therefore, drifts apart from the technological frontier. Two interesting patterns emerge from the model. First, during technological booms risk-taking is higher and, therefore, the probability of ac r a s hi sa l s oh i g h e r . I nt h i ss e n s e ,t h em o d e lm a t c h e st h ep a t t e r no fat e c hnological bubble without having to assume deviation from fundamental value nor rationality. Second, the dynamics of productivity growth exhibit long-run reversal. As the economy experiences a series of negative shocks harming its risk-bearing capacities, it moves away from the technological frontier and increases the stock of innovation to be implemented. Therefore, once the economy has reached pre-crisis risk tolerance, it will grow at a faster rate. Interestingly, this pattern is consistent with the work of Field (2003) according to which most of the TFP increase in the

A Solution Method for Continuous-Time Models

Abstract: We prop ose a robust metho d for solving a wide class of continuous-time dynamic general equilibrium models. We rely on a finite-difference scheme to solve systems of partial differential equations with multiple endogenous state variables in short computational time. This class of models includes the frameworks (among others) of [START_REF] He | Intermediary Asset Pricing[END_REF], Brunnermeier and Sannikov (2014), Drechsler, Savov, and Schnabl (2017), Di [START_REF] Tella | Why are bank balance sheets exposed to monetary policy? working paper[END_REF]a n dDi Tella (2017).

*This chapter is based on a joint work with Adrien d'Avernas (formerly Ph.D candidate in UCLA and currently Assistant Professor at the Stockholm School of Economics).

Part of the charm in solving a differential equation is in the feeling that we are getting something for nothing. So little information appears to go into the solution that there is a sense of surprise over the extensive results that are derived. Larrivee and Stibitz (1957, p40)

Introduction

The financial crisis of 2008 generated a resurgence of interest in the interaction between macroeconomic and financial variables. In particular, there is a growing demand for models able to capture non-linear dynamics and time-varying risk premia. An important part of this research effort has been undertaken by introducing financial frictions and heterogeneity in classical consumption-based asset pricing models. For instance, seminal articles by Brunnermeier and Sannikov (2014)a n d He and Krishnamurthy (2013a)b u i l d i n go nBasak and Cuoco (1998) developed a convenient framework to think about general equilibrium consequences of financial frictions. A second wave of articles looks at more complex dynamics involving more than one state variable to generate non-trivial movement in the aggregate stochastic discount factor such as Drechsler, Savov, and Schnabl (2017), Di Tella (2017)a n dDi [START_REF] Tella | Why are bank balance sheets exposed to monetary policy? working paper[END_REF]. If this strand of research is showing great potential in incorporating important macro-financial insights into asset pricing models, efficient algorithms to solve these are lagging behind. The algorithms used by these authors are not publicly available and the description of the numerical methods in the appendix of their papers do not mention the technical details and caveat necessary to implement the scheme on its own. In this paper, we propose to fill this gap with an algorithm able to solve a very general class of models in an efficient and standardized way. Most heterogeneous agent asset pricing models share a similar mathematical structure. They consist of an Hamilton-Jacobi-Bellman (HJB) equation for each agent coupled with a system of algebraic equations derived from the market clearing conditions, occasionally binding constraints, and financial frictions. Because we are interested in the recursive equilibrium, HJB equations are time-independent and, hence, nonlinear degenerated elliptic PDEs. Solving such a system of PDEs is, a priori, a tedious problem because it is numerically unstable. Approximation errors tend to amplify themselves to create explosive dynamics. We overcome these issues by combining insights from different parts of the numerical methods literature.

First, as it is customary in the physics literature, we add a fictitious time dimension (transient) to solve the system over time until convergence to equilibrium to bypass some numerical difficulties created by the non-linearities. More precisely, we follow Brunnermeier and Sannikov (2016a)a n ds o l v et h ea l g e b r a i cp a r to ft h e system statically while solving for the value functions of the different agents dynamically backward in time. The static system is solved in-between every time iteration using a simple Newton-Raphson method with the unconstrained solution as an initial guess. Solving for the value function backward in time requires more careful attention as the HJB equation inherits some of the inherent instability of the well-known advection equation. Informally, one needs to be particularly cautious in approximating the derivatives in the right spatial direction to preserve monotonicity of the elliptic operator. With one state variable (or several state variables with uncorrelated laws of motion), we can simply apply a traditional upwind scheme by taking the finite difference approximation according to the sign of the drift of the law of motion of the corresponding state variable. When we have at least two correlated state variables, the problem is more complex as the right direction may be inside the state space but not necessarily on the discrete grid. In this case, we use the method developed by Bonnans, Ottenwaelter, and Zidani (2004) consisting of using an available degree of freedom in the interpolation problem to rotate the state space with minimized computational time. Last, we also need to treat the non-linearities arising from the regulated part of the HJB. We follow the suggestion of [START_REF] Candler | Finite-Difference Methods for Continuous-Time Dynamic Programming in Computational Methods for the Study of Dynamic Economies[END_REF]t ot r e a tt h ep r o b l e ma si fi tw a s linear and relaxing the non-linear part with each iteration. We then solve the system in the time dimension using a fully implicit backward Euler algorithm until convergence. The contribution of this chapter to the literature is to show how, by combining these different insights, we can solve large class of continuous-time macro-finance models. The project is close to [START_REF] Hansen | Comparative valuation dynamics in models with financing restrictions[END_REF]whic halsopro-vides a Finite-Difference method to solve for a nested macro-finance model. The algorithm presented in this chapter diverges mainly by showing how to deal with correlated Brownian motions by using the insight of Bonnans, Ottenwaelter, and Zidani (2004).

The General Portfolio Problem

In this section, we recall the structure of [START_REF] Merton | An intertemporal capital asset pricing model[END_REF]p o r t f o l i op r o b l e mi n continuous time as it is the basis of the class of models we would like to solve and to define the Hamilton-Jacobi-Bellman (HJB) equation that is the focus of the finite difference scheme of Section 4.4.A t t h i s p o i n t ,t h e r e a d e r s h o u l d b e familiar with this structure as it corresponds to the models in chapters 1 and 2. This problem can be written in the following generic form. Agents have a lifetime utility function defined as:

U t = E t Z 1 t f (c t ,U t )du ,
where f t is a homothetic utility function. We assume that it follows an Epstein-Zin recursive formulation:

f (c t ,U t )= ✓ 1 -γ 1 -1/⇣ ◆ U t 0 @ " c t ([1 -γ] U t ) 1/(1-γ) # 1-1/⇣ -⇢ 1 A ,
where ⇢, γ,a n d⇣ are the parameters for time discounting, risk aversion, and intertemporal elasticity of substitution, respectively. Agents maximize U 0 under the law of motion of their net worth n t :

dn t n t = ⇣ r t + w t (µ r,k t -r t ) -c t ⌘ dt + w t σ r,k t dZ t ,
where r t is the risk free-rate, c t = c t /n t the consumption to wealth ratio, and w t the portfolio weight on a risky asset. This risky asset has dividend flows that follows:

dr k t r t = µ r,k t dt + σ r,k t dZ t ,
where Z t = {Z t 2 R d ; F t ,t ≥ 0} is a standard adapted Brownian motion process.

Finally, the HJB of the problem is given by: 0=max

wt,ct

f (c t ,U t )+E t (dU t ) .
Thanks to the homotheticity of the utility function, we can guess and verify the value function as:

U (⇠ t ,n t )= (⇠ t n t ) 1-γ 1 -γ , (4.1)
where ⇠ t is a wealth multiplier variable that tracks changes in the set of investment opportunities that could arise because of movements in state variables. We postulate its law of motion as:

d⇠ t ⇠ t = µ ⇠ t dt + σ ⇠ t dZ t .
Applying Ito's lemma to the HJB equation gives:

E t (dU (⇠ t ,n t )) = µ ⇠ t ⇠U ⇠ (⇠ t ,n t )+µ n t n t U n (⇠ t ,n t ) + σ ⇠ t ⇠ t 2 1 2 U ⇠⇠ (⇠ t ,n t )+ σ n t n t 2 1 2 U nn (⇠ t ,n t )+σ ⇠ t ⇠ t σ n t n t U ⇠n (⇠ t ,n t ),
where the subscript on a function represents the partial derivative with respect to that variable such that

F x (x, y)= @F(x, y) @x .
Note that, in a recursive equilibrium, state-variables characterize the whole system such that V t only moves through time as a deterministic function of other variables, and hence, Ut = 0. Using (4.23), we can rewrite the HJB equation as:

0=max ct,wt ( 1 1 -1/⇣ ✓ c t ⇠ t ◆ 1-1/⇣ -⇢ ! + µ ⇠ t - γ 2 σ ⇠ t 2 + r t + w t ⇣ µ r,k t -r t ⌘ -c t - γ 2 w 2 t σ r,k t 2 +(1-γ)w t σ r,k t σ ⇠ t ) . (4.
2)

The optimality conditions for c t and w t are given by:

c t = ⇠ 1-⇣ t , (4.3
)

w t = µ r,k t -r t +(1-γ)σ r,k t σ ⇠ t γ σ r,k t 2 . (4.4)
We can then plug in these conditions in the HJB in order to find a differential equation in ⇠ t .F r o mh e r e ,m o d e l sd i v e r g eb ya s s u m i n gd i ff e r e n tt y p e so fa g e n t sw i t h heterogeneous constraints, number of available assets, technology returns, financial frictions, and stochastic processes. These differences will eventually determine as e to fs t a t e -v a r i a b l e ( s )a ff e c t i n gt h es e to fi n v e s t m e n to p p o r t u n i t i e si nw h i c ha recursive equilibrium is determined. Yet, the skeleton of the model remains similar in consisting in a series of algebraic equations, imposing market clearing conditions and constraints, and an HJB equation for any agent. We follow the approach of Brunnermeier and Sannikov (2016a)i ns o l v i n gt h ea l g e b r a i cp a r to ft h es y s t e m as a side problem within each iteration of the differential problem. In a recursive equilibrium, we can write ⇠ t = ⇠(X t )asallv ariablescanbeexpressedasafunction of a set of the state variables vector X t following the law of motion:

dX t X t = µ X t dt + σ X t dZ t ,
where µ X t is the vector of individual drifts and σ X t a covariance matrix. We can then apply Ito's lemma to ⇠(X t )t ofi n d :

µ ⇠ t ⇠ t =(r X ⇠ t ) | µ X t + 1 2 Tr ⇥ σ X t | (H X ⇠ t )σ X t , ⇤ (4.5) σ ⇠ t ⇠ t =(r X ⇠ t ) | σ X t , (4.6)
where r X ⇠ t is the gradient of ⇠ t with respect to X t and H X ⇠ t is the Hessian matrix of ⇠ t with respect to X t .B ys u b s t i t u t i n gt h e s ee x p r e s s i o n sf o rµ ⇠ t and σ ⇠ t into (4.2), one can readily see that the HJB is a second-order non-linear partial differential equation in X t .

In the rest of this chapter, we show how to numerically solve such a problem. Unfortunately, because of its non-linearity, there is no theorem that can be applied to guarantee the stability and convergence of a numerical scheme. Nonetheless, by treating the equation as if it was linear, it is possible to create a scheme that is closer to stability and which works in practice. To make this point,1 assume that the set of state variables is a scalar X t = {x t } and use (4.2), (4.3), (4.4)t oi s o l a t e µ ⇠ t :

µ ⇠ t = - 1 1 -1/⇣ (c t -⇢)+ γ 2 σ ⇠ t 2 -r t + c t - γ 2 w 2 t σ r,k t 2 -(1 -γ)w t σ r,k t 2 σ ⇠ t .
(4.7)

In our general portfolio problem, ⇠ t is raised to the power 1 -⇣ in the FOC (4.3) which makes the HJB equation ( 4.2) non-linear once the optimal controls have been taken into account. Our strategy consists in solving the Ito equation 4.5 (rather than directly the HJB) as a linear function by treating µ ⇠ t as a parameter whose value is computed from the previous iteration. We can use this equation to compute a consistent value for µ ⇠ t to plug in (4.5)2 This procedure is commonly referred to as a relaxation method to reflect the fact that the non-linearity is introduced to the problem only in small increments from the previous iteration. The next sections will provide a concrete application of this principle.

The order of the approximation error can be computed by taking a Taylor expansion. Approximations that are the most centered and feature the most points will have a higher order of error. This is reflected in the central approximation having an error of order 2 while the forward and backward ones have only errors of order 1. At this stage, one could be tempted to conclude that the central approximation dominates the other two as it is more accurate when using only two nodes. Yet, as will be clear in the next section, it is not the case as we also care about convergence properties of the numerical scheme.

Instability in the Advection Equation

In this subsection, we introduce the advection (or wave) equation which features the same stiffness characteristics as the HJB equation we are concerned with. This example is often used in introductory fluid dynamics classes. Let's consider the advection equation:

V t + aV x =0. ( 4.8)
This equation has a well-known exact solution as V (t, x)=V (0,xat), given an initial condition V (0,x). We solve this problem by applying the three FD approximations from the last section with respect to the state variable and forward in time.

V n+1 i -V n i ∆t = -a V n i+1 -V n i-1 2∆x Central V n+1 i -V n i ∆t = -a V n i+1 -V n i ∆x Forward V n+1 i -V n i ∆t = -a V n i -V n i-1 ∆x Backward
We can express these three equations as an explicit function of V n+1 i as:

V n+1 i = V n i -a∆t V n i+1 -V n i-1
2∆x Central (4.9)

V n+1 i = V n i -a∆t V n i+1 -V n i ∆x Forward (4.10) V n+1 i = V n i -a∆t V n i -V n i-1 ∆x Backward. (4.11)
We can then compute the value for V across the grid iteratively through time starting from the given initial condition V (t =0)=V 0 . Figure (4.1)p r o v i d e st h e results (using algorithm 1 below) of this procedure for the three given approximations and parameters: ∆t =0 .2; a =0 .5; dx =0 .17 on a grid from 0 to 10 and starting from an initial state where V 0 =2forx 2 [0, 5] and V 0 =1forx 2 [5,10].

Algorithm 1: Explicit Euler 1. Define a finite grid over the state variable x,setV (t =0)=V 0 for any nodes on the grid.

2. Iterate through time by increment ∆t.

3. Iterate through each point in the state space from i=1 to i=I-1 and use one either (4.9), (4.10), and (4.11)t os o l v ef o rV n i given V n-1 i , V n-1 i+1 and V n-1 i-1 . 4. Go back to 2 until t=T.

The last panel of (4.1) displays the analytical solution at different time steps. As the coefficient a is negative, the initial condition is expanded from the left to the right. This process occurs through time, until reaching a steady state position where V = 2 for the whole state space. The first and second panels show that both the central and the forward difference approximation do not provide satisfactory results as the scheme exhibits large oscillations reflecting growing approximation errors. In fact, these errors are increasing in the number of time iterations which will, therefore, never converge to its steady-state value. On the other hand, one can see that the backward difference approximation is much more satisfying in matching the analytical solution and in converging to the analytical steady-state solution. This result is well-known in the numerical literature [START_REF] Candler | Finite-Difference Methods for Continuous-Time Dynamic Programming in Computational Methods for the Study of Dynamic Economies[END_REF]. When a is positive, the backward approximation has the property of being taken to the left of the wave being propagated to the right. Such a scheme is called upwinding or upstreaming to reflect that by taking the derivative left from the wave, we only take into consideration information coming from upstream of the flow. In the case of advection equation with a>0t h i si st h en a t u r a lt h i n gt od oa st h e wave is transported from left to right and the information on its right is, hence, irrelevant for its evolution. Crucially, the wave equation is what is called in physics a pure conservation,m e a n i n gt h a tt h ee n e r g y( t h es o l u t i o n )i sp u r e l yt r a n s po r t e d and does not diffuse into the domain. Providing a numerical approximation of pure conservation equation is difficult because any approximation has a diffusive nature. One has, therefore, to be careful about how this artificial diffusion (also called artificial viscosity) is introduced to ensure that it is not amplified through time. The key concept in this regard is that the approximation preserves the monotonicity of the solution through each time-iteration and does not add a new local maximum. One can see that this condition is indeed broken in the central and forward approximations as taking information from downstream breaks the conservation of the solution. This spurious diffusion going in the wrong direction is particularly problematic as it keeps amplifying at each iteration and prevents the solution to converge to its steady-state. On the other hand, the backward approximation, even if it introduces more diffusion in comparison to the central one, is doing so in the right direction and, therefore, preserves the monotonicity of the scheme provided that the Courant-Friedrichs-Lewy condition is satisfied a∆t ∆!  1. 3

An Implicit Scheme

In this subsection we introduce implicit (backward) schemes that are more stable than explicit (forward) ones. Note that in the last subsection, we approximated our advection equation (4.8)forwardintimebutwecouldalsohavedonebackward as:

V n i -V n-1 i ∆t = -a V n i+1 -V n i-1 2∆x Central V n i -V n-1 i ∆t = -a V n i+1 -V n i ∆x Forward V n i -V n-1 i ∆t = -a V n i -V n i-1
∆x Backward

In this case, we cannot use algorithm 1 as described in the previous section because V n i is now an implicit function which requires determining jointly the value of its neihboring points. One therefore needs to solve the following system:

V n = A -1 V n-1 (4.12)
where V n is a vector of V n i and A is a IxI matrix given by:

A CE = 2 6 6 6 6 4
1 a∆t 2∆x •• -a∆t 2∆x 1 a∆t 2∆x • • . . . . . . . . . •• -a∆t 2∆x 1 3 7 7 7 7 5
A FW = 2 6 6 6 6 4 ⇥ 1 -a∆t ∆x ⇤ a∆t ∆x •• • ⇥ 1 -a∆t ∆x ⇤ a∆t ∆x • • . . . . . . . . . •• • ⇥ 1 -a∆t ∆x ⇤ 3 7 7 7 7 5
85

A BW = 2 6 6 6 6 4 ⇥ 1+ a∆t ∆x ⇤ ••• -a∆t ∆x ⇥ 1+ a∆t ∆x ⇤ •• • . . . . . . . . . •• -a∆t ∆x ⇥ 1+ a∆t ∆x ⇤ 3 7 7 7 7 5
The algorithm 1 is therefore amended in replacing step 3 by solving (4.12). This requires the inversion of the bi-diagonal or tri-diagonal matrix A.T h i ss t e pi sm o r e computationally involved than solving explicitly for every node as in algorithm 1 but can still be done very efficiently by exploiting the sparsity of the matrix using, for instance, a standard Th omas algorithm. 4 In the case of the linear advection problem, these implicit schemes can be shown to be unconditionally stable and, hence, do not require to respect the CFL condition. Implicit schemes are in general more diffusive in nature as values of the solution at each node impact each other. For this reason, it is not frequently used in the numerical fluid dynamics literature to approximate the advection (a pure conservation) equation as they introduce too much approximation errors. Our case is different as we are interested in finding ar e c u r s i v ee q u i l i b r i u mt h a ti st i m ei n d e p e n d e n t . W ea r et h e r e f o r ei n t e r e s t e di n adding as much diffusion as possible in order to be able to take larger time steps to minimize computational time.

A Monotonic Scheme for the Portfolio Problem

In this section, we provide an implicit upwinding finite-difference scheme that can be applied to the HJB of the general portfolio problem. We tackle in turn the one-dimensional and two-dimensional cases.

Finite-Difference Scheme in One Dimension

In the unidimensional case, we are interested in solving an elliptic ordinary differential equation as (4.5) that does not depend on time. Though, because of the inherent instability of the non-linear HJB, it is easier to add a false transcient (time dimension) and solve it through time until convergence to a steady state. In doing so, we build our numerical scheme to be as diffusive as possible to be able to take large time steps and minimize the computational time needed for convergence. Note that, in this regard, we are interested in the accuracy of the approximation at a particular step in time only with respect to its impact on the convergence property of the scheme. Moreover, we solve the system backward in time rather than forward, as this will allow us not to define exogenous boundary conditions when the system admits a globally absorbing steady-state strictly inside the state space. We will come back to this p oint in actual examples. At the moment, let's consider the following linear5 parabolic (time-dependent) partial differential equation:

r(x)F (x, t)=u(x)+µ(x) @F(x, t) @x + σ(x) 2 2 @ 2 F (x, t) @x@x + @F(x, t) @t . (4.13)
We recall our definition of the grid from the previous section along the time t and state variable x on a grid equispaced in both time and state with respectively ∆t and ∆x distance between two points. Grid nodes are then referred to by numbering them ordinally along the two dimensions: t 2{ t 1 ,t 2 ,...,t n ,...,t N } and {x 1 ,x 2 ,...,x i ,...,x I }.Af u n c t i o nF (t, x) evaluated at a point (n, i)o nt h e grid is then noted as:

F n i = F (t n ,x i )=F (n∆t, i∆x).
Afi n i t ed i ff e r e n c ea p p r o x i m a t i o nc o n s i s t si nt h ee v a l u a t i o no ft h ep r e v i o u se xpression for a finite distance of ∆x. As our grid features various points, one could potentially use different nodes to compute the approximation. In theory, a finite-difference approximation can be done through any linear combinations of the nodes in the grid. The most commonly used local approximations involving only two neighboring points are the Forward, Backward and Central approximations of the previous section.

As we have illustrated previously, a wave equation with a positive directional parameter (moving to the right) requires a backward approximation while a negative directional parameter (moving to the left) requires a forward approximation. For when allowing for the sirectional parameter to vary according to its p osition between negative and positive values, we have change the direction approximation dynamically. This is what the following (always) upwinding approximation does:

@F(t, x) @x ⇡ µ + i F n i+1 -F n i ∆x + µ - i F n i -F n i-1 ∆x ,
where

µ + i = ( µ i if µ i > 0 0e l s e , µ - i = ( µ i if µ i < 0 0e l s e .
This approximation preserves monotonicity of the solution through each time iteration; that is, it does not add a new local maximum.

We use an implicit upwind finite-difference scheme. An implicit method, while more complex to program and requiring more computational effort in each solution step, is more stable and allows for large time-step sizes. Explicit methods calculate the state of a system at a later time from the state of the system at the current time, while implicit methods find a solution by solving an equation involving both the current state of the system and the later one. Mathematically, if F n is the current value function vector on the discrete equispaced grid I and F n+1 is the state at the later time, then, for an explicit method

F n+1 = T (F n )
while for an implicit method one solves an equation

T (F n+1 , F n )=0
to find F n+1 .T h eu p w i n dfi n i t e -d i ff e r e n c es c h e m ea p p r o x i m a t i o no fe q u a t i o n( 4.13) for time t 2 T on the discrete equispaced grid i 2 I is given by:

r i F t i = u i + µ + i F t i+1 -F t i ∆x + µ - i F t i -F t i-1 ∆x + σ 2 i 2 ✓ F t i+1 -2F t i + F t i-1 ∆x 2 ◆ + F t+1 i -F t i ∆t .
We are lo oking for an implicit system of equations given our parameters and guess from the previous time iteration but solving backward in time, setting F t ⌘ F n+1 and F t+1 ⌘ F n .W ec a nt h e r e f o r ew r i t eo u rn u m e r i c a ls c h e m ei nt h efi x e d -p o i n t form as:

 r i + 1 ∆t + µ + i -µ - i ∆x + σ 2 i ∆x 2 | {z } M i F n+1 i =  µ + i ∆x + σ 2 i 2∆x 2 | {z } -U i F n+1 i+1 -  µ - i ∆x - σ 2 i 2∆x 2 | {z } D i F n+1 i-1 + u i + F n i ∆t .
Because U i > 0, M i > 0, and D i < 0f o ra l li,t h es c h e m ei su n c o n d i t i o n a l l y monotone in F n+1 i-1 ,F n i ,a n dF n+1 i+1 . Note that the centered second derivative term in front of the volatility, since always positive, is not an issue for the monotonicity of the scheme. Theoretically, for a linear problem, we could, therefore, take an arbitrarily large time step in solving the equation. In practice, the non-linearity of the scheme restricts the size of the time step we can take. There is no theorem available to determine this limit, and it can only be found through by running simulations.

Going backward in time, we solve for F n+1 as a function of F n .I no r d e rt od o so, we can now write our parabolic partial differential equation in matrix form as:

F n+1 = A -1  u + F n ∆t (4.14)
where the matrix A is given by:

A = 2 6 6 6 6 6 6 6 4 M 1 U 1 ••• D 2 M 2 U 2 •• • . . . . . . . . . • •• D I-1 M I-1 U I-1 •• • D I M I 3 7 7 7 7 7 7 7 5
and

F n = 2 6 6 4
F n 1 . . .

F n I 3 7 7 5 , u = 2 6 6 4 u 1 . . . u D 3 7 7 5 .
Note that by writing the equation in this form we are not assuming any boundary condition on the edge of the grid for the value function F (t, x)intermsofthestate variable x.W ea s s u m et h a tw ed on o tn e e dt od os ob e c a u s et h ev a l u ef u n c t i o nw i l l drift right at the left boundary and left at the right boundary. This is equivalent to assuming that there exists an interior absorbing stochastic steady-state. In most macro-finance applications, the two edges of the state grid are degenerating points where the volatility σ i goes to 0. Therefore, we can solve numerically for equation (4.13)w i t ht h ef o l l o w i n ga l g o r i t h m : Algorithm 1 Implicit Euler 1. Define a finite grid over the state variable x and set an initial guess for F 0 .

2. Invert the sparse matrix A using Thomas algorithm to solve for F n+1 in (4.14).

3. Iterate on 2 until convergence.

Finite-Difference Scheme in Two Dimensions

Several models in macro-finance feature two state variables (i.e., [START_REF] Silva | The risk channel of unconventional monetary policy[END_REF], Di [START_REF] Tella | Why are bank balance sheets exposed to monetary policy? working paper[END_REF], Drechsler et al. (2017)). In this case, the state-space becomes a plane and the grid is defined on two coordinates. We write the generalization of (4.13)i nm u l t i p l ed i m e n s i o n sa s :

r(X)F (X,t)=u(x)+ m X i=1 µ i (X) @F(X,t) @x i + m X i=1 m X j=1 σ i (X)σ j (X) 2
@ 2 F (X,t) @x i @x j + @F(X,t) @t .

(4.15)

In this section, we are interested in the two-dimensional case and we, therefore, set m =2 . W ed e fi n eF n i,j as the value of F (X,t n )o nt h ei-th point of the twodimensional grid in the first dimension of size d 1 and j-th point in the second dimension of size d 2 . Finding a monotone scheme in the multidimensional case is a significantly more involved problem than the single state variable one, leading to important instability and convergence issues if not tackled properly. The first reason is that we now need to approximate the cross-derivative of F (X,t)w h i l e ensuring monotonicity. For instance, the following approximation

@ 2 F (X,t n ) @x i @x j ⇡ F n i+1,j+1 + F n i-1,j-1 -F n i+1,j-1 -F n i-1,j+1 4∆x (4.16)
is not monotone because both F n i+1,j+1 and F n i-1,j-1 have the wrong sign. The second reason is that even if we have identified the upwinding direction, there is no guarantee that there is an actual node in this particular direction and one must take an interpolation in order to estimate this particular point. In this case, this interpolation should be made in a way that preserves monotonicity.

To do so, we follow Bonnans, Ottenwaelter, and Zidani (2004)w i t haf a s ta l g orithm based on a walk on the Stern-Brocot tree. We accordingly write the upwind scheme that preserves the monotonicity with the following finite-difference approximation for time t 2 T and vector of state variables x k . We define k as the coordinate vector of the position of x k on the discrete multidimensional grid k 2 N m 0 .T h a ti s ,i fk = [ 2,5] | ,i tm e a n st h a tx 1,k is the 2nd point in the first dimension and x 2,k is the 5th point in the second dimension. We rewrite the partial differential equation ( 4.15)a s :

r k F t k = u k + m X i=1 µ + i,k F t k+e i -F t k ∆x i,k+e i + m X i=1 µ - i,k F t k -F t k-e i ∆x i,k-e i (4.17) + X ξ k 2Ξ k ⌘ ξ k ,k ⇣ F t k+ξ k + F t k-ξ k -2F t k ⌘ + F t+1 k -F t k ∆t , (4.18)
where e i is the directional vector such that the i-th component is equal to 1 and 0 otherwise. The vectors ξ k 2 Ξ k for the grid point k are found using the following stencil decomposition consisting in a collection of nonnegative coefficients ⌘ ξ,k such that:

X ξ k 2Ξ k ⌘ ξ,k ⇠ i,k ⇠ j,k = σ i,k σ j,k 2h i h j
where h i is the distance between grid points in the i-th dimension and the elements of the vectors ξ k are integers. Using a stencil decomposition, that imposes that the coefficient ⌘ ξ,k are nonnegative, guarantees that the implicit scheme is monotonic and converges to the unique solution. The stencil decomposition is reminiscent of the one using eigenvalues, with the important difference that the set of vectors is now constrained to belong to the stencil. We characterize the size of the stencil with P as the highest norm of the elements of the vectors ξ k . Bonnans, Ottenwaelter, and Zidani (2004)pro videafastalgorithmtofindthestencildecomposition. This algorithm is limited to stencil decompositions in two dimensions, which makes this method computationally infeasible for a higher dimensional problem.

Consider the covariance matrix If the matrix Σ is not diagonally dominant, the decomposition requires an algorithm to find a stencil decomposition. It suffices to discuss the case when the matrix is such that σ 22 <σ 12 <σ 11 as it is easy to reduce to this case by permutation of variables and change of sign of one of the element of the stencils. We provide the algorithm from Bonnans, Ottenwaelter, and Zidani (2004)a n dr e f e r to the article for an in-depth exposition.

Algorithm 2 Stencil Decomposition (Bonnans et al., 2004) 1. Initiate with q 0 =0, p 0 =1, q 0 0 =1, and p 0 0 =1. 2. If Σ is diagonal dominant, use equation (4.19) and stop.

Begin iteration n by computing the following

ξ = p n q n ! ξ 0 = p 0 n q 0 n ! X = ξξ | X 0 = ξ 0 ξ 0 | V = 0 B @ x 11 p 2x 12 x 22 1 C A V 0 = 0 B @ x 0 11 p 2x 0 12 x 0 22 1 C A V =(VV 0 ) S = 0 B @ σ 11 p 2σ 12 σ 22 1 C A 4. Take the cross product of V and V 0 N = V ⇥ V 0
and project S on the plane with normal vector N K = S -⌧ N where

⌧ = ||N|| -2 N | S
and || • || is the Euclidean norm.

5. If p + p 0 ≥ P or ||S -K||  ", then stop and the decomposition is such that

⌘ 1 ⇠ i ⇠ j + ⌘ 2 ⇠ 0 i ⇠ 0 j ⇡ σ ij ,
where

η = V\K.
The function \ is the solution in the least squares sense to the underdetermined system of equations Vη = P.

6. If p + p 0 <P and ||S -P|| >", then q 00 n = q n + q 0 n , p 00 n = p n + p 0 n and compute

ξ 00 = p 00 n q 00 n ! , X 00 = ξ 00 ξ 00 | , V 00 = 0 B @
x 00 11 p 2x 00

12

x 00

22 1 C A , V =(VV 0 V 00 ) , N = V ⇥ V 00 ,⌧ = ||N|| -2 N | S, K = S -⌧ N, η = V -1
K.

• If each element of the vector η is positive, then stop and the decomposition is such that

⌘ 1 ⇠ i ⇠ j + ⌘ 2 ⇠ 0 i ⇠ 0 j + ⌘ 3 ⇠ 00 i ⇠ 00 j ⇡ σ ij .
• If each element of the vector η is not positive and

sN | P  0,
where

H = 0 B @ 0.5 0 0.5 1 C A s = sign (N | H) ,
then q n+1 = q n , p n+1 = p n , q 0 n+1 = q 00 n , p 0 n+1 = p 00 n , and go to (3) for next iteration n = n +1.

• If each element of the vector η is not positive and sN | P > 0, then q n+1 = q 00 n , p n+1 = p 00 n , q 0 n+1 = q 0 n , p 0 n+1 = p 0 n , and go to (3) for next iteration n = n +1.

The intuition of Algorithm 2 is as follows. A two dimensional variance covariance matrix can be represented in two dimensions (since σ 12 = σ 21 , Σ has three coordinates). If the 3D representation of a variance-covariance matrix Σ is close enough to the projection of Σ on the plane generated by the vectors X and X 0 , then we can generate Σ by a linear combination of X and X 0 .I ft h e3 Dr e p r e s e ntation of a variance-covariance matrix Σ is inside the convex cone generated by the vectors X, X 0 ,andX 00 ,thenw ecangenerateAb yaconicalcom binationofX, X 0 ,a n dX 00 .I fn o n eo ft h ea b o v ei st r u e ,w en e e dt ou p d a t eX and X 0 such that one of the two above is eventually true. If Σ is outside the half plane generated by X and X 00 ,u p d a t es u c ht h a tq 0 = q 00 and p 0 = p 00 .O t h e r w i s e ,Σ has to be outside of the half plane generated by X and X 00 and update such that q = q 00 and p = p 00 .

As in the single dimensional case, we are looking for a solution that solves backward in time, that is an implicit system of equations in F t k given our parameters and guess from the previous time iteration. We can rearrange equation (4.17)t o get:

m X i=1 D i,k F n+1 k-e i + M k F n+1 k + S k F n+1 k + m X i=1 U i,k F n+1 k+e i - X ξ k 2Ξ k ⌘ ξ k ,k ⇣ F n+1 k+ξ k + F n+1 k-ξ k ⌘ (4.20) = u k + F n k ∆t ,
where

D i,k = µ - i,k ∆x k-e i , M k = r k + 1 ∆t + m X i=1 µ + i,k ∆x k+e i - m X i=1 µ - i,k ∆x k-e i , S k =2 X ξ k 2Ξ k ⌘ ξ,k , U i,k = - µ + i,k ∆x k+e i .
Later we will see that we need to keep M k and S k separate to handle points too close from the boundary. Going backward in time, we solve for F n+1 ⌘ F t as a function of F n ⌘ F t+1 .I no r d e rt od os o ,w ec a nn o ww r i t e( 4.20) in matrix form as:

F n+1 = A -1  u + F n ∆t (4.21)
where

F n = 2 6 6 4 F n k 1 . . . F n k D 3 7 7 5 , u = 2 6 6 4 u k 1 . . . u k I 3 7 7 5 ,

96

and .

K = h k 1 k 2 ••• k D i = 2 6 6 6 6 6 6 6 4 12••• d 1 12••• d 1 ••• d 1 11••• 122••• 2 ••• d 2 11••• 111••• 1
We denote D = Q n i=1 d i where d i is the size of the n-dimensional grid in the i-th dimension, and

d 0 =1. ThematrixA = A D + A M + A S + A U + A ⌘ is such that A M (j, j)=M k j , A S (j, j)=S k j , A D ⇣ j, j - Q i-1 l=0 d l ⌘ = D i,k j , A U ⇣ j, j + Q i-1 l=0 d l ⌘ = U i,k j , A ⌘ ⇣ j, j - P n i=1 ⇠ i,k Q i-1 l=0 d l ⌘ = -⌘ ξ,k j , A ⌘ ⇣ j, j + P n i=1 ⇠ i,k Q i-1 l=0 d l ⌘ = -⌘ ξ,k j .
The stencil decomposition is problematic for points of the grid that are too close to the boundary. If the size of the stencil is P ,i tc o u l db et h a tt h es t e n c i l decomposition requires to use a point that is P steps ahead and potentially beyond the grid. Therefore, for points k j too close to the boundary such that k i,j >d i -P for any of the dimension i,w ei m po s et h a tt h es e c o n do r d e rd e r i v a t i v ei se q u a lt o the one from the closest point of the grid that is not too close to the boundary. That is, for all points of the grid k j such that k i,j >d i -P for any i =1 ,...,m, we impose that A S j, j = A S j,j A ⌘ (j, `)=A ⌘ j,` 8`=1,...,D, where j is the index of the point k j that is the closest to k j and not too close to the boundary such that k i,j  d i -P for any of the dimension i =1,...,m. This assumption is similar to a first order extrapolation of the value function F n on the points of the grid where the stencil decomposition cannot be done accurately.

The stencil decomposition assumes constant distance between each point. If we want to allow for non-constant distance between grid points ∆x i ,w ec a nc o m p u t e h i as the average distance in the dimension i taken over every point on the grid potentially used in the stencil decomposition. That is,

h i,k = x i,k-P e i -x i,k+P e i 2P .
Now that we have our monotonic approximation, we can apply algorithm 3 exactly as we did with one dimension. Here as well, we are not assuming any boundary condition on the edge of the grid for the value function F n in terms the vector of state variables X. Implicitly, we assume that we do not need to do so because the value function will drift right at the left boundary and left at the right boundary. This is equivalent to assuming that there exists an interior absorbing stochastic steady state or that µ i,k > 0o nt h el e f tb o u n d a r ya n dµ i,k < 0o nt h e right boundary for all dimensions i.

Applications to General Equilibrium Models

In this section, we show how the finite difference scheme of the previous section can be applied to solve a generalized version of the continuous time macro-finance model with heterogeneous agents.

We present a general extension of Brunnermeier and Sannikov (2014)wheret w o agents have [START_REF] Epstein | Substitution, risk aversion, and the temporal behavior of consumption and asset returns: A theoretical framework[END_REF]u t i l i t yf u n c t i o n sa n da g g r e g a t ev o l a t i l i t yi s time-varying. The framework can easily be modified to any other general equilibrium framework with n-agents and two state variables.

Preferences There are two agent types: : households h 2 H and intermediaries i 2 I. Both agents have stochastic differential utility, as developed by Duffie and Epstein (1992). The utility of agent j over his consumption process c j t is defined as

U j t = E t ✓Z 1 t f c j s ,U j s ds ◆ .
The function f j (c, u)i san o r m a l i z e da g g r e g a t o ro fc o n s u m p t i o na n dc o n t i n u a t i o n value in each period defined as

f (c, U )= 1 -γ 1 -1/⇣ U " ✓ c ((1 -γ)U ) 1/(1-γ) ◆ 1-1/⇣ -⇢ #
where ⇢ is the rate of time preference, γ is the coefficient of relative risk aversion, and ⇣ determines the elasticity of intertemporal substitution. Each agent chooses its optimal consumption c j t ,i n v e s t m e n tr i s kσ r t ,a n dpo r t f o l i ow e i g h tw j t on capital holdings in order to maximize discounted infinite life time expected utilities U j t . At any time, the following budget constraint has to be satisfied:

dn j t n j t = 1 -w j t r t + w j t µ r,j t -c j t dt + w j t σ q,σ t dZ σ t + w j t σ t + σ q,k t dZ k ,
where n j t is the wealth of agent j, c j t = c j t /n j t his consumption rate, and the portfolio weight w j t are choice variables. Z σ t and Z k t are two standard Brownian motions that hit aggregate volatility and capital growth respectively.

Technology The production technology in the economy is given by:

y j t = a j -◆ j t k j t and dk t k t =Φ(◆ t ) dt + σ t dZ k t ,
where Φ(•)i sac o n c a v ei n v e s t m e n tf u n c t i o n . T h ep r i c eo fau n i to fc a p i t a li sq t . The volatility of capital returns follows a diffusion:

dσ t σ t =  σ t -s σ dt + &dZ σ t . (4.22)
The stochastic law of motion of q t follows:

dq t q t = µ q t dt + σ q,σ t dZ σ t + σ q,k t dZ k t .
The variables µ q t , σ q,k t ,a n dσ q,σ t are to be determined endogenously. We can use Ito's lemma to write the process of the value of capital:

d(q t k j t ) q t k j t = Φ t + µ q t + σ t σ q,k t dt + σ q,σ t dZ σ t + σ t + σ q,k t dZ k .
Hence, the return on physical asset is:

dr j t = ✓ a j -◆ t q t +Φ t + µ q t + σ t σ q,k t ◆ | {z } µ r,j t dt + σ q,σ t dZ σ t + σ t + σ q,k t dZ k .
Solving the HJB We will guess and verify that the homotheticity of preferences allows us to write the value function for agents of type j as:

U n j t ,⇠ j t = n j t 1-γ ⇠ j t 1 -γ , (4.23)
where variable ⇠ j t follows

d⇠ j t ⇠ j t = µ ⇠,j t dt + σ ⇠,σ,j t dZ σ t + σ ⇠,k,j t dZ k t .
We can write the HJB equation corresponding to the problem of agent j as 0= max

c j t ,◆ j t ,w j t f c j t n j t ,U j t (4.24) + 1 -w j t r t + w j t µ r,j t -c j t n j t U n (n j t ,⇠ j t )+µ ⇠,j t ⇠ j t U ⇠ (n j t ,⇠ j t ) + 1 2 h w j t σ q,σ t n j t 2 + w j t σ t + σ q,k t n j t 2 i U nn (n j t ,⇠ j t ) + 1 2 h σ ⇠,σ,j ⇠ j t 2 + σ ⇠,k,j ⇠ j t 2 i U ⇠⇠ (n j t ,⇠ j t ) +  w j t σ q,σ t n j t σ ⇠,σ,j t ⇠ t + w j t σ t + σ q,k t n j t σ ⇠,k,j t ⇠ j t U n⇠ (n j t ,⇠ j t ).
Substituting the guess from equation (4.23), the HJB becomes 0= max

c j t ,◆ j t ,w j t 1 1 -1/⇣ 2 4 c j t 1-1/⇣ ⇠ j t 1-1/⇣ 1-γ -⇢ 3 5 +(1-w j t )r t + w j t µ r,j t -c j t + µ ⇠,j 1 -γ (4.25) - γ 2 w j t σ q,σ t 2 - γ 2 w j t σ t + w j t σ q,k t 2 + w j t σ q,σ t σ ⇠,σ,j t + w j t σ t + σ q,k t σ ⇠,k,j t .
Optimality Conditions The first order conditions with respect to c j t ,◆ j t ,a n dw j t are given by

c j t -1/⇣ = ⇠ j t 1-1/⇣ 1-γ , 1/q t =Φ ◆ (◆ t ), µ r,j t -r t -γw j t σ q,σ t 2 -γw j t σ t + σ q,k t 2 + σ q,σ t σ ⇠,σ,j t + σ t + σ q,k t σ ⇠,k,j t =0.
Plugging in the optimality conditions in the HJB gives:

0= 1 1 -1/⇣ c j t -⇢ + r t -c j t + γ 2 w j t σ q,σ t 2 + γ 2 w j t σ t + w j t σ q,k t 2 + µ ⇠,j 1 -γ . (4.26)
Market Clearing Conditions We can use the market clearing condition for consumption to find q t :

c i t ⌘ t + c h t (1 -⌘ t ) q t = t (a i -◆ t )+(1-t )(a h -◆ t ),
where t ⌘

w i t n i t w i t n i t + w h t n h t = w i t ⌘ t ,
and the market clearing condition for capital to find r t :

w i t ⌘ t + w h t (1 -⌘ t )=1.
Numerical Procedure We want to solve the mo del recursively in a minimal number of state variables summarizing time variations in the equilibrium. We start by providing the definition of such an equilibrium in the state variables {⌘ t ,σ t }, where ⌘ t is defined as the share of wealth in the hands of the intermediaries:

⌘ t = n i t n h t + n i t = n i t q t k t .
We can therefore use Ito's lemma to write the law of motion of ⌘ t as:

d⌘ t ⌘ t = ✓ r t + w i t (µ r,j t -r t ) -c i t -Φ t -µ q t -σ t σ q,k t (4.27) -! i t (σ q,σ t ) 2 +(σ q,σ t ) 2 + ⇣ σ t + σ q,k t ⌘ 2 -w i t ⇣ σ t + σ q,k t ⌘ 2 ◆ dt + w i t -1 σ q,σ t dZ σ t + w i t -1 σ t + σ q,k t dZ k .
Definition 21 A Markov Equilibrium in {⌘, σ} is a set of functions q(⌘, σ), (⌘, σ), r(⌘, σ), w i (⌘, σ), w h (⌘, σ), ◆(⌘, σ) , c i (⌘, σ), c h (⌘, g), ⇠ i (⌘, σ) and ⇠ h (⌘, σ) and diffusions µ ⌘ (⌘, σ), σ ⌘ (⌘, σ), µ q (⌘, σ), σ q (⌘, σ) such that:

1. ⇠ i and ⇠ h solve their respective HJB equations (4.26).

2. Taking prices q, r and the law of motion of ⌘ and q as given, policy variables w i , w h , ◆, c i , c h solve their respective optimization problems.

3. Law of motions for the state variables ⌘ and σ are given by (4.22) and (4.27).

We can now solve the model according to algorithm 3.T h ep r o c e d u r ew o r k si n two steps. At each iteration, we first solve for all equilibrium variables recursively in the state variables and then iterate on the value function multiplier. The key for this second step is to use the finite difference approximation that preserves the monotonicity of the HJB equation as described in section 4.4.S i n c ew eg e tµ ⇠,j from (4.26), we can apply the method of finite difference to

⇠ j (⌘ t ,σ t )µ ⇠,j t = ⇠ j σ (⌘ t ,σ t )µ σ t σ t + ⇠ j ⌘ (⌘ t ,σ t )µ ⌘ t ⌘ t + 1 2 ⇠ j σσ (⌘ t ,σ t ) &σ t 2 + 1 2 ⇠ j ⌘⌘ (⌘ t ,σ t ) h ! i t -1 σ q,σ t ⌘ t 2 + ! i t -1 σ t + σ q,k t ⌘ t 2 i + ⇠ j σ⌘ (⌘ t ,σ t )&σ t ! i t -1 σ q,σ t ⌘ t + ⇠ j t (⌘ t ,σ t ).
By applying Ito's lemma, we can find σ q,σ t , σ q,k t , σ ⇠,σ,j t , σ ⇠,k,j t ,a n dµ q t from:

q(σ t ,⌘ t )σ q,σ t = q σ (σ t ,⌘ t )&σ t + q ⌘ (σ t ,⌘ t ) w i t -1 σ q,σ t ⌘ t , q(σ t ,⌘ t )σ q,k t = q ⌘ (σ t ,⌘ t ) w i t -1 σ t + σ q,k t ⌘ t , ⇠ j (σ t ,⌘ t )σ ⇠,σ,j t = ⇠ j σ (σ t ,⌘ t )&σ t + ⇠ j ⌘ (σ t ,⌘ t ) w i t -1 σ q,σ t ⌘ t , ⇠ j (σ t ,⌘ t )σ ⇠,k,j t = ⇠ j ⌘ (σ t ,⌘ t ) w i t -1 σ t + σ q,k t ⌘ t , q(σ t ,⌘ t )µ q t = q σ (σ t ,⌘ t )µ σ t σ t + q ⌘ (σ t ,⌘ t )µ ⌘ t ⌘ t + 1 2 q σσ (σ t ,⌘ t ) &σ t 2 + 1 2 q ⌘⌘ (σ t ,⌘ t ) h ! i t -1 σ q,σ t ⌘ t 2 + ! i t -1 σ t + σ q,k t ⌘ t 2 i + q σ⌘ (σ t ,⌘ t )&σ t ! i t -1 σ q,σ t ⌘ t .
These partial derivatives of q(σ, ⌘)a l s oh a v et obea p p r o x i m a t e dt ofi n dt h ee q u ilibrium solution of the static system. We recommend starting from one corner of the grid and iterate on the two-dimensional grid using backward approximations for all derivatives in order to limit the propagation of errors to the system. On the borders of the two-dimensional grid, we recommend approximating the derivative by taking the derivative of the next point instead of using a forward approximation.

Algorithm 3 Implicit Euler for Two-Dimensional General Equilibrium Model 1. Define a finite grid over the state variables ⌘, σ and set guess for ⇠ i n and ⇠ h n at the initial iteration n =0.

2. Given ⇠ i n and ⇠ h n solve for all equilibrium variables q(⌘, σ), (⌘, σ), r(⌘, σ), w i (⌘, σ), w h (⌘, σ), ◆(⌘, σ) , c i (⌘, σ), c h (⌘, g), ⇠ i (⌘, σ) and ⇠ h (⌘, σ) and diffusions σ q,σ (⌘, σ), σ q,k (⌘, σ), σ ⇠,σ,j (⌘, σ), σ ⇠,k,j (⌘, σ), and µ q (⌘, σ) using first order conditions and market clearing conditions. One can solve this nonlinear system of equation using a Newton-Raphson method. 63. Solve for the next iteration of ⇠ i n+1 and ⇠ h n+1 using the method described in Section 4.4.2.

Iterate on 2-3 until convergence.

We apply the algorithm to solve the model globally on a 20 ⇥ 40 in (σ, ⌘)g r i d with time steps ∆t =0.05 in 82 seconds on a 2017 MacBook pro with a margin of error of 1e -4 . We provide in Figure 4.2 the solution of the model solve with the algorithm.

Conclusion to the Chapter

In this article, we provide a fast method to solve globally for any continuous time macro-economic model with Brownians shocks and up to two endogenous (and correlated) state variables. Due to its speed, generality, and robustness, this method opens doors for further research in macroeconomics and asset pricing. For instance, it could be used to solve models with banks with interest for monetary policy or more complex asset pricing model involving heterogeneous agents, financial frictions, and production. The speed of the method also makes it possible to run estimations on the global model without linearization and capture complex amplification dynamics.

For shadow bankers:

0= c -⇢ 1 -1/⇣ + a q +Φ-γσ(w s σ + σ ⌧ )+1/2γ(w s σ) 2 -1/2γ(σ ⌧ ) 2 +1/2γ(w d ✓) 2 -c + µ ⌧ For households: 0= c h -⇢ 1 -1/⇣ + r d -c h
We solve for endogenous equilibrium portfolio choices. First, we rewrite equation ( 2.13)a s :

r d = a q +Φ-γσ(w s σ + σ ⌧ ) -γ✓ 2 σ d σ d w d -w m
and similarly for shadow banks:

r d = a q +Φ-γσ(w s σ + σ ⌧ ) -γ✓ 2 w d σ d 2
Capital Market Clearing We then equalize the two equations:

σ(w s σ + σ ⌧ )+✓ 2 σ d σ d w d -w m = σ(w s σ + σ ⌧ )+w d σ d ✓ 2
After some algebra, we have:

w s (σ 2 +(σ d ✓) 2 )=w s (σ 2 +(σ d ✓) 2 )+w s (σ d ✓) 2 -w m ✓ 2 σ d +(σ d ) 2 (✓ 2 -✓ 2 )+σ(σ ⌧ -σ ⌧ )
Note that since we have:

w s = w s σ 2 +(σ d ✓) 2 σ 2 +(σ d ✓) 2 + w s (σ d ✓) 2 -w m ✓ 2 σ d +(σ d ) 2 (✓ 2 -✓ 2 )+σ(σ ⌧ -σ ⌧ ) σ 2 +(σ d ✓) 2 ,
any transfer rule such that σ ⌧ = σ ⌧ renders asset purchases neutral in the absence of liquidity risk.

For parsimony, let's define  w =1/ w ,  = / w such that:

w s = w s σ 2 +(σ d ✓) 2 σ 2 +(σ d ✓) 2 + w s (σ d ✓) 2 -w m ✓ 2 σ d +(σ d ) 2 (✓ 2 -✓ 2 ) σ 2 +(σ d ✓) 2 =  w w s + 
From the securities market clearing condition, we have:

w⌘ + w⌘ + w s ⌘ =1,
which gives:

w s = 1 -w s ⌘ + ⌘  w ⌘ + ⌘ .
Consumption Market Clearing The consumption market clearing equation is given by:

c⌘ + c⌘ + ✓ ⇢ 1/⇣ -r d 1 -1/⇣ 1/⇣ ◆ (1 -⌘ -⌘)= a q
After some algrebra:

(c⌘ + c⌘) 1/⇣ 1 -1/⇣ = a q ✓ 1/⇣ +(1-⌘ -⌘)(1 -1/⇣) 1 -1/⇣ ◆ - ✓ ⇢ 1 -1/⇣ -Φ -γσ(w s σ + σ ⌧ ) -γ✓ 2 σ d σ d w d -w m ◆ (1 -⌘ -⌘)
HJBs We can plug all derived variables into the respective HJB equations and take the sum of the three of them:

0= a q 1 1 -1/⇣ - ⇢ 1 -1/⇣ +Φ-γσ(w s σ + σ ⌧ ) -γ✓ 2 σ d σ d w d -w m (1 -⌘ -⌘) -γ✓ 2 σ d σ d w d -w m ⌘ + γw d σ d ✓ 2 ⌘ + ⇣ 1/2γ✓ 2 σ d w d -w m 2 +1/2γ(w s σ) 2 -1/2γ(σ ⌧ ) 2 + µ ⌧ ⌘ ⌘ + ⇣ 1/2γ✓ 2 σ d w d 2 +1/2γ(w s σ) 2 -1/2γ(σ ⌧ ) 2 + µ ⌧ ⌘ ⌘
Recall that the transfer rules are defined as:

σ ⌧ = σw s ⌘ ⌘ + ⌘ µ ⌧ ⌘ = r b -r m (w m -w s )⌘ + ⌘ ⌘ + ⌘ µ s -r d w s ⌘ + r d -r m w s ⌘ µ ⌧ ⌘ = ⌘ ⌘ + ⌘ µ s -r d w s ⌘

Asset Purchase Policy

We proceed to solve for the price given an asset purchase policy-that is, ✓ = ✓ and w s = w m -and simplify by assuming that σ d =1. Th usw s = w s = 1-w s ⌘ ⌘+⌘ and the combined HJB equation becomes:

0= a q 1 1 -1/⇣ - ⇢ 1 -1/⇣ +Φ-1/2γw s σ 2 -1/2γ✓ 2 σ d σ d w d -w m (1 -⌘)+1/2γw d σ d ✓ 2 ⌘ +1/2γ ✓ 2 (w m ) 2 ⌘ -✓ 2 σ d w d w m ⌘ -w s σ 2 w s ⌘ + γ✓ 2 (σ d w d -w m )w m ⌘ + γσ(w s σ + σ ⌧ )w s ⌘ -1/2γσ 2 ✓ w s ⌘ ⌘ + ⌘ ◆ 2 (⌘ + ⌘) -γσ 2 ✓ w s ⌘ ⌘ + ⌘ ◆ ,
where w s n = ⌫qS. After some algebra, we can solve for q:

q = a ⇢ -(1 -1/⇣) ⇣ Φ -1/2γ σ 2 ⌘+⌘ -1/2γ✓ 2 (1-⌘-⌘-⌫) 2 ⌘+⌘ ⌘

Liquidity Injection Policy

Similarly, we proceed to solve for the price given a constant liquidity injection policy-that is, ✓ = ✓ and w s =0 -a n ds i m p l i f yb ya s s u m i n gt h a tσ d =1 . T h u s

w s = w s = 1-w s ⌘ ⌘+⌘ such that w s = 1 ⌘ + ⌘ + w m ✓ 2 σ 2 + ✓ 2 ⌘ ⌘ + ⌘ w s = 1 ⌘ + ⌘ - w m ✓ 2 σ 2 + ✓ 2 ⌘ ⌘ + ⌘ .
The aggregated HJB equation becomes:

0= a q 1 1 -1/⇣ - ⇢ 1 -1/⇣ +Φ-1/2γw s σ 2 -1/2γ✓ 2 σ d σ d w d -w m (1 -⌘)+1/2γw d σ d ✓ 2 ⌘ +1/2γ ✓ 2 (w m ) 2 ⌘ -✓ 2 σ d w d w m ⌘ -w s σ 2 w s ⌘ + γ✓ 2 (σ d w d -w m )w m ⌘ + γσ(w s σ + σ ⌧ )w s ⌘ -1/2γσ 2 ✓ w s ⌘ ⌘ + ⌘ ◆ 2 (⌘ + ⌘) -γσ 2 ✓ w s ⌘ ⌘ + ⌘ ◆
After some algebra, we can solve for q:

q = a ⇢ -(1 -1/⇣) ⇣ Φ -1/2γ σ 2 ⌘+⌘ ⇣ 1+ m 2 ✓ 2 σ 2 +✓ 2 ⌘ ⌘ ⌘ -1/2γ✓ 2 (1-⌘-⌘-m) 2 ⌘+⌘ ⌘ ,
where w m n = M = mqS. Let's not forget that these equations are valid only if m  w d =(w s -1)⌘ in the case of reserves and 0  (w s -1)⌘ in the case of QE. That is,

w m  1 ⌘ + ⌘ + w m ✓ 2 σ 2 + ✓ 2 ⌘ ⌘ + ⌘ -1 Equality arises if m = (⌘ -⌘ 2 -⌘⌘)(σ 2 + ✓ 2 ) σ 2 ⌘ + ✓ 2 ⌘ + σ 2 ⌘
which is exactly 1/2 ⇥ m ? where q(m ? )=q(0), which is consistent with the fact that the risk with no reserves is w d ✓ and the risk with m

? =2w d ⌘ is (w d -2w d ⌘)✓ = -w d ✓. Also, m = (⌘ -⌘ 2 -⌘⌘)(σ 2 + ✓ 2 ) σ 2 ⌘ + ✓ 2 ⌘ + σ 2 ⌘ =(1-⌘ -⌘) σ 2 + ✓ 2 σ 2 + ✓ 2 + σ 2 ⌘ ⌘ < 1 -⌘ -⌘

Lender of Last Resort Policy

Similarly, we proceed to solve for the price given a lender of last resort policy-that is, ✓ 6 = ✓ and w m =0-andsimplifyb yassumingthatσ d =1. Th us,

w s = σ 2 + ✓ 2 +(✓ 2 -✓ 2 )⌘ (σ 2 + ✓ 2 )⌘ +(σ 2 + ✓ 2 )⌘ w s = σ 2 + ✓ 2 +(✓ 2 -✓ 2 )⌘ (σ 2 + ✓ 2 )⌘ +(σ 2 + ✓ 2 )⌘
The aggregated HJB equation becomes:

0= a q 1 1 -1/⇣ - ⇢ 1 -1/⇣ +Φ-1/2γw s σ 2 -1/2γ✓ 2 σ d σ d w d (1 -⌘)+1/2γw d σ d ✓ 2 ⌘.
After some algebra, we can solve for q:

q = a ⇢ -(1 -1/⇣) Φ -1/2γσ 2 Ω(✓, ✓) -1/2γ✓ 2 Ψ(✓, ✓)
where

Ω(✓, ✓)= σ 2 +1/2(✓ 2 + ✓ 2 ) (σ 2 + ✓ 2 )⌘ +(σ 2 + ✓ 2 )⌘
prime means of settlement between banks.

4. Money market opens, and the deficit bank acquires as much of its funding gap is made possible by the amount of available collateral. In this simple example, it receives the money market funding (MM) from the surplus bank to which the deposits have been reshuffled. It does not have to be the case as the deficit bank could receive fundings from any bank in the economy in ac e n t r a l i z e dW a l r a s i a nm a r k e ta tt h er i s k -f r e er a t e .

5. If the money market desk has not been able to fill its liquidity need, it has to resort to asking for a central bank loan at the discount window (DW).

6. If for some reasons, discount window loans are not available (i.e. the bank is a shadow bank and does not have access to it, or does not have enough eligible collateral), the bank has no other choice but to sell some of its securities at a discount with respect to its fundamental value and to bear the corresponding loss in the next active period.

Upon the arrival of a funding shock on deposits, asset allocations cannot be changed and funding gaps need to be covered in the interbank money market. A quantity σ d t d t of deposits are reshuffled from a deficit bank (receiving a negative shock) to a surplus bank (receiving a positive shock).

The deficit bank receives an intra-day credit from the clearing house which allows to temporarily cover its deficit with respect to the surplus bank. Then banks meet in the interbank money market and each deficit bank is matched to a surplus bank. The deficit banks use their loans as collateral to borrow as much as possible from the surplus banks at the risk free rate r b t for a fixed period of time ∆ d corresponding to a day. 7 To cover the remaining part of the funding gap, banks need to fire-sale assets at the cost λ>0.

Importantly, negative deposit shocks can be absorbed by selling highly liquid 7 Implicitly, we assume that the rate r b t is constant over that short period of time ∆ d , that is:

Z t+∆ d t r b u du ⇡ r b t ∆ d .
Because ∆ d corresponds to a short period of time (one day) and these idiosyncratic transfers aggregate to zero, this approximation has virtually no impact on the results.

⇥ m t (r m t -r d t )∆ d + ↵ t (r b t -r d t )∆ d +(1-↵ t )λ (σ d d t -m t ) ⇤ d e Z t .
We further assume that these transfers of wealth are instantaneous instead of lasting from t to t +∆ d such that we do not have to keep track of the distribution of idiosyncratic shocks. The fraction of the funding gap covered by a loan `t on the collateralized money market ↵ t is given by

↵ t =min ⇢ `t σ d d t -m t , 1 .
Note that if λ =0a n dr m t = r b t = r d t ,t h ed e p o s i ts h o c kd o e sn o ti m p a c tb a n k s ' net worth.

To b orrow `t on the collateralized money market, we impose a value-at-risk constraint. The annualized probability that the collateral value becomes lower than the value of loan `t has to be at most p. 8 The quantity of collateral χ t 8 Recall that the value-at-risk constraint is evaluated assuming that the drift µ s t and volatility σ s t are constant. That is, bankers approximate

P  χ t exp ✓Z t+1 t (µ s u -(σ s u ) 2 /2)du + Z t+1 t σ s u dZ u ◆  `t = p
required to borrow `t in the interbank market has to satisfy:

P ⇥ χ t exp µ s t -(σ s t ) 2 /2+σ s t (Z t+1 -Z t )  `t⇤ = p. ( .28)
Thus, if a fraction  χ of the securities held by the bank can be used as collateral, the quantity of available collateral is given by

χ t =  χ q t s t . ( .29)
Combining (.28)a n d( .29), the maximum amount that can be borrowed on the collateralized money market is given by:

`t =  t q t s t , where  t =  χ exp Φ -1 (p) σ s t + µ s t -(σ s t ) 2 /2 .
with equation (.28). Also, for parsimony, we do not keep track of the distribution of collateral amongst banks.

After a little bit of algebra, we can rearrange these to find the expressions in (3.1), (3.2) and (3.3).

Note that this last expression is a quadratic equation in σ

t : 0=[γw t σ qt -(1 -γ)σ ⇠t -σ qt -1] +[(g t )γw t σ qt +(1-γ)σ ⇠t (g t )+γw t -(g t )σ q t ] σ t +[(g t )γw t ] σ 2 t
The optimal solution for σ t consists in the upper root of this expression:

σ t = -( t σ qt (γw t -1) + γw t - t σ ⇠t ) 2γ t w t + p (- t σ qt (γw t -1) -γw t +  t σ ⇠t ) 2 +4γ t w t (-σ qt (γw t -1) + σ ⇠t +1) 2γ t w t
Proof of Proposition 21 We find the parameters of the diffusions (µ q t , σ q t , µ d t and σ d t ) endogenously for the two states variables by applying Ito's lemma. First, note that the law of motion of n j t is given by:

dn j t n j t = r t dt + w j t (σ j t + σ q t ) & j t dt + dZ t -c j t dt
The low of motion for aggregate efficient capital k t is:

dk t k t =Φ t dt + σ t dZ t
The law of motion of q t k t is therefore given by: 1. Ce coût peut être justifié de façons diverses. Il est généralement admis par la littérature qu'il existe un bénéfice à une détention privée des actifs risqués afin d'obtenir une meilleure allocation du capital Dans ce cas, si ces coûts sont croissants, il est possible que l'effet négatif sur la production finisse par dominer l'effet de réduction du risque de liquidités (ligne bleue). L'utilisation de cet outil de politique monétaire non conventionnelle doit donc se juger àl ' a u n ed el ' é q u i l i b r ee n t r ec e sd e u xe ff e t se ts e r ad ' a u t a n tp l u se ffi c a c ee tn é c e s s a i r e que le secteur bancaire parallèle est large et les coûts macroéconomiques engendrés sont faibles.

d(q t k t ) q t k t =(Φ t + µ q t + σ t σ q t ) dt +(σ t + σ q t )
Ce chapitre fournit donc une formalisation de l'argument selon lequel la crise a poussé les banques centrales à prendre leurs responsabilités en tant que pourvoyeur de liquidités en dernier ressort pour le secteur bancaire parallèle qui s'est développé dans les années précédant la crise hors de leur portée, avec des avantages potentiels pour la stabilité financière [START_REF] Mehrling | The New Lombard Street -How the Fed Became the Dealer of Last Resort[END_REF]. Lorsque nous avons au moins deux variables d'état corrélées, le problème est plus complexe car la direction préservant la monotonicité peut se trouver à l'intérieur de l'espace d'état mais pas nécessairement sur un point de la grille discrète. Dans ce cas, nous utilisons la méthode développée par Bonnans, Ottenwaelter, et Zidani (2004) consistant à utiliser un degré de liberté disponible dans le problème d'interpolation afin de créer une rotation dans l'espace d'état dans un temps de calcul réduit. Cette méthode de décomposition du stencil permet de préserver la stabilité numérique de notre algorithme tout en nous permettant d'utiliser des étapes d'itération de tailles larges afin de réduire le temps de convergence.

La décomposition du stencil proposée est cependant problématique pour les 9 points de la grille qui sont trop proches de la limite. Si la taille du stencil décomposé est de taille P>1,i ls epe u tq u el ad é c o m po s i t i o nd us t e n c i ln é c e s s i t ed ' u t i l i s e r un point qui est potentiellement au-delà de la grille. Par conséquent, pour les points trop proches de la frontière de sorte que, pour l'une quelconque des dimensions, on impose que la dérivée du second ordre soit égale à celle du point le plus proche de la grille qui ne soit pas trop proche de la frontière.

Enfin, nous devons également traiter les non-linéarités découlant de la partie régulée de l'équation HJB. Nous suivons ici la suggestion de [START_REF] Candler | Finite-Difference Methods for Continuous-Time Dynamic Programming in Computational Methods for the Study of Dynamic Economies[END_REF]

  n o rar e d i s t r i b u t i o no fr i s k st ot h eh o u s e h o l ds e c t o rt h r o u g ht h e balance sheet of the central bank as in He and Krishnamurthy (2013a)a n dSilva

Figure 2 . 1 :

 21 Figure 2.1: Balance Sheets of Agents in the Model. K represents aggregate capital, S pooled securities, q the price, N net worth, D deposits, M central bank reserves and B long-term loans from the central bank to the bankers.

Figure 2 . 2 :

 22 Figure 2.2: The figure displays how securities prices and net interest margin react to a change money market frictions as a function the wealth of the banking sector: benchmark with ↵ = 1 in black, ↵ =0 .7 in blue, and ↵ =0 .05 in red. The other parameters are set according to: a =0.05, ⇢=0.03, ⇣ -1 =0.7, Φ=0.02, γ =1.1, σ=0.03, λ =0.5.

Figure 2 .Figure 2 . 3 :

 223 Figure 2.3 illustrates how the size of the shadow banking sector is playing a role in determining where the liquidity satiation threshold is located. The black line

Figure 2 . 4 :

 24 Figure 2.4: The figure displays securities prices, stocks of liquidity risk, and the convex cost of central bank management as a function of central bank share of securities holdings: benchmark without funding liquidity risk in black (↵ = 1); without convex cost in red (Γ(⌫) = 0, ↵ =0 .7); with a quadratic convex cost in blue (Γ(⌫)=0 .015 ⇥ ⌫ 2 , ↵ =0 .7). The other parameters are set according to: a=0.05, ⇢=0.03, ⇣ -1 =0.7, Φ=0.02, γ =1.1, σ =0.3, λ =0.5, ⌘ =0.2 and, ⌘ =0.2.

Figure 2 . 6 :

 26 Figure 2.6: The figure shows the amplification mechanism when ↵ t is fixed to 1 (blue line) and ↵ t is endogenous (red line). The three panels display the model solution for the price of securities q t , the endogenous volatility σ q t and the index of money market functioning ↵ t as a function of the total share of wealth in hands of regular and shadow banks eta t + ⌘ t along the diagonal line ⌘ t = ⌘ t .

  Figure 2.7: The figure displays the impulse response function for a 30% drop in the wealth of regular and shadow bankers. More precisely, starting from the stochastic steadystate, we plot the average impulse response functions for q t , σ q t ,a n d↵ t after a shock to securities dZ t that destroys 30% of the stock of securities. The blue line corresponds to a no monetary policy benchmark. The red line corresponds to the shock accompanied by an increase of reserves from m =0t om =0 .5 (liquidity injection policy). The yellow line corresponds to the same rise in reserves accompanied by an increase in central bank asset purchases from ⌫ =0to⌫ =0.25 (liquidity injection policy and asset purchase policy).

  )d e v e l o p sam o d e li nw h i c ht h es u r g ei nc o r p o r a t e default probability increases the value of tangible capital and depresses productive intangible investment.[START_REF] Anzoategui | Endogenous technology adoption and R&D as sources of business cycle persistence[END_REF]calibrate a model where the value of an investment in technology decreases following a persistent output gap. Queralto (2013)p r o p o s e sam o d e li nw h i c hfi n a n c i a lf r i c t i o n s surge during a financial crisis and lower the growth rate of productivity. The main difference with respect to these articles is the focus on the role of the financial sector to absorb aggregate risk.

Figure 3 . 1 :

 31 Figure 3.1: Price dividend ratios q/a, risk free rate r, return on efficient capital µ R , Sharpe ratio &, technological risk σ and rate of technological diffusion Φ as a function the risk aversion parameter γ when σ and Φ are endogenous (solid) and the exogenous Lucas Tree benchmark (dashed) when wealth effect dominates $ =0.8.

Figure 3 . 2 :

 32 Figure 3.2: Price dividend ratios q/a, risk free rate r, return on efficient capital µ R , Sharpe ratio &, technological risk σ and rate of technological diffusion Φ as a function the risk aversion parameter γ when σ and Φ are endogenous (solid) and the exogenous Lucas Tree benchmark (dashed) when substitution effect dominates $ =1.2.

Figure 3 . 3 :

 33 Figure 3.3: On the first line, portfolio weights of intermediaries w i and households w h as well as the aggregate risk aversion γ as a function of ⌘. On the second, equilibrium optimal technological risk σ, rate of technology diffusion φ and Sharpe ratio & as a function of ⌘ respectively for g =0.2 (dashed) and g =0.3( f u l l )

Figure 3 . 4 :

 34 Figure 3.4: Phase diagram. The chart shows the deterministic part of the law of motion of the two state variables: the distance to the technological frontier g and the proportion of wealth in the hand of intermediaries ⌘.

Figure 4 . 1 :

 41 Figure 4.1: Solving the Advection equation 4.8 with different approximations. The first three panels display the result of solving for the movement of the wave equation across time using three different approximations to the space derivative. The last panel shows the exact analytical solution of the problem moving from the left to the right. Each line of a different color is the solution (exact or approximated) at a given point in time.

Σ = σ 11 σ 12 σ 21 σ 22 !

 22 where σ 12 = σ 21 . When a covariance matrix is diagonal dominant, we have the well-known decomposition Σ =(σ 11 -|σ 12 |)

Figure . 3 :

 3 Figure .3: Sequence of Balance Sheet Adjustments

L

  'injection de réserves et la réduction du coût de l'emprunt auprès du guichet d'escompte en urgence contribuent à atténuer le risque de liquidits dans le secteur bancaire traditionnel, mais ne parviennent pas à atteindre le secteur bancaire parallèle. Dans cette situation, la banque centrale peut acheter et détenir directement des actifs illiquides dans son bilan. Elle est ainsi capable de diminuer les quantités d'équilibre de risques de financement dans l'économie. Ceci est rendu possible par le fait qu'elle n'est pas exposée au risque de liquidités en raison de sa capacité à émettre des réserves qui sont toujours acceptées par les agents de l'économie comme instrument de règlement. Cette dernière forme de politique a l'avantage d'opérer à travers un canal d'équilibre général avec, par conséquent, une portée plus large. Notre analyse conclut qu'en présence d'un secteur bancaire parallèle important et des marchés monétaires perturbés, l'injection de liquidités et les politiques de prêteur de dernier ressort peuvent ne pas être suffisants pour atténuer les tensions financières. Ce résultat est visible dans la partie supérieure du graphique 1 représentant respectivement le prix des titres (à gauche) et le risque de liquidité agrégé (à droite) comme fonction d'une mesure de la quantité de réserve dans l'économie. Lorsque l'ensemble du secteur bancaire possède un accès aux opérations de liquidité de la banque centrale (ligne rouge), il est possible pour cette dernière de fournir suffisamment de liquidité aux banques afin de ramener le prix des actifs au niveau de leur valeur fondamentale (ligne noire). Ce résultat n'est cependant plus atteignable lorsque le secteur bancaire

Figure 1 -

 1 Figure 1-La figure est reproduite à partir du texte principal de la thèse à titre d'illustration de nos résultats. Nous renvoyons le lecteur intéressé à celle-ci pour une compréhension plus approfondie de sa signification.

Chapitre 2 Chapitre 3 Figure 2 -

 232 Figure 2-La figure est également reproduite à partir du texte principal de la thèse à titre d'illustration de nos résultats. Nous renvoyons le lecteur intéressé à celle-ci pour une compréhension plus approfondie de sa signification.

  *This chapter is based on a joint work circulated under the title "A Macro-Financial Model with Leveraged Intermediaries" with Matthieu Darracq-Pariès (Deputy Head of the forecasting and policy modelling division at the European Central Bank) and later extended with the support of Adrien d'Avernas (formerly UCLA Ph.D. candidate and currently Assistant Professor in Stockholm School of Economics) under the title of the chapter.

	"[Money] is a commodity subject to great fluctuations of value and
	those fluctuations are easily produced by a slight excess or a slight
	deficiency of quantity. Up to a certain point money is a necessity. If a
	merchant has acceptances to meet tomorrow, money he must and will
	find today at some price or other. And it is this urgent need of the
	whole body of merchants which runs up the value of money so wildly
	and to such a height in a great panic. On the other hand, money
	easily becomes a drug, as the phrase is, and there is soon too much of
	it."
	Bagehot (1873, p58)

  (iii) security issuance rate {◆ t }, (iv) monetary policy functions {m t ,⌫ t ,λ t } and transfer rules {σ

r b t , (ii) individual controls for regular bankers {c t ,w s t ,w m t ,w b t ,w d t }, shadow bankers {c t , w s t , w d t }, and for households {c h t },

  Definition 13 Given an initial allocation of all asset variables at t =0, an Equilibrium is a set of adapted stochastic processes for the interest rate {r t : t ≥ 0}, efficient capital prices {q t : t ≥ 0}, portfolio decisions {w h t : t ≥ 0} and {w i t : t ≥ 0}, exposures to technological change {σ h t : t ≥ 0} and {σ i t : t ≥ 0}, and consumption rate schedules {ĉ h

t : t ≥ 0} and, {ĉ i t : t ≥ 0} such that:

  central bank reserves m t .T h u s ,i ft h eb a n ki sh o l d i n gc e n t r a lb a n kr e s e r v e s ,t h e quantity to borrow in the interbank money market is reduced to σ d d tm t .T h i s idiosyncratic liquidity shock is represented using the Brownian motion d e Z t .I ti s possible to represent this shock using either a Brownian motion or a Poisson shock. Both yield similar results. The Brownian motion provides simpler analytical results while the Poisson shock is more intuitive. In the benefit of exposure, we choose the Brownian motion. We construct the Brownian motion as the limit of a sum of n shocks of size ±✓ t p ∆t with a fixed interval of time nδt as ∆t tend to zero. This implies that, upon the arrival of a deposit shock of size σ d d t p ∆t,r e s e r v e s can be reshuffled at the rate m t p ∆t and that collateral can be used at the rate χ t p ∆t. Without this assumption, as the size of the shock decreases at the rate p ∆t,a ni n fi n i t e s i m a la m o u n to fr e s e r v e sm t or collateral χ t would be sufficient to offset any deposit shock. Thus, assuming m t <σ d t d t ,t h et r a n s f e ro fw e a l t hf r o m a deficit bank to surplus bank follows:

  dZ t lors d'une crise de liquidités. À cette fin, nous proposons un modèle de macro-finance avec des banques hétérogènes dans lequel ces dernières sont soumises à un risque de liquidité de financement.La première contribution de ce chapitre est de fournir un modèle reliant le risque de refinancement au prix des actifs via le bilan des intermédiaires financiers. Dans notre modèle, les intermédiaires s'engagent dans une activité de transformation de liquidité en détenant des actifs moins liquides que leurs passifs. Après la réalisation d'un choc de financement négatif, un intermédiaire doit combler un déficit de financement (la différence entre les actifs illiquides et le besoin de financement après choc) soit en faisant acquisition de nouveau prêts sur les marchés monétaires (à un coût négligeable), soit en vendant des titres à un prix de vente au rabais (à un coût élevé). Suivant la littérature sur la mise en place opérationnelle des politiques monétaires, nous faisons l'hypothèse que la monnaie émise par la banque centrale (les réserves) est utilisée pour les règlements interbancaires. En détenant des réserves, les banques peuvent, par conséquent, réduire leur exposition au risque de refinancement.Nous démontrons comment cette utilité non pécuniaire à détenir des réserves rompt le résultat de neutralité monétaire de[START_REF] Wallace | A modigliani-miller theorem for open-market operations[END_REF] et permet aux politiques monétaires d'influencer les prix des actifs et les variables macroéconomiques en réduisant le niveau global du risque de liquidité du financement.Ce résultat s'applique à la fois aux injections de liquidités, à la politique de prêteur en dernier ressort ainsi qu'à la politique d'achat d'actifs par la banque centrale.

	caire parallèle).
	Étant donné que les intermédiaires financiers tiennent compte de leur structure de
	financement lorsqu'ils évaluent la valeur des actifs dans l'économie, une augmentation
	de ce risque de liquidité de financement a une incidence négative sur les prix des actifs
	via un mécanisme d'équilibre général.
	Nous utilisons le modèle pour étudier l'efficacité des différentes politiques moné-
	taires dans divers régimes de liquidités (selon un bon et mauvais fonctionnement des
	marchés monétaires) et sous différentes structures financières (taille du secteur ban-
	2

En raison d'une asymétrie d'information, les prêteurs sur le marché monétaire exigent de leur contrepartie qu'elle dépose un montant suffisant de titres en garantie pour sécuriser l'opération. Cette hypothèse crée deux régimes endogènes dans l'économie. En temps normal, les banques peuvent utiliser efficacement les marchés monétaires pour éviter une vente au rabais, ou « fire-sale », coûteuse de leurs actifs.

Le risque de liquidité de financement est donc faible dans ce régime et n'apparaît pas dans le prix d'équilibre des actifs à maturité longue. En période de crise, cependant, la volatilité peut forcer les appels de marge (une augmentation de la quantité de titres nécessaire pour la garantie des échanges) à devenir si élevés que le montant global des garanties disponibles est inférieur aux exigences d'accès aux marchés monétaires (un mécanisme semblable à la spirale de décote

de Brunnermeier et Pedersen, 2009)

.

  de traiter le problème comme s'il était linéaire et de relâcher la partie non linéaire à chaque itération. Nous résolvons ensuite le système dans la dimension temporelle à l'aide d'un algorithme d'Euler entièrement implicite jusqu'à la convergence. Ceci nous permet de résoudre une gamme large de modèles dans un temps record et avec un taux d'échec très faible ; en claire amélioration par rapport aux techniques communément utilisées.

This would be the case, for example, in the predatory trading model ofBrunnermeier and Pedersen (2005), in the over-the-counter valuation models ofDuffie et al. (2005) andDuffie et al. (2007), and in the limited arbitrage models ofShleifer and Vishny (2012) and[START_REF] Vayanos | Equilibrium and welfare in markets with financially constrained arbitrageurs[END_REF].

This assumption is in line with the definition of shadow banks of[START_REF] Adrian | Shadow banking regulation[END_REF]: "While shadow banks conduct credit and maturity transformation similar to traditional banks, shadow banks do so without the direct and explicit public sources of liquidity and tail risk insurance via the Federal Reserves discount window and the Federal Deposit Insurance Corporation (FDIC) insurance."

We use the term asset purchase policy rather than the more common Quantitative Easing as the latter is used ambiguously to refer to both buying long term assets (on the asset side of the central bank's balance sheet) or the corresponding extension in the supply of reserves (on the liability side).

This capital quality shock, standard in this macro-finance literature, can be interpreted as a productivity shock to firms leading to the default of a proportion of them.

We do not provide a micro-foundation for the cost of fire-sale but we refer to the large literature in which it arises either as a consequence of shift in bargaining power under a strong selling pressure (seeDuffie, Gârleanu, and Pedersen, 2005, 2007;[START_REF] Duffie | Capital mobility and asset pricing[END_REF] or asymmetry of information (seeWang, 1993;[START_REF] Malherbe | Self-Fulfilling Liquidity Dry-Ups[END_REF].

It is possible to represent this shock using either a Brownian motion or a Poisson shock. Both yield similar results, the Brownian motion yields simpler analytical results while the Poisson shock is more intuitive. In the benefit of exposition, we choose the Brownian motion. We refer to Appendix Section 4.6 for a discussion of the assumptions necessary for the equivalence between the two.

In reality, these transfers are mediated by the fiscal authority which receives dividends from the central bank and is liable for recapitalization in case of large losses. We abstract from these concerns and assume direct transfers.

A currency swap line is an agreement between two central banks to exchange currencies. They allow a foreign central bank to provide (dollar) funding to its domestic banks in case of liquidity stress in (dollar) money markets.

TAF auctions were designed such that the amount of funding available is announced in advance, which made it less likely that market participants would infer that borrowing institutions had an immediate need for funds(Carlson and Rose, 2017)

This decomposition is standard in the literature (i.e.Drechsler et al. (2017) and Di Tella (2017))

We also assume that agents value the bequest they leave exactly such that ⇢ remains unaffected by the change in  as a technical assumption.

For instance, the Fed received legal authority to pay interest on reserves in 2008. Even before this period, the interest paid by the Fed was equal to nominal zero. This would also be at odds with our assumption that r m is market determined.

The nominal world is defined by P t being the price the numeraire output and assuming that prices change deterministically such that dP t /P t = ⇡ t dt.

This result is consistent with observed heterogeneity in the implementation practices of central banks. For example, until 2011, the Federal Reserve was not providing a deposit facility to excess reserves, implicitly setting the interest on excess reserves to zero. Every adjustment in the monetary policy stance was, therefore, taking place as a shift in the spread implemented by daily adjustments in the supply of excess reserves. Conversely, since its establishment, the European Central Bank has been following a symmetrical corridor operational framework. Under this regime, the ECB sets the bounds of the corridor at a fixed 200 basis points spread and adjusts the reserve supply in order for the spread to clear halfways. In this case, the ECB implements its monetary policy stance effectively by shifting the interest on excess reserves i m t (deposited at the ECB) rather than moving the spread r b -r m .

The exact same procedure can be used for any number of state variables but making this assumption facilitates exposition at this stage.

In a later example, we will derive µ X t and σ X t using the definition of the state(s) variable(s).

We refer to[START_REF] Candler | Finite-Difference Methods for Continuous-Time Dynamic Programming in Computational Methods for the Study of Dynamic Economies[END_REF] for a the rigorous Von Neuman analysis of the dynamics.

Thomas algorithm (named after Llewellyn Thomas), is an efficient Gaussian elimination technique that can be used to invert tridiagonal matrices. See for example,[START_REF] Niyogi | Introduction to Computational Fluid Dynamics.P e a r s o nE d u c ation India[END_REF]

This equation would correspond to equation 4.5. As explained at the end of Section 4.2,w e solve our non-linear equation as if it was linear and introduce the non-linearity slowly through time iterations.

To provide a good first guess for the Newton-Raphson algorithm, we solve the nonlinear system of equation setting the derivatives of q(σ, ⌘) to 0.

In a system in a recursive equilibrium, state variables characterize the whole system such that V only moves through time as a deterministic function of other variables. Therefore, V = 0.

Acknowledgements

A Finite-Difference Approach

In this section, we provide a short introduction to FD schemes to solve systems of PDEs. In particular, we illustrate through the example of the advection equation that the direction of the FD approximation is key for the convergence of the scheme. The section is based on [START_REF] Candler | Finite-Difference Methods for Continuous-Time Dynamic Programming in Computational Methods for the Study of Dynamic Economies[END_REF]a n dTourin (2011).

Introduction to the Finite-Difference Scheme

Designing a FD scheme starts from defining a series of points (a grid) in the dimension(s) of the state variable(s). For simplicity, we assume a time t and state variable x on a grid equispaced in both time and state with a distance of respectively ∆t and ∆x between two points. Grid nodes are then referred by numbering them along the two dimensions: {t 1 ,t 2 ,...,t T } and {x 1 ,x 2 ,...,x W }. Af u n c t i o nV (t, x)e v a l u a t e da tapo i n t( n, i)o nt h eg r i di st h e n :

We recall the definition of a partial derivative with resp ect to the state variable x as: @V (t, x) @x =l i m ∆x!0 V (t, x +∆x) -V (t, x) ∆x .

Afi n i t ed i ff e r e n c ea p p r o x i m a t i o nc o n s i s t si nt h ee v a l u a t i o no ft h ep r e v i o u se xpression for a finite distance ∆x. As our grid features various points, one could potentially use different nodes to compute the approximation. In theory, a FD approximation can be done through any linear combinations of the nodes in the grid.

The most commonly used local approximations involving only two neighboring points are:

Appendices

Appendix A: Omitted Derivations

Regular Banks

We first write the Hamilton-Jacobi-Bellman (HJB) equation of the traditional bankers' problem: 0= max

Apply Ito's lemma, we have:

Deriving our guess function and substituting in the former equations, we can simplify the HJB into: 0= max

Note that the maximum function (bounding the liquidity risk to being non-negative) does not appear in the previous equations. We treat this kink by solving for the optimality conditions first when the maximum function is not binding and then when it is binding by simply setting ✓ t (w d t σ dw m )=0. W eapplythemaxim um principle, and combine the FOCs for the two regions in equations (2.5), (2.9), (2.7) and (2.10). Note that the fact that V is non-differentiable at the kink caused by the maximum function does not prevent the existence of a (viscosity) solution to the optimization problem.

Shadow Banks

The optimization problem of shadow banks is nested by the problem of regular banks (assuming that w m t = 0 and λ t = λ is fixed). Solving this problem yields the FOCs given in equations (2.6), (2.8)a n d ( 2.11).

Households

Similarly, households' problem is nested when restricted to only hold risk-free deposits as a means of saving. The unique FOC of this problem is given by equation ( 2.12).

Proofs Solving the Static Model

We guess and verify the static equilibrium by setting σ q = σ ⇠ = σ ⇠ = σ ⇠,h =0a s well as µ q = µ ⇠ = µ ⇠,h =0 . W es t a r tf r o mp l u g g i n gb a c ke a c ha g e n t ' sF O C si n t o its HJB equation.

For regular bankers:

Taking into account the market clearing for interbank claims and after some algebra, we have:

Appendix B: Micro-Foundations for Liquidity Risk

In this appendix, we provide micro-foundation for our formulation of liquidity risk depending on the functioning of money markets and central bank reserves held for precautionary motives. The environment presented here is a simplified version of [START_REF] Afonso | The over-the-counter theory of the fed funds market: A primer[END_REF]andBianchi and Bigio (2014)withthefollowing assumptions. First, the idiosyncratic deposit shock is assumed to follow a binomial distribution with even probabilities. Second, all banks are assumed to be pricetakers in money markets and are required to trade at the current risk free-rate provided there is enough collateral to do so. Third, securities can be used for settlement in the last round of the interim period but at an exogenously given discount with respect to the fundamental value of securities (its value in the active trading stage).

With the given restrictions, the model can be decomposed between two stages: the active stage and the passive stage. In the active stage, managers take their portfolio decisions in order to maximize the lifetime utility of their shareholders knowing that potential developments during the passive stage may arise. This is the period we consider in our continuous-time specification. In the passive stage, the money market desk of the bank adjusts the balance sheet following given rules in order to adjust to balance sheet identity by the end of the day. Managers, therefore, have to take portfolio decisions while taking into account the distribution of funding shocks and their potential impact on profit flows given conditions in money markets and the current monetary policy stance.

The sequence of balance sheet adjustments is described in figure .3.

1. At the time t, the two banks considered are in the active stage and decide optimally of their balance sheet (quantity of securities S, reserves holdings Ra n dd e po s i t sD ,g i v e na ni n i t i a ll e v e lo fe q u i t yE ) .

2. The passive stage starts and the funding shock reshuffles deposits from the deficit bank to the surplus bank. This creates, respectively, a liquidity deficit for some banks and a liquidity surplus for others.

Ito's lemma gives us 9 :

Taking the derivative of the guess function:

We can therefore rewrite the HJB equation as:

0= max wt,ct,σt

◆

Taking the first order conditions:

We can then use Ito's lemma to write the law of motion of ⌘ t as:

and the law of motion for g t as:

This completes the last part of the definition 21.

Proofs of Propositions 18 and 19

Let's start with the simplified system of equations σ i ⇠ = σ j ⇠ =0andσ q =0:

rewrite this last equation as:

inject in the second to find:

and plug into the former. We have:

We isolate w i in this equation as:

We guess and verify that σ i = σ h :

Which implies that:

Therefore we have:

Appendix D: Numerical Implementation

Our model consists of a system of algebraic differential equations which includes a HJB equation for every agent, FOC conditions for every agent, financial constraints for every agents, market clearing conditions and Ito formulas for postulated processes for prices and wealth multipliers. We separate the system of equations into two parts: equations that have to be solved dynamically and equations for variables that can be solved statically (assuming that we know the value of variables that have to be solved dynamically). First, we stack every equation from the static part of the system of equations together and compute analytically the gradient of the system to be able to solve it by using Newton-Raphson method. Second, using Ito's lemma and plugging in the FOC conditions back into the HJB equation, express the HJB equation for any agent at the optimum as if it was a linear PDE. More precisely, we are looking for a recursive mapping of every variable as a function of our two state variables d t and ⌘ t . Using Ito's lemma we express:

We solve for these two equations by the pro cedure describ ed in Chapter 4.

Département d'Économie

Doctorat en Sciences économiques

Essais de théorie macroéconomique et monétaire sur les conséquences des crises financières Quentin Vandeweyer Cette thèse s'inscrit dans une même lignée en adoptant la méthodologie de la finance quantitative pour étudier les questions macroéconomiques liées à la dynamique, à la distribution et au prix des risques macroéconomiques.

Chapitre 1 Dans le premier chapitre, intitulé "politiques monétaires non conventionnelles et risques de liquidité de financement", nous étudions l'efficacité de différentes politiques monétaires ayant pour objectif la stabilisation du prix des actifs