Debt-Related Models Software

Debt-Related Models Software

CHAPTER FIVE Debt-Related Models Software Contents 5.1 Introduction 5.2 Software for the Debt to GDP Ratio Models 5.3 Software for Optimal Problems R...

154KB Sizes 0 Downloads 67 Views

CHAPTER FIVE

Debt-Related Models Software Contents 5.1 Introduction 5.2 Software for the Debt to GDP Ratio Models 5.3 Software for Optimal Problems References

185 186 189 193

Software is a great combination between artistry and engineering. Bill Gates

5.1 INTRODUCTION A well-structured and efficient program gives the programmer the same sort of pleasure that an artist feels when he/she creates a new work or a mathematician gets after elegantly proving a theorem. Although the programs presented in this chapter cannot be considered as highly sophisticated, they can be used to analyze the previously considered models and will help readers to develop their own programs. The programs presented are written using MATLABÒ (see, e.g., Higham and Higham, 2000). It is obvious that programming languages oriented on special classes of problems are more efficient than general-purpose languages. MATLABÒ is one of such specialized languages, which is very useful for scientific programming. The very first version of MATLABÒ was written in the late 1970s for use in courses in matrix theory, linear algebra, and numerical analysis. MATLABÒ is a high-performance language for technical computing. MATLABÒ is fundamentally built upon a foundation of sophisticated matrix software, in which the basic data element is a matrix that does not require dimensioning. This allows users to solve many technical computing problems, especially those with matrix formulations, spending a fraction of time it would take to write programs in a scalar noninteractive language such as C or FORTRAN. MATLABÒ allows easy matrix manipulation, plotting of functions and data, implementation Applied Macroeconomics for Public Policy ISBN: 978-0-12-815632-2 https://doi.org/10.1016/B978-0-12-815632-2.00005-5

© 2018 Elsevier Inc. All rights reserved.

185

j

186

Applied Macroeconomics for Public Policy

of algorithms, creation of user interfaces, and interfacing with programs in other languages. Focused on various industry applications, MATLABÒ developed the so-called toolboxes, comprehensive collections of M-files, functions that extend the MATLABÒ environment to solve particular classes of problems in areas such as dynamic systems, control systems, neural networks, and fuzzy logic. The MATLABÒ mathematical function library includes a vast collection of computational algorithms. Software packages for modeling, simulating, and analyzing specific problems are called toolboxes. Toolboxes are comprehensive collections of MATLABÒ functions (M-files) to solve particular classes of problems. Areas in which toolboxes are available include control systems, neural networks, fuzzy logic, simulation, and many others. Toolboxes of functions useful in signal processing, optimization, statistics, finance, and a host of other areas are available from the MathWorks as add-ons to the standard MATLABÒ software distribution. The CompEcon toolbox is a set of MATLABÒ functions for solving a variety of problems in economics and finance (see Miranda and Fackler, 2002). The library functions include root finding and optimization solvers, a integrated set of routines for function approximation using polynomial, splines and other functional families, a set of numerical integration routines for general functions and for common probability distributions, general solvers for ordinary differential equations (both initial and boundary value problems), routines for solving discrete- and continuous-time dynamic programming problems, and a general solver for financial derivatives (bonds, futures, options). The programs for models written in MATLABÒ can be written in other languages such as FORTRAN, BASIC, Pascal, and C. However, for the considered economic models, MATLABÒ is preferable.

5.2 SOFTWARE FOR THE DEBT TO GDP RATIO MODELS We considered two types of the debt to GDP ratio modelsd continuous described by the first-order differential equation and discrete described by the first-order difference equation. The discrete models reflect better the existing procedure of gathering data and reporting information (by quarters or years). That is why here we present programs developed for the discrete models (see also Appendix C). Matrix representation, an initial core of MATLABÒ, explains its specifics applied to dynamic systems described by difference equations. Its for loops do

Debt-Related Models Software

187

not start from “0”, so that the initial conditions are presented, for example, as d(1,1) and the examined value at time t will be d(tþ1,1). The for loop in the below programs executes a statement or a group of statements a predetermined number of times. Its syntax is for index ¼start:injcrement:end statements

end

The default increment is 1. Listing 5.1 presents the MATLABÒ program to determine the lower limit of the debt to GDP ratio. The program corresponds to the example for 2015 data considered in Chapter 2 (see Table 2.9; in the MATLABÒ programs, we use symbols T and b instead of symbols s and b in the equations of Chapter 2). LISTING 5.1 MATLABÒ Program for the Lower Limit of the Debt to GDP Ratio function discretedebt1 r [ 0.0222; g0 [ 0.021; g1 [ 0.04; T [ 0.174; c [ 1; b [ 0.69; l3 [ 0.205; l1 [ 3.8; l2 [ 0.1;

for t [ 1:11 d(t,1) [ 0.;

end d(1,1) [ 1.01;

for t [ 1:10 d(tD1,1)[ (1D(r-g1)/(1Dg1))*d(t,1)D (1Dg1)^(-t)*(l3-l2*l3* (exp ((g1-g0)/b*t)-1)Dl1^(-1)*((1Dg1)^t-(1Dg0)^t)) - T

end

In the case of the government stimulus policy accompanied with decreased spending (see Table 2.12; h ¼ 0.02), the modification of the above program is presented in Listing 5.2. LISTING 5.2 MATLABÒ Program for the Lower Limit of the Debt to GDP Ratio Stimulus and Spending cuts function discretedebt2 r [ 0.0222; g0 [ 0.021; g1 [ 0.04; T [ 0.174; c[1; b[0.69; h [ 0.02; l3 [ 0.205; l1 [ 3.8; l2 [ 0.1;

188

Applied Macroeconomics for Public Policy

for t [ 1:11 d(t,1) [ 0.;

end d(1,1) [ 1.01;

for t [1:10 d(tD1,1)[(1D(r-g1)/(1Dg1))*d(t,1)D(1Dg1)^(-t)*((1-h)^t*l3 l2*l3*(exp((g1-g0)/0.69*t)-1)Dl1^(-1)*((1Dg1)^t (1Dg0)^t)) - T

end

The above programs allow one to analyze various scenarios: higher and lower future growth rates, interest rates on debt, and tax rates, as well as various stimulus policies characterized by the related multipliers, as it has been done in Chapter 2. Listing 5.3 presents the generalized model for the debt to GDP ratio (see Eqs. (2.41, 2.42, 2.48, and 2.49), Tables 2.16 and 2.17). LISTING 5.3 MATLABÒ Program for the Debt to GDP Ratio. Generalized Model function discretedebtgeneral g0 [ - 0.01; c [ 1; b [ 0.69; l2 [ 0.12; l30[0.2; %

h[0.02; g(1,1) [ - 0.035; g(2,1) [ 0.027; g(3,1) [ 0.019; g(4,1) [ 0.026; g(5,1) [ 0.017; g(6,1) [ 0.023; g(7,1) [ 0.0215; g(8,1) [ 0.025; g(9,1) [ 0.028; g(10,1) [ 0.08; T(1,1) [ 0.15; T(2,1) [ 0.14; T(3,1) [ 0.15; T(4,1) [ 0.15; T(5,1) [ 0.17; T(6,1) [ 0.17; T(7,1) [ 0.18; T(8,1) [ 0.18; T(9,1) [ 0.18; T(10,1) [ 0.18; r(1,1) [ 0.0321; r(2,1) [ 0.0307; r(2,1) [ 0.0305; r(3,1) [ 0.0224; r(4,1) [ 0.0248; r(5,1) [ 0.0242; r(6,1) [ 0.0222; r(7,1) [ 0.0222; r(8,1) [ 0.022; r(9,1) [ 0.022; r(10,1) [ 0.022; l1(1,1) [ 3.8; l1(2,1) [ 3.8; l1(3,1) [ 3.8; l1(4,1) [ 3.8; l1(5,1) [ 3.8; l1(6,1) [ 3.8; l1(7,1) [ 3.8; l1(8,1)[2.5;l1(9,1)[1.5; l1(10,1)[1.; l3(1,1)[0.24; l3(2,1)[0.23; l3(3,1)[0.23; l3(4,1)[0.22; l3(5,1)[0.21 13(6,1)[0.2; l3(7,1)[0.21; l3(8,1)[0.21; l3(9,1)[0.2; l3(10,1)[0.2;

for t [ 1:11 d(t,1) [ 0; g1(t,1) [ 0;

end

Debt-Related Models Software

189

d(1,1) [ 0.624; g1(1,1)[1Dg(1,1);

for t [ 1:9 g1(tD1,1) [ g1(t,1)*(1Dg(tD1,1));

end for t [ 1:10 d(tD1,1) [ (r(t,1)D1)/(1Dg(t,1))*d(t,1)D g1(t,1)^(-1)* (l3(t,1)el30*c*l2*((g1(t,1)/(1Dg0)^t)^(1/b) e1) D l1(t,1)^(-1)*(g1(t,1) - (1Dg0)^t)) - T(t,1) % decreased spending; d(tD1,1) [ (r(t,1)D1)/(1Dg(t,1))*d(t,1)D g1(t,1)^(-1)*(l30* (1-h)^t - l30*c*l2*

%

((g1(t,1)/(1Dg0)^t)^(1/b) - 1))D l1(i,1)^(-1)*(g1(t,1)(1Dg0)^t)) - T(t,1)

%

end

Here two cases covered by Listing 5.1 and Listing 5.2 are combined in one program. For the case when the stimuli are accompanied with the government spending cuts, the symbol “%” that excludes a certain line from the program should be deleted from the line h ¼ 0.02 and the last several lines of the last for loop. The for loop for g1(t,1) determines t þ1 Y ðgi þ 1Þ. To simplify the above programs for the case of a conditionally i¼0

balanced budget does not present any difficulties.

5.3 SOFTWARE FOR OPTIMAL PROBLEMS Although MATLABÒ developed several toolboxes related to various control problems, including optimal control theory applications (Symbolic Math Toolbox can be used to solve optimal problems; RIOTS_95, a group of programs and utilities, written mostly in C, Fortran, and M-file scripts, is designed as a toolbox for MATLABÒ), in the below programs we present in detail all procedures of solving the considered optimal control problems. The optimal problems of Chapter 3 deal with the debt D and the debt to GDP ratio optimizing the chosen performance index. Their specifics are that the coefficient c of the optimized function should be chosen to satisfy a certain terminal condition. Because the debt and debt to GDP ratio dynamics are described by different equations, the Riccati equations W are different.

190

Applied Macroeconomics for Public Policy

Listing 5.4 and Listing 5.5 present the optimal solution for the debt D and the debt to GDP ratio d, respectively (see Eqs. (3.25e3.27 and 3.31e3.33)). LISTING 5.4 MATLABÒ Optimal Debt Reduction Strategy function debt_optimal; c [ 14.5; r [ 0.0224; g [ 0.03;

for q [ 1:10 D(q,1) [ 0; W(q,1) [ 0;

end for m [ 1:9 i [ 10 - m; W(10,1) [ 1; W(i,1) [ (1Dr)^2*W(iD1,1)*(1D1/c * W(iD1,1))^(-1);

end D0 [ 16.6; d0 [ 0.99; D(1,1) [ [(1Dr)-(cDW(1,1))^(-1)*(rD1)*W(1,1)]*D0 d(1,1) [ (1Dg)^(-1)*(1Dr)*[1-(cDW(1,1))^(-1)*W(1,1)]*d0

for t [ 1:9 D(tD1,1) [ [(1Dr)-(cDW(tD1,1))^(-1)*(rD1)*W(tD1,1)]*D(t,1) d(tD1,1) [ (1Dg)^(-1)*(1Dr)*[1- (cDW(tD1,1))^(-1)*W(tD1,1)]* d(t,1)

end

The above program uses the 2012 data. In contrast to Listings 5.1e5.3, here the for loops index t ¼ 1:9 because we determined separately D(1,1) and d(1,1) based on the initial conditions D0 and d0. The expressions for the debt to GDP ratio are included in the program because in Chapter 3 we calculated also the value d(10,1)dthe debt to GDP ratio under the optimal debt reduction law. The indicated c value corresponds to the $4 trillion debt reduction condition in 10 years (see Table 3.1). For the 2014 and 2015 debt data, the coefficient c is different. Simulation results are given in Tables 3.2 and 3.3. It was found by iterations that are not included in the program. The program can be easily enhanced to automatize this search (e.g., by using Fibonacci search or GausseSeidel method).

Debt-Related Models Software

191

LISTING 5.5 MATLABÒ Optimal Debt to GDP Ratio function debtratio_optimal; r [ 0.0224; g [ 0.03; c [ r^(-1) ;

for q [1:10 d(q,1) [ 0; W(q,1) [ 0;

end for m [ 1:9 i [ 10 - m; W(10,1)[1; W(i,1) [ (1Dg)^(-2)*(1Dr)^2*W(iD1,1)*(1D1/c* W(iD1,1))^(-1);

end d0 [ 0.99; d(1,1) [ (1Dg)^(-1)*(1Dr)*[1-(cDW(1,1))^(-1)*W(1,1)]*d0

for t [ 1:9 d(tD1,1)[(1Dg)^(-1)*(1Dr)*[1-(cDW(tD1,1))^(-1)*W(tD1,1)]* d(t,1)

end

Listing 5.5 repeats the procedures of Listing 5.4. However, the coefficient c corresponding to the balanced budget condition is determined directly based on the interest rate on debt. Simulations results for the 2012, 2014, and 2015 data are given in Tables 3.4e3.6. LISTING 5.6 MATLABÒ Optimal Debt to GDP Ratio for Time-varying GDP Growth Rate function debtratio1_optimal; r [ 0.0224; g [ 0.03 c[r^(-1); g(1,1) [ 0.019; g(2,1) [ 0.022; g(3,1) [ 0.025; g(4,1) [ 0.03; g(5,1) [ 0.031; g(6,1) [ 0.033; g(7,1) [ 0.035; g(8,1) [ 0.035; g(9,1) [ 0.035; g(10,1) [ 0.035;

for q [1:10 d(q,1) [ 0; W(q,1) [ 0;

end

for m [ 1:9 i [ 10 - m; W(10,1)[1; W(i,1)[(1Dg)^(-2)*(1Dr)^2*W(iD1,1)*(1D1/c* W(iD1,1))^(-1);

end d0 [ 0.99; d(1,1) [ (1Dr)*[(1Dg(1.1))^(-1) - (1Dg)^(-1)*(cDW(1,1))^(-1)* W(1,1)]*d0

for t [ 1:9 d(tD1,1) [ (1Dr)*[(1Dg(tD1,1))^(-1) - (1Dg)^(-1)*(cDW(tD1,1))^ (-1)*W(tD1,1)]*d(t,1)

end

Listing 5.6 corresponds to the case when the optimal control (Riccati equation) is the same as in Listing 5.5 for the GDP growth rate g ¼ 0.03. However, the growth rates are assumed time-varying with the average 0.03 and presented by g(i,1) (i ¼ 1, 2,., 10). That is why d(t,1) in this program are different from d(t,1) (t ¼ 1,2,., 9) in the previous program (see Table 3.8). LISTING 5.7 MATLABÒ Optimal Estimate of the Ten Years Balanced Budget Proposal function balanced budget_optimal; r[0.019; N[7;

% time period;

g1[0.0491; % average nominal rate; g[0.03;

% average real rate;

h[0.02;

% inflation rate;

c[(rDh*(1Dr))^(-1); % balanced budget condition for inflation h; Yp[21.984; % initial value of GDP in nominal prices:

for q[1:N D(q,1)[0; W(q,1)[0; Z(q,1)[0; % Z[ G-T; Y(q,1)[Yp*((1Dg)* (1Dh))^q; % GDP in nominal prices;

end for m [ 1:N-1 i [ N-m; W(N,1)[1; W(i,1)[(1Dg)^(-2)*(1Dr)^2*W(iD1,1)*(1D1/c*W(iD1,1))^(-1);

end

Debt-Related Models Software

193

dp[1.024; % initial value of debt to GDP ratio; Dp[ 22,503 % initial value of debt; d(1,1)[[(1Dg)^(-1)*(1Dr)*[1-(cDW(1,1))^(-1)*W(1,1)]]*dp

for t[1:N-1 d(tD1,1) [ (1Dg)^(-1)*(1Dr)*[1-(cDW(tD1,1))^(-1)*W(tD1,1)]* d(t,1);

end D(1,1) [ d(1,1)*Y(1,1); Z(1,1)[dp*(cDW(1,1))^(-1)*(rD1)/(1Dg)*W(1,1)*Dp

for t[1:N-1 D(tD1,1) [ d(tD1,1)*Y(tD1,1) Z(tD1,1)[ - (cDW(tD1,1))^(-1)*(rD1)/(gD1)*W(tD1,1)*d(t,1)* Y(t,1) Y(t,1)[Y(t,1) d(t,1)[d(t,1) W(t,1)[W(t,1)

end end

Listing 5.7 relates to the optimal problem, considered in Chapter 4, to balance the US budget in 10 years. Earlier we explained why the 7-year period, starting from 2021, is chosen to evaluate the government 2018e27 proposal. Specifics of the above program are that it takes into account the projected 2% inflation. The balanced budget condition for this case is written based on Eq. (3.43); the obvious expressions in the program for nominal rates and GDP values are accompanied with notes (see also Appendix D). The related expressions for the GDP Yt, debt Dt, coefficient c, and the difference Zt between prime spending and revenues (t ¼ 1,2,.7) are obtained based on Eq. (D1.4). The program uses average interest, inflation, and GDP growth rates. It is not difficult to modify the program to use different projected rates for each year (see Listing 5.6).

REFERENCES Higham, D.J., Higham, N.J., 2000. MATLAB Guide. SIAM, Philadelphia. Miranda, M., Fackler, P., 2002. Applied Computational Economics and Finance. MIT Press, Cambridge, MA.