Introduction to Dynare First order approximation by itlpw9937

VIEWS: 0 PAGES: 30

									 Introduction to Dynare
First order approximation

       Michel Juillard


     November 18, 2009
DYNARE



  1. computes the solution of deterministic models (arbitrary
     accuracy)
  2. computes first and second order approximation to solution
     of stochastic models
  3. estimates (maximum likelihood or Bayesian approach)
     parameters of DSGE models
  4. computes optimal policy.
  5. performs global sensitivity analysis of a model (thanks to
     Marco Ratto’s tools)
The general problem




  Deterministic, perfect foresight, case:

                       f (yt+1 , yt , yt−1 , ut ) = 0

            y : vector of endogenous variables
            u : vector of exogenous shocks
Solution of deterministic models



    ◮   based on work of Laffargue, Boucekkine and myself
    ◮   recently much accelerated by Mihoubi
    ◮   approximation: impose return to equilibrium in finite time
        instead of asymptotically
    ◮   computes the trajectory of the variables numerically
    ◮   uses a Newton–type method
    ◮   usefull to study full implications of non–linearities
The general problem


  Stochastic case:

                     Et {f (yt+1 , yt , yt−1 , ut )} = 0

            y : vector of endogenous variables
            u : vector of exogenous shocks

                          E (ut ) = 0
                        E (ut ut′ ) = Σu
                              ′
                       E (ut uτ ) = 0         t =τ
Stochastic models




  In a a stochastic framework, the unknowns are the decision
  functions:
                          yt = g(yt−1 , ut )
  For a large class of DSGE models, DYNARE computes
  approximated decision rules and transition equations by a
  perturbation method.
First order approximation




                    yt     ˆ
                         = g (yt−1 , ut )
                           ¯     ˆ
                         = y + Ayt−1 + But

        ˆ         ¯
   with yt = yt − y .
   Method proposed by Klein (2000) and Sims (2002).
   DYNARE computes also theoretical moments and IRFs.
Second order approximation


  Two features:
    ◮   decision rules and transition functions are 2nd order
        polynomials
    ◮   departure from certainty equivalence: the variance of
        future shocks matters
  Decision rules and transition equations of the form

       ¯   ˆ              ˆ′     ˆ                ˆ′
  yt = y +Ayt−1 +But +0.5 yt−1 C yt−1 + ut′ Dut + yt−1 Fut +∆ (Σu )

  Method suggested by K. Judd, developped by C. Sims (2002),
  S. Schmitt-Grohe and M. Uribe (2003), F. Collard and M.
  Juillard (2000).
Estimation


  DYNARE estimates the structural parameters of a model based
  on a linear approximation.

                               Et {f (yt+1 , yt , yt−1 , ut ; θ)} = 0

  Estimation steps:
    1. computes the steady state
    2. linearizes the model
    3. solves the linearized model
    4. computes the log–likelihood via the Kalman filter
    5. finds the maximum of the likelihood or posterior mode
    6. simulates posterior distribution with Metropolis algorithm
    7. computes various statistics on the basis of the posterior distribution
    8. computes smoothed values of unobserved variables
    9. computes forecasts and confidence intervals
Optimal policy




                              ∞
                       max           β τ −t U (yτ , zτ , uτ )
                         zt
                              τ =t

   s.t.
                   Et {f (yτ +1 , yτ , yτ −1 , zτ , uτ )} = 0
   where U() is the objective function of the public authority and zτ
   a set of policy instruments.
Computation of first order approximation




    ◮   Perturbation approach: recovering a Taylor expansion of
        the solution function from a Taylor expansion of the original
        model.
    ◮   A first order approximation is nothing else than a standard
        solution thru linearization.
    ◮   A first order approximation in terms of the logarithm of the
        variables provides standard log-linearization.
General model


  Reparametrization for perturbation approach:

                   Et {f (yt+1 , yt , yt−1 , ut )} = 0


                             E (ut ) = 0
                          E (ut ut′ ) = Σǫ
                                 ′
                          E (ut uτ ) = 0

            y : vector of endogenous variables
            u : vector of exogenous stochastic shocks
Remarks



   ◮   The exogenous shocks may appear only at the current
       period
   ◮   There is no deterministic exogenous variables
   ◮   Not all variables are necessarily present with a lead and a
       lag
   ◮   Generalization to leads and lags on more than one period
       (2nd order approximation requires a more complicated
       algorithm)
Solution function


                               yt = g(yt−1 , ut , σ)
   where σ is the stochastic scale of the model. If σ = 0, the
   model is deterministic. For σ > 0, the model is stochastic.
   Then,

     yt+1 = g(yt , ut+1 , σ)
            = g(g(yt−1 , ut , σ), ut+1 , σ)
          F (yt−1 , ut , ut+1 , σ)
            = f (g(g(yt−1 , ut , σ), ut+1 , σ), g(yt−1 , ut , σ), yt−1 , ut )


                        Et {F (yt−1 , ut , ut+1 , σ)} = 0
Stochastic scale




                       ut+1 = σǫt+1
                      E (ǫt ) = 0
                    E (ǫt ǫ′ ) = Σǫ
                           t
                    E (ǫt ǫ′ ) = 0
                           τ

   then
                   Et ut+1 ut+1 = σ 2 Σǫ
                            ′
Steady state



                                ¯
  A deterministic steady state, y , for the model satisfies

                              ¯ ¯ ¯
                           f (y , y , y , 0) = 0

  A model can have several steady states, but only one of them
  will be used for approximation.
  Furthermore,
                           ¯      ¯
                           y = g(y , 0, 0)
First order approximation


                           ¯
   Taylor expansion around y with respect to yt−1 , ut and σ:

   Et F (1) (yt−1 , ut , σǫt+1 , σ) =

                 ¯ ¯ ¯                       ˆ
           Et f (y , y , y , 0) + fy+ gy (gy y + gu u + gσ σ) + gu σǫ′ + gσ σ

                    ˆ                      ˆ
           +fy0 (gy y + gu u + gσ σ) + fy− y + fu u
     = 0

        ˆ          ¯                                               ∂f           ∂f
   with y = yt−1 − y , u = ut , ǫ′ = ǫt+1 , fy+ =                 ∂yt+1 , fy0 = ∂yt ,
            ∂f              ∂f              ∂g              ∂g            ∂g
   fy− =   ∂yt−1 , fu   =   ∂ut ,   gy =   ∂yt−1 ,   gu =   ∂ut , gσ = ∂σ .
Taking the expectation




     Et F (1) (yt−1 , ut , σǫt+1 , σ) =
              ¯ ¯ ¯                        ˆ
           f (y , y , y , 0) + fy+ (gy (gy y + gu u + gσ σ) + gσ σ)
                    ˆ                      ˆ
           +fy0 (gy y + gu u + gσ σ) + fy− y + fu u
       =                             ˆ
            fy+ gy gy + fy0 gy + fy− y + (fy+ gy gu + fy0 gu + fu ) u
           + (fy+ gy gσ + fy0 gσ ) σ
       = 0
Recovering gy



                                             ˆ
                    fy+ gy gy + fy0 gy + fy− y = 0
  Structural state space representation:

          0 fy+       I               −fy−    −fy0     I
                             ˆ
                          gy y =                           ˆ
                                                           y
          I 0        gy                0       I      gy

  or
       0 fy+            ¯
                   yt − y            −fy−    −fy0    yt−1 − y¯
                              =
       I 0        yt+1 − y¯           0       I            ¯
                                                      yt − y
Structural state space representation




                               Dxt+1 = Ext
   with
                              ¯
                         yt − y                 yt−1 − y¯
               xt+1 =                    xt =
                        yt+1 − y¯                     ¯
                                                 yt − y

     ◮    There are multiple solutions but we want a unique stable
          one.
     ◮    Problem when D is singular.
Real generalized Schur decomposition



  Taking the real generalized Schur decomposition of the pencil
  < E , D >:

                            D = QTZ
                            E   = QSZ

  with T , upper triangular, S quasi-upper triangular, Q ′ Q = I and
  Z ′ Z = I.
Generalized eigenvalues



  λi solves
                                  λi Dxi = Exi
  For diagonal blocks on S of dimension 1 x 1:
                        Sii
    ◮   Tii = 0: λi =   Tii
    ◮   Tii = 0, Sii > 0: λ = +∞
    ◮   Tii = 0, Sii < 0: λ = −∞
    ◮   Tii = 0, Sii = 0: λ ∈ C
Applying the decomposition




               I                   I
          D           ˆ
                   gy y = E               ˆ
                                          y
              gy                  gy
    T11 T12   Z11 Z12        I
                                      ˆ
                                   gy y
     0 T22    Z21 Z22       gy
                                 S11 S12      Z11 Z12    I
                        =                                    ˆ
                                                             y
                                  0 S22       Z21 Z22   gy
Selecting stable trajectory



   To exclude explosive trajectories, one imposes

                            Z21 + Z22 gy = 0
                                   −1
                            gy = −Z22 Z21
   A unique stable trajectory exists if Z22 is non-singular: there are
   as many roots larger than one in modulus as there are
   forward–looking variables in the model (Blanchard and Kahn
   condition) and the rank condition is satisfied.
Recovering gu




                fy+ gy gu + fy0 gu + fu = 0
                gu = − (fy+ gy + fy0 )−1 fu
Recovering gσ




                        fy+ gy gσ + fy0 gσ = 0
                               gσ = 0
  Yet another manifestation of the certainty equivalence property
  of first order approximation.
First order approximated decision functions




                                ¯      ˆ
                           yt = y + gy y + gu u

                            ¯
                  E {yt } = y
                      Σy     = gy Σy gy + σ 2 gu Σǫ gu
                                      ′              ′


   The variance is solved for with an algorithm for Lyapunov
   equations.
A simple example



  A simple monetary model

         yt = Et δyt−1 + (1 − δ)yt+1 + σ(rt − πt+1 ) + ey t
         πt = Et {απt−1 + (1 − α)πt+1 + κyt + eπt }
          rt = γ1 πt + γ2 yt

  where yt is the output gap, πt , the inflation rate, rt , the nominal
  short term interest rate. All variables are in relative distance to
  the steady state.
simple.mod


  var y pie r;
  varexo e_y e_pie;

  parameters delta sigma alpha kappa gamma1 gamma2;

  delta = 0.44;
  kappa = 0.18;
  alpha = 0.48;
  sigma = -0.06;
  gamma1 = 1.5;
  gamma2 = 0.5;
A simple example (continued)
  model(linear);
  y = delta*y(-1)+(1-delta)*y(+1)
       +sigma *(r-pie(+1))+e_y;
  pie = alpha*pie(-1)+(1-alpha)*pie(+1)
        +kappa*y+e_pie;
  r = gamma1*pie+gamma2*y;
  end;

  shocks;
  var e_y; stderr 0.63;
  var e_pie; stderr 0.4;
  end;

  steady;
  check;

  stoch_simul;

								
To top