Solve the stochastic rational expectations problem
The function recsSolveREE
Once the model, the interpolation structure and a first guess solution have been defined, it is possible to attempt to find the rational expectations equilibrium of the model. This is achieved by the function recsSolveREE.
This is done by the following call
[interp,x] = recsSolveREE(interp,model,s,x,options);
This function call returns the interpolation structure interp with new or updated fields. Following a successful run of recsSolveREE, the fields cx and cz are created or updated in interp. They represent the response and expectations variables interpolation coefficients, respectively. These coefficients are sufficient to simulate the model. The second output is the matrix x of response variables on the grid.
The options structure defines the methods used to find the rational expectations equilibrium, as well as other aspects of the solution process (see Options for details on available options).
An example
First guess provided by RECS
If the first guess is generated by the function recsFirstGuess, interp already includes the fields cx, cz, and x corresponding, respectively, to the first-guess coefficients of interpolation of response variables, of expectations variables, and the first-guess values of response variables, so it is not necessary to supply the value of the response variables on the grid. For the stochastic growth model, finding the first guess and solving the model involves the following call:
interp = recsFirstGuess(interp,model); interp = recsSolveREE(interp,model);
Successive approximation Major Minor Lipschitz Residual 0 0 1.13E-04 (Input point) 1 1 0.2984 8.00E-05 2 1 0.3073 5.64E-05 3 1 0.3168 3.97E-05 4 1 0.3252 2.81E-05 5 1 0.3290 2.05E-05 6 1 0.3218 1.57E-05 7 1 0.2969 1.29E-05 8 1 0.2549 1.12E-05 9 1 0.2069 1.02E-05 10 1 0.1652 9.37E-06 11 1 0.1361 8.64E-06 12 1 0.1196 7.92E-06 13 1 0.1128 7.20E-06 14 1 0.1119 6.49E-06 15 1 0.1140 5.81E-06 16 1 0.1174 5.16E-06 17 1 0.1213 4.55E-06 18 1 0.1251 4.00E-06 19 1 0.1287 3.49E-06 20 1 0.1320 3.03E-06 21 1 0.1350 2.63E-06 22 1 0.1377 2.27E-06 23 1 0.1402 1.95E-06 24 1 0.1423 1.68E-06 25 1 0.1443 1.43E-06 26 1 0.1460 1.23E-06 27 1 0.1475 1.05E-06 28 1 0.1489 8.91E-07 29 1 0.1501 7.57E-07 30 1 0.1512 6.43E-07 31 1 0.1521 5.45E-07 32 1 0.1530 4.62E-07 33 1 0.1537 3.91E-07 34 1 0.1543 3.31E-07 35 1 0.1548 2.80E-07 36 1 0.1552 2.37E-07 37 1 0.1555 2.00E-07 38 1 0.1557 1.69E-07 39 1 0.1558 1.43E-07 40 1 0.1558 1.20E-07 41 1 0.1557 1.02E-07 42 1 0.1555 8.60E-08 43 1 0.1551 7.27E-08 44 1 0.1547 6.16E-08 45 1 0.1541 5.21E-08 46 1 0.1535 4.42E-08 47 1 0.1527 3.75E-08 48 1 0.1517 3.18E-08 49 1 0.1507 2.71E-08 50 1 0.1495 2.31E-08 51 1 0.1482 1.97E-08 52 1 0.1467 1.68E-08 53 1 0.1451 1.44E-08 Solution found - Residual lower than absolute tolerance
User-provided first guess
If the first guess is provided by the user. The user needs to provide an n-by-m matrix x that contains the values of the m response variables for the n points on the grid of state variable.
For our example, let us first remove the solution from the interp structure from the previous solve:
interp = rmfield(interp,{'cx','cz'});
Then we take a very simple first guess: consumption is equal to one-fifth of capital stock:
x = s(:,1)/5; interp = recsSolveREE(interp,model,s,x);
Successive approximation Major Minor Lipschitz Residual 0 0 4.08E-03 (Input point) 1 1 0.2967 2.89E-03 2 1 0.2749 2.11E-03 3 1 0.2570 1.58E-03 4 1 0.2416 1.21E-03 5 1 0.2279 9.49E-04 6 1 0.2154 7.56E-04 7 1 0.2037 6.11E-04 8 1 0.1928 5.02E-04 9 1 0.1825 4.17E-04 10 1 0.1730 3.51E-04 11 1 0.1643 2.98E-04 12 1 0.1565 2.55E-04 13 1 0.1497 2.20E-04 14 1 0.1438 1.90E-04 15 1 0.1389 1.65E-04 16 1 0.1349 1.44E-04 17 1 0.1316 1.26E-04 18 1 0.1290 1.11E-04 19 1 0.1269 9.72E-05 20 1 0.1254 8.53E-05 21 1 0.1243 7.50E-05 22 1 0.1234 6.60E-05 23 1 0.1229 5.80E-05 24 1 0.1225 5.10E-05 25 1 0.1224 4.49E-05 26 1 0.1223 3.94E-05 27 1 0.1223 3.47E-05 28 1 0.1224 3.04E-05 29 1 0.1226 2.67E-05 30 1 0.1228 2.35E-05 31 1 0.1230 2.06E-05 32 1 0.1233 1.81E-05 33 1 0.1235 1.58E-05 34 1 0.1238 1.39E-05 35 1 0.1240 1.22E-05 36 1 0.1243 1.07E-05 37 1 0.1245 9.34E-06 38 1 0.1248 8.18E-06 39 1 0.1250 7.16E-06 40 1 0.1252 6.26E-06 41 1 0.1254 5.48E-06 42 1 0.1256 4.79E-06 43 1 0.1257 4.19E-06 44 1 0.1259 3.66E-06 45 1 0.1260 3.20E-06 46 1 0.1261 2.80E-06 47 1 0.1262 2.45E-06 48 1 0.1263 2.14E-06 49 1 0.1264 1.87E-06 50 1 0.1264 1.63E-06 51 1 0.1264 1.43E-06 52 1 0.1264 1.25E-06 53 1 0.1264 1.09E-06 54 1 0.1263 9.53E-07 55 1 0.1263 8.33E-07 56 1 0.1262 7.28E-07 57 1 0.1261 6.36E-07 58 1 0.1260 5.56E-07 59 1 0.1258 4.87E-07 60 1 0.1257 4.26E-07 61 1 0.1255 3.72E-07 62 1 0.1253 3.26E-07 63 1 0.1250 2.85E-07 64 1 0.1248 2.50E-07 65 1 0.1245 2.19E-07 66 1 0.1242 1.92E-07 67 1 0.1239 1.68E-07 68 1 0.1235 1.47E-07 69 1 0.1232 1.29E-07 70 1 0.1228 1.14E-07 71 1 0.1224 9.98E-08 72 1 0.1219 8.77E-08 73 1 0.1215 7.71E-08 74 1 0.1210 6.79E-08 75 1 0.1205 5.97E-08 76 1 0.1199 5.26E-08 77 1 0.1194 4.64E-08 78 1 0.1188 4.09E-08 79 1 0.1182 3.61E-08 80 1 0.1176 3.19E-08 81 1 0.1170 2.82E-08 82 1 0.1164 2.50E-08 83 1 0.1157 2.21E-08 84 1 0.1151 1.96E-08 85 1 0.1144 1.74E-08 86 1 0.1137 1.54E-08 87 1 0.1130 1.37E-08 Solution found - Residual lower than absolute tolerance
With this simple model, even a naive first guess allows the solver to find the solution, however it significantly decreases the precision of the first iteration, and so increases the number of iterations.