|
<< Click to Display Table of Contents >> PREDICT |
![]() ![]()
|
The PREDICT statement is used to predict a Gekko equation, calculating the right-hand side and assigning the result to the left-hand side variable. At the moment PREDICT is only used to predict model equations. In that case, predicting an equation can be thought of as performing a simulation of a model consisting of only that particular equation.
Consider the following model equation:
FRML _i y = c + i + g;
Here, the statement predict <2020 2030> y; will calculate c + i + g over the given period, and assign the result to y.
Note the following about PREDICT:
•You may use PREDICT on any equation in a Gekko model, including equations of p-type (that is, equations that are part of the model file, but are not used in the simulation).
•PREDICT will calculate the left-hand side dyncamically if the left-hand side appears with lags on the right-hand side (corresponding to series<dyn> or block series dyn = yes;). Therefore, if the equation is FRML _i y = y[-1] + 1;, using predict y; will accumulate y with 1 for each period.
•PREDICT is similar to sim <res>, with only one equation being predicted. But note (1) that lags may accumulate in PREDICT (cf. the above point), and (2) that predicted equations may influence each other if several PREDICTs are issued (or if PREDICT is issued on a list of names).
predict < period > equations;
•If no period is given inside the <...> angle brackets, the global period is used (cf. TIME).
where: |
|
period |
(Optional). Local period, for instance 2010 2020, 2010q1 2020q4 or %per1 %per2+1. |
equations |
List of equations, designated by names of left-hand side variables |
Examples
Consider the following model:
FRML _s dlog(y) = 0.52 * dlog(yw) + 0.28 * log(yw[-1] - y[-1]);
FRML _s log(yw) = log(x) - 0.3 * log(p) + 12.34;
Here, we are defining an intermediate variable yw in the second equation that in principle could be merged into the first equation. But yw may define an equilibrium value of particular interest, but when new data for x and p arrives, the databank value of yw should reflect this. By means of PREDICT we may avoid making copies of equations for use in data preparation. Consider these two cases:
open <edit> newdata; |
Instead, we may use PREDICT, where the equation is taken from mymodel.frm:
model mymodel; open <edit> newdata; |
Note that in the latter example, the equation is not written explicitly, but is fetched from the model. If you were going to PREDICT several equations, the names of these can be stated as a list of equation names #equnames, with syntax predict {#equnames};.
Note
See the examples in the MODEL section regarding other uses of PREDICT (for instance, in the RUNAFTER$ section of a model).
Related statements