Skip to content

Modeling & Forecasting

MODELS

User Guide II: Chapter 49 on PDF page 1016, book page 995.

What is a model in EViews?

A model is a set of equations that jointly describe the relationship between a set of vars. These equations are combined into a single Model object in Eviews. Models allow for the simulation of different assumptions about variables that are determined outside the model (I.E. exogenous variables or "exovars").

A model in its most general form is F(y,x) = 0 where F is a vector of (real valued) functions, y is the endogenous variables and x is the exogenous variables. F is defined as LHS (Endogenous variables) minus RHS (usually a linear combination of Exogenous variables) and therefore F = 0 means RHS = LHS for the system.

Each eqn must have a unique endovar attached to it (on the LHS).

In Equation (49.2) y_i is the unique endogenous variable, f_i(y, x) is the function for that endogenous variable and this function depends on any or all other y and any or all other x in the system. For example, if GDP at time t is y_i then on the RHS we could have GDP_(t-1) as a y argument in f_i.

Equations:

Equations can be inline or linked. Inline equations are written in as text, whereas linked equations bring specification from an external EV object (e.g. an estimation object or even another Model object).

EXAMPLE:

Equations can be stochastic or identities.

Identities hold exactly, stochastic relationships hold with a random error.

SOLVING THE MODEL

If you solve a given model then: given exogenous variables X, EVeiws 12 will find values Y that satisfy the system. (Solving does NOT mean finding coefficients that minimize a loss function, solving means finding values of the endovars that satisfy the entire system, the coefs are fixed, either user specified or solved previously).

When solving a model, Eviews must first associate data with each variable in the model: Eviews binds each of the model variables to a series in the workfile (the software creates aliases when binding, e.g. Y becomes Y_0). Eviews then solves the model for each observation in the selected sample and places the results in the corresponding series.

Aliasing:

When a model is solved, aliasing is usually applied to the endogenous variables so that historical data is not overwritten. For models which contain lagged endogenous variables, aliasing allows users to bind the lagged variables to either of the following: (1) the actual historical data (this is called a static forecast) (2) the values solved for in previous periods (this is called a dynamic forecast).

Either way the lagged endogenous variables are treated as exogenous variables when solving the model for a single period.

Aliasing is also applied to exovars when doing S (scenarios). Creating a S means creating changes to exovars or AFs (add factors) (AFs are manual changes made to the residuals of a system eqn or change made directly to the endovars. In either case the results is directly altering the output of the model. That is to say, AFs change the forecast endovar vals after solving a model. )

How do Scenarios (S) work?

In a S users can change the path of an EXOGENOUS VARIABLE by OVERRIDING the variable. (Contrast this with the role of an AF which is to change the Endogenous variables – IE the model's output – directly). When an exovar is overridden under a given S, the variable is copied and given a suffix (e.g. _25A) – this is called binding. For example: If we have a historical endovar called Y, a given historical exovar might be called X. In that case when we run the model Y with to create a forecast (called a baseline forecast because we have not altered any exovars – in our example, we have not altered X) Eviews will create a forecast and bind it to a variable with a "_0" suffix, in this case Y_0.

If we then create a Scenario (by default called Scenario_1) then we can alter override X and run a new forecast using an altered X. The altered exovar X will be bound to a new series and given a suffix (Eg in this case it might be called X_1) and the new forecast values (and historical values) for Y under Scenario_1 will also be bound to a new variable and given a suffix (by default the suffix is "_1" making the new variable Y_1.)

note !! Key Take Away: under a baseline scenario we have one set of (usually accurate historical) values for exovars X which lead to a baseline forecast for Y. In this process Eviews creates a new series for Y adds the suffix "_0" to create Y_0. If we then create a Scenario (by default called Scenario_1) by overriding X this means we are altering historical X and this altered version is bound to a variable with a suffix ("_1" by default) say X_1. This change in X (the altered series is called X_1) leads to new forecasts for Y, which Eviews will label Y_1( by default).

note !! Users can create user defined suffixes for scenarios in Eviews, at TDE we use suffixes that indicate the scenario (by letter) and the year, eg "_25A" for scenario A in 2025.

Summary: Y is actual historical data for endovar Y,

Y_0 is solved Y using historical (unchanged) exovar X (nothing has yet been overridden) X1 is Scenario 1 exovar (ie X has been overridden, a copy was made and differs from X, this copy is called X_1 contains the values of X that have been altered in accordance with a given scenario, say Scenario_1) . Y1 is a series of endogenous values created when solving Eviews solved Scenario_1, IE solved the model using X_1 rather than X. Note that in practice we would end up with a suffix something like "_25A" rather than "_1" leading to variable names such as Y, Y_0, Y_25A, X and X_25A.

ADD FACTORS (AFs)

AFs are a special kind of exovar used to shift the output of an equation. In a Scenario we are changing the values in X (Eviews will make a copy and call this X1). X1 is used when solving the model which changes the input(s) of the model and therefore changes the output which is bound to an alias Y_1, but the change happens indirectly through changing exogenous variables.

Using an Add Factor under any given scenario changes the values in Y directly (either by adding the AF to the residual of the equation or adding the AF to the endovar directly). Rather than creating a copy of the endovar series Eviews binds the AF to a new variable with _A as a suffix.

Thus if we have Y as historical data, Y_1 as Y under Scenario 1 with X_1 as X under Scenario 1 and we then use an AF we will have Y_A as a separate series that tells is how Y_1 was altered.

MODELLING

EXAMPLE MODEL (TODO: make clearer and add pictures of steps taken) Having set up a model we can solve it as Deterministic for simulation type (deterministic means there is no simulation of errors and therefore no SD bands included in the simulation) and under Dynamics we can select Static. Dynamics = Static means we are looking at one step ahead forecasts over the existing data.

Under "Solution Sample" set the sample over which to solve the model to avoid using missing values. Once solved the results for the ENDOVARS are placed into a series in the workfile their names are determined by the aliasing given by the user.

PICTURE OF THE WINDOW IN WHICH DETERMINISTIC IS CHOSEN HERE In Variable View each variable is given a type (En for endo. X for Exo, and A for add factor (double check this). If the variable is black it is an EXOVAR, if it is blue it is being "traced" ( "traced" means that the intermediate values of the variable obtained during solving the model are stored, usually used for diagnosing why a model does not converge) and if a variable in the variable view is red it is being overridden this means there is an altered version of the exovar that is being used. PICTURE OF THE VARIABLE VIEW WITH VARIOUS TYPES OF VARIABLES HERE

Why have a variable view? For endovar Y we may have actual Y called Y, baseline forecast Y called Y_0, scenario 1 (or scenario A) forecast values of Y called Y1.

We can make graphs for actual and fitted values as follows: select variables (ctrl + click) and use proc > make graph. Be sure to set the correct sample in Sample For Graph.

Example of static solution, one step ahead forecast:

Performing a Dynamic Solution:

We use this to forecast past actual historical data and therefore use our own forecasted values as the basis for subsequent forecasts. To reiterate, here we are doing forecasts at multiple horizons and using forecast values as the basis for the multi step forecast. To do this click "solve" in the Model window (i.e. open the model by double clicking it) and then choose "Dynamic solution" in the Dynamics section of the dialog. If our data goes up to 1999 and we select 1985 1999 in the solution sample then the model forecasts using HISTORICAL EXOVARS but FORECASTED ENDOVARS for those periods. To reiterate, if we do dynamic forecasts over a period where we have actual exovar data then the system uses forecast endovar vals but actual exovar data, this is therefore counterfactual with respect to the exovars since in a real forecast we would have perfect insight into the future values of the exovars of the future.

This means our forecast shows how well the model would have worked under a very specific set of assumptions: (1) we use our model to forecast future endovar values, (2) we use our forecast endovar values to compute future forecasts (3) we have perfect knowledge of the future values of the EXOVARS until the end of our sample.

USING THE MODEL TO FORECAST FUTURE VALUES OF THE ENDOVARS (into the future for which we do not have exovar data)

Chose values for the exovars, these are not forecast, they MUST be chosen by the user. Use these forecast values of the exovars to update our forecasts of the endovars.

For example, we might forecast G using an ar regression on log(g).

A Note on AFs: AFs do NOT set the values of the exovars, rather these directly change the forecast values (by changing the residuals in the modelling eqn or the values of the Endovars directly).

Using Scenarios for Alternate Assumptions:

How to see what the model will output (i.e. what values the forecast endovars will take on) with different assumed future exogenous variables? We don’t want to edit the historical data or change the variables back and forth so we can use Scenarios (S). These keep track of the different paths we assumed for exovars without writing over the data.

In a S you can choose to change a subset of the exogenous variables while leaving the rest unchanged (and can choose to alter only a subset of any given exovar also). This is to say you can change as much or as little of the exovars as you wish when creatin a S.

When the S is solved the values of the ENDOVARS are saved in the workfile with a given suffix ( the suffix "_1" is the default but this can be changed by the user, we use for example _25A for scenario A in 2025).

Two special scenarios always exist by default: Actuals and Baseline. Neither of these can have overridden variables (meaning the EXOVARS cannot be changed, not sure about add factors here). Using the Actuals writes to the original historical data vars (careful not to overwrite existing data!), Running a Baseline S appends _0 to the vars (ie Baseline works with copies of the original data).

Create a Scenario: (see page 1032 of the PDF). Override some exovars by listing them in 'override' with spaces between each. These will now appear as red in the variable view of the Model . Users can give them another suffix besides the default "_1" under aliasing tab of the scenarios dialog.

In our Baseline forecast we had to make assumptions about the values of fexovars (Future realizations of Exogenous Variables).

In Scenario 1 we simply make different assumptions about fexovar values and write these new assumed fexovar values into X_1 (where X is the historical actual exovars, X_0 is the historical exovar values plus the baseline assumed fexovar values and X_1 is the fexovar vals under Scenario 1).

Make sure to check "solve for alternative along with Active" when solving. Make sure also that the Scenario 1 (or whichever S the user is interested in) is active and Baseline is selected the alternative. Also be sure to select the solution sample eg 2000 2005.

Look at the results: proc> make graph. Set model variables to Endogenous variables. Set Solution series to Deterministic solutions and check both Active and Compare solutions check boxes. Active S1, Alternative BL. (Scenario 1 and Baseline respectively).

BUILDING A MODEL

Method 1: Create using Object > New Object and choose Model

Method 2: select a set of estimation objects (eqns, VARs, system_ and right-click and choose Open as Model.

Add equations by either selecting insert if by inputting the equation by text or drag and drop from the work file window into the model.

Linking Equations to model objects:

Use proc>Link to play with linking and unlinking (see PDF page 1036 for details)

Working with Model Structure (PDF page 1036)

There are two primary Model views: Equation View and Variable View

Eqn View: each line shows a linked object or inline (text) eqn. If there is an issue it will show up here as an error with a red line over the eqn. Examine eqns using right-click on the eqn and selecting Properties (PDF page 1037 of user guide 2 for Eviews 12). You can also use ctrl F to bring up the Model Find dialog where you may search for eqns by name. Variable View is used for adjusting options for variables and for displaying and editing series associated with the model NOTE: The only way to add a variable or to change the type of a variable in the model is to modify the model equations. In the variable window you can also see dependencies between variables by clicking Dependencies. There is also TEXT VIEW: this shows the entire structure of the model. The lines contain the eqns of the model. A line beginning with a : represents a link to an external object. A line beginning with @ADD specifies an add factor.

The add factor command is of the form @add(v) endo_var add_factor.

NOTE: The option (v) is used to specify that the add factor should be applied DIRECTLY to the endovar . By default, the add factor is added to the residual of the equation.

(See book page 1028, PDF page 1049 for the section on Add Factors).

A line beginning with @INNOV denotes an innovation variance which can be applied to the enovar using @innov endovar number where "number" is the Standard Deviation of the innovation applied during stochastic simulation. See PDF page 1040 of Guide 2.

Dependency Graph View( PDF page 1043).

Specifying Scenarios (PDF page 1045):

The most important function of a S (scenario) is to specify which series will be used to hold the data associated with a particular solution of the model. Aliasing allows the user to specify the alias appended to the series name (eg _25A for S_A in 2025) . S are specified by declaring which EXO variables are to be override (IE altered from their historical values). Overridden variables will draw their data from the series with the alias attached (eg "_1" or" _25A") and other exovars will draw from the series with the same name as the variable (IE variables that are not overridden contain historical data). overridden variables are the exovars being used to generate a different S. Using a S one can exclude ENDO variables as well. When an endovar equation is dropped, the value of the variable is taken directly the workfile series with the same name. This basically makes the ENDOVAR into an EXOVAR for the purposes of modelling.

Scenario Editing tools (PDF page 1047)

Edit override right button menu item available from the variable view of a model lets a user exclude, override and edit ENDO and EXO vars for the current S.

In a Model object using the View button shows all S and the exclusions and overrides therein.

Using Add Factors (PDF page 1049, book page 1028)

An Add Factor (AF) is an extra EXO variable that directly affects ENDO results. The most common use for AFs is to provide a smoother transition from historical data into the forecast period. Typically, add factors will be used to compensate for a poor fit of one or more equations of the model near the end of the historical data, when we suspect this will persist into the forecast period. Add factors provide an ad hoc way of trying to adjust the results of the model without respecifying or reestimating the equations of the model.

The third form is f(y_i – a) = f_i(y, x) which means altering y inside of a function in stead of altering the residual as in 49.4.

Note that if we use @add then we are adding to the residual (RHS) but if we use @add(v) we are adding the LHS of the eqn. This is only important if the LHS contains a transformation of the variable e.g. log(g), then @add(v) adds to g and the output is log(g) so the new output is log(g - a) where as the command @add adds directly to log(g) ( so the new output is log(g) = f_i(y, x) + a.

How To Include Add Factors:

The Easier (local) method of creating AFs: Go to the equation view of the model and double click the equation of interest. Eqn Properties > go to Add Factors tab. In the Factor type box select whether you want to shift the residual (y_i = f_i(y, x) + a ) or shift the ENDOVAR (eg log(g -a) = f_i(y, x)). Click Yes to create the series that holds the add factor. It will be filled with NAs. Initialize the Add Factor:

Still in the Eqn Properties box click the Initialize Active Add Factor Button.

Zero: will set all the values of the AF (Add Factor) to zero. So that this equation has no residuals at actuals: this sets the values of the add factor, so the equation is exactly satisfied without error when the variables of the model = values in the actual series. So that this equation has no residuals at actives: this sets the vals of the AF such that the equation is exactly satisfied when the model vars = values I in the ENDO and EXO vars associated with the active S. So model solves the target variables to values of the trajectory series: this sets the vals of the AF such that an ENDOVAR of the model follows a particular target path then the model is solved.

Set the sample over which the AF should initialized by modifying the Initialization sample box. NOTE: if an AF is present for a given S, then it will be present for every S, but can be overridden for a particular S just like an exovar. (QUESTION: this means you cannot run the Baseline if the AF for any S is missing?)

The Harder (global) method of creating AFs: Initialize or override Afs for ALL equations in the model at the same time. Proc > Add Factors does this. EG to create a complete set of Afs that make the model solve to actual values over history use Add Factors > Equation Assignment… to create AF for every equation, then use Add Factors > Set Values… to set the Afs so that all the equations have no residuals at the actual values.

Locking the Model: This disables changes to the model. Proc > Protect/Unprotect model. When you first lock the model you will have to put in a password with min 4 characters. Putting a pw locks down backward compatibility and also shuts down some functionality (see PDF page 1051).

Solving the Model When solving the model a number of steps are taken The Block Structure of the model is analyzed (see PDF page 1039). Variables are bound to series in the workfile, according to the override settings and name aliasing rules of the S. If an endovar is being tracked then a new series will be created, if not a temp series will created (QUESTION: what do you mean "tracked"?) EQNs of the model are solved for each obs in the solution sample using iterative algos to compute the values of the endovars. Temp series are deleted. Results are rounded. See PDF page 1052 for Stochastic simulation and for leads and lags for endovars.

See PDF page 1055 for Initialization Methods (back casting for models with MA)

Basic Options (For solving)

To solve click Solve.

This is the most important part to set for application.

Simulation type: Deterministic means all equations in the model are solved so that they hold without error during the sim period, all coefs are held fixed at their point estimates and all exovars are held constant. Result = single path for endovars which can be evaluated by solving the model once. Stochastic means all the equations are solved so they have residuals which match randomly draw errors and (optionally) the coefs and exovars are also varied randomly. The model generates a distribution of outcomes. NOTE: solve the model deterministically at first to be sure it is behaving as expected and then solve stochastically.

Dynamics box: Determines how Eviews uses historical data for enovars when solving the model. If Dynamic solution is chosen then only vals of the endovars from BEFORE the solution sample are used when forming the forecast. This means lagged endovars and ARMA terms are calculated using calculated solutions from previous periods NOT THE ACTUAL HISTORICAL VALS!. A dynamic solution is typically correct to use when forecasting values several periods into the future.

Static solution means values of the endovar up to the previous period are used each time the model is solved. Lagged endovars and ARMA terms are base don actual values of the endovars. A static solution is correct when producing a set of one-step ahead forecasts over the historical data to examine historical fit. A static solution cannot be used to predict more than one obs into the future!

Fit means endovars for the current period are used when the model is solved. All endovars except the one var for the equation being evaluated are replaced with their actual values. Fit is used to examine the fit of EACH of the equations in in the model when considered separately, IGNORING THEIR INTERDEPENDENCE IN THE MODEL.

The fit option can only be used for periods when historical values are available for all the endogenous variables.

Structural checkbox: can ignore any ARMA specifications that appear in the model equations.

At bottom LEFT of the dialog is a box for the solution sample. The SS is the set of obs over which the model will be solved. Unlike in some other EViews procedures, the solution sample will not be contracted automatically to exclude missing data and the model wont run without data available for all exovars over the SS.

RHS of the dialog are controls for selecting which scenarios we would like to solve. Select Edit Scenario Options buttons users can examing settings of an S. The Solve for Alternative along with Active should be used in a STOCHASTIC SETTING where the two S must be solved together. See PDF page 1059 for stochastic options.

Tracked variables: PDF page 1063

The Tracked Variables page of the dialog lets users change which endovars are being tracked by the model. If a variable is being tracked, it means the results for that variable are saved in a series in the workfile after the simulation is complete. If a variable is not tracked, then nothing is saved from the simulation for that variable. Used for models with large numbers of variables.

NOTE: all variables are tracked by default. The traced variables list allows user to specify a list of vars for which intermediate vals wil be stored during iterations of the solutions process. Look at the Trace Output view after the model is complete to see where errors may be coming from if the model is failing to converge.

Boundaries: tells the solver to give warnings if any variables cross user specified boundaries. Can be examined in the Check Solution Bounds view once solve is complete. See PDF 1064 for Solver info (algo for solving the model). Working with Model Data see PDF page 1072

Types of series available in the model window: actuals, active, alternate.

Actuals are historical data for endovars and historical data and baseline forecast for exovars. Active: the workfile series use when solving the active S. for endovars this is the series with a name plus _alias (eg _25A). For exovars it will be the actual series unless overridden. If overridden the exovars will ALSO be series with the alias appended.

Alternate: the workfile series that is used when solving the alternate scenario. The rules are the same as for active.

Editing and Displaying Data 1073 TODO

Managing Data 1075 TODO Comparing solution data 1076 The Compare solutions menu item, (from the View menu) allows users to view any difference between solution values for different S.

After solving for different S users can click on View > Compare solutions… to being up a dialog that allows for comparison of solutions across different S.

Choose which vars to compare using the Select drop-down box and the From edit field. Once a var is selected users can select S to compare using the Series to compare area. The first choice using Solution series drop-down chooses between comparing point estimates of deterministic solutions of means of stochastic solutions.

The Compare the Active Scenario drop-down allows users to choose vars for comparison.

NOTE: changing the S here will change the active S for the model and for the comparison.

Users have two choices for specifying the SECOND set of variables. Select a S using the Scenario radio button and then selecting a S OR by selecting Pattern

Pattern will match using the wildcard "" to represent variable names in the pattern. EG if the current series is I_0 then "_OLD" would specify I_OLD.

Users can ref a data based using dbname:: syntax.

The table lists any variables for which the percentage difference between the two series for each scenario is greater than the specified tolerance. The columns in the table show details about the variables. The first shows the variable name. The second, Delta%, shows the maximum difference between the two series for each variable. The third and fourth columns, “First” and “Last”, give the date (or observation number) of the first period in which the two series differ and the last period in which the two series differ. Here, the first period in which M_0 differs from M_1 is 1960Q1, and the last period in which they differ is 1999Q4.