Introduction The model Solving the model Results Conclusion Solving Models With Off-The-Shelf Software – An Example Of Potential Pitfalls Associated With The Use And Abuse Of Default Parameter Settings Ric D. Herbert 1 Peter J. Stemp 2 1 Faculty of Science and Information Technology, The University of Newcastle, Ourimbah, NSW, Australia 2 Department of Economics, Monash University, Clayton East, Vic, Australia 15th International Conference on Computing in Economics and Finance, Sydney Australia, July 2009 Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Table of contents 1 Introduction 2 The model 3 Solving the model 4 Results 5 Conclusion Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Introduction This paper is part of a project we have been working on about the computational appropriateness of solution methods for dynamic macroeconomic models. There can be a temptation to rely on default settings in proprietary software to derive solutions to the model. In this paper we show that, for the solution of non-linear dynamic models, this approach can be inappropriate. Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Method We consider versions of a simple model with stable and unstable eigenvalues, so that any dynamic solution requires the calculation of appropriate “jumps” in endogenous variables. One version of the model, expressed in levels, is highly non-linear. A second version of the model, expressed in logarithms, is linear. We start by showing the results that can be derived using the default settings of a typical solver. We show that this gives unsatisfactory results for the non-linear model; and then, show how the default settings and choice of solver can be adjusted to give acceptable results. Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion The linear model (expressed in logarithms) The model is given by the following set of equations: m − p ¯ = α 1 y − α 2 ˙ (1) p y = β + (1 − γ ) n (2) ˙ = θ ( δ − γ ) n (3) n w ˙ = η ( n − ¯ n ) (4) The Greek symbols denote parameters with a positive value with 0 < γ < 1. Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Model variables y = output; n = employment; ¯ n = full employment, assumed to be constant; p = price level; m = nominal money stock, assumed to be constant; and ¯ w = wage rate. The model is shocked by a change to the money stock. Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Steady state Since this model is linear, it has a unique equilibrium which satisfies the following equations: m − p ¯ = α 1 y (5) y = β + (1 − γ ) n (6) δ − γ n = w − p (7) n = ¯ n (8) Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Calibrating the model and eigenvalues Eigenvalues η λ 1 λ 2 λ 3 0.2 2.3 -0.50 -0.34 α 1 = 1 0.5 2.3 -0.41+0.51i -0.41-0.51i α 2 = 0 . 5 10.0 2.1 -0.32+3.0i -0.32-3.0i β = 0 100.0 2.0 -0.26+9.9i -0.26-9.9i γ = 0 . 5 λ 1 indicates unstable pole δ = log(0 . 5) as η increases eigenvalues become complex and have larger imaginary θ = 1 parts η ∈ { 0 . 2 , 0 . 5 , 10 , 100 } shock to m results in p ‘jumping’ so ¯ n = 1, ¯ m = 0 . 1, ¯ m 0 = 0 economy moves on to the stable trajectory to new steady-state Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Linear Model Eigenvalues for η ∈ [ − 100 , 100]. Eigenvalues as η varies Eigenvalues as η varies 10 10 λ 1 λ 1 λ 2 λ 2 8 λ 3 λ 3 5 6 4 Imaginary part of eigenvalue Real part of eigenvalue 0 2 0 −5 −2 −4 −10 −6 −8 −15 −10 −100 −80 −60 −40 −20 0 20 40 60 80 100 −100 −80 −60 −40 −20 0 20 40 60 80 100 η η Real part on LHS, imaginary part on RHS The model has a dominant real eigenvalue greater than zero for all the values of η . As η increases above 0.2 the model becomes more oscillatory. Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Analytic solution Prices with varying η Employment with varying η Wages with varying η −0.39 1.1 −1.5 −0.395 −1.52 1.08 −0.4 −1.54 −0.405 −1.56 1.06 −0.41 −1.58 −0.415 1.04 w −1.6 p n −0.42 −1.62 1.02 −0.425 −1.64 −0.43 −1.66 1 −0.435 −1.68 −0.44 0.98 −1.7 0 5 10 15 0 5 10 15 0 5 10 15 Time Time Time The closed-form solution solved using standard matrix techniques Dynamic solution becomes more oscillatory as η increases Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion The non-linear model (expressed in levels) An equivalent model specification can be rewritten in levels as follows: � 1 � PN (1 − γ ) α 1 α 2 ˙ P = P log (9) ¯ M � θ � P (1 − γ ) N − γ ˙ N = N log (10) W � η � N ˙ = W log (11) W ¯ N The variables are as for the model above except that upper case letters denote levels. Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Steady-states There are multiple Some solutions to the steady-states with the non-linear model can be non-linear model and some are derived by using the following not economically meaningful. transformation These include the steady-state: P = exp( p ) (12) = 0 (15) P = exp( n ) (13) N ¯ N = N (16) W = exp( w ) (14) W = 0 (17) Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Two Point Boundary Value Problem The computational solution to this model can be formulated as a a two point boundary value problem written as: x ˙ = f ( t , x ) 0 < t < t f (18) g ( x (0) , x ( t f )) = (19) 0 Where f ( . ) is either the linear model, or non-linear model and g ( . ) is obtained from the steady-state equation. For each initial conditions vector c , the model has a solution x ( t ) = x ( t ; c ) which satisfies x (0; c ) = c . Substituting into equation 19 gives: g ( c , x ( t f ; c )) = 0 (20) and the problem is to solve this set of non-linear equations. Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Solving 2PBVP The common approaches to solving the problem are by shooting, finite differences or projection methods. Here we will focus on on a shooting method Shooting methods for this model require An ODE solver to generate x ( t ) = x ( t ; c ) A searcher to solve g ( c , x ( t f ; c )) = 0 The focus of this paper is on the model solver and default parameters of the solver. Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Previous Work The nonlinear model can only be solved by computational means. We focus on shooting algorithms and particularly forward (in time) and reverse shooting. In Stemp and Herbert (2006) we focussed on the oscillatory linear model ( η = 100) as it may have similar dynamics to nonlinear models. We showed that with η = 100 the choice of the ODE solver has significant impact on the likely success of shooting algorithms. In Herbert and Stemp (2009) we focussed on the nonlinear model and showed that forward-shooting is likely to solve to the ‘wrong’ solution for the nonlinear model but the ‘right’ solution for the linear model. Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion Approach We use the reverse shooting algorithm and compare the solution to the closed-form solution (expressed in levels). We use Matlab as the software environment. We consider 3 candidate ODE solvers which could typically be used for this model. We focus of η = 0 . 2 so that all eigenvalues are real. Herbert, Stemp Solving Models With Off-The-Shelf Software
Introduction The model Solving the model Results Conclusion ODE Solvers Runge-Kutta (Fehlberg method, Dormand-Prince 4/5 formula) A good robust single-step solver Solver of first choice for problem like this. (default!) Matlab ode45() function Adams-Bashforth-Moulton A multi-step solver Not normally used for a model like this as model is not computationally expensive to evaluate. Matlab ode113() function Stiff This model is not obviously stiff. (Largest eigenvalue about 4 times smallest) But stiffness could be the cause of the problems. Matlab ode115s() function Herbert, Stemp Solving Models With Off-The-Shelf Software
Recommend
More recommend