EVIEWS 12.0 Training - January 2022 - Day 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 44

Technical and software project experts

JUMPSTART TO TIME FORECASTING USING EVIEWS

JOHAN K. RUNTUK, S.T., M.T | YOGYAKARTA, 26-27 JANUARY 2022


Day 2

+ Estimating Regression Models

+ Time Series Model (Forecasting) in EViews


+ Univariate

+ Multivariate

+ Panel Data Regression


Estimating Regression Models
Regression Analysis
Regression analysis is a conceptually simple method to investigating
functional relationships among variables. The relationship is expressed in
the form of an equation or a model connecting the response or dependent
variable and one or more explanatory or predictor variables.

In this training, we focus on:

+ Linear Regression

+ Logistic/Probit Regression
A Guideline for Running Regression
+ Unlike IBM SPSS Statistics, EViews does not offer the options of
stepwise entry or backward removal of variables when running
regression.
+ Include all the variables in EViews and eliminate the non-significant variables one by
one until only the significant ones remain.

+ The main advantage of running regression in EViews is that formal


testing procedures exist for testing hypotheses concerning the
residuals.
A Guideline for Running Regression
+ Basic classical assumption tests of Linear Regression:
+ Linearity → use scatter plot (Quick, Graph, Scatter)
+ Multicollinearity → use correlation for independent variables (Quick, Group Statistics,
Correlations), VIF (View, Coefficient Diagnostics, Variance Inflation Factors)
+ Normality → use normality test (View, Residual Diagnostics, Histogram-Normality Test)
+ Outliers → check standardized residual graph (View, Actual,Fitted,Residual,
Standardized Residual Graph)
+ Autocorrelation → use serial correlation test (View, Residual Diagnostics, Serial
Correlation LM Test)
+ Heteroskedasticity → use heteroskedasticity (View, Residual Diagnostics,
Heteroskedasticity Test)
A Guideline for Running Regression
+ Solving assumption tests problem:
+ Linearity → employ data transformation
+ Multicollinearity → remove one or more highly correlated variable
+ Autocorrelation or Heteroskedasticity → use the Newey–West procedure to correct
OLS standard errors
+ Outlier → use Outliers/Indicator Saturation
+ Outliers or Heteroskedasticity → use the Huber/White procedure to correct OLS
standard errors
Specifying An Equation In EViews
When you create an equation object, a specification dialog box is displayed
You need to specify three things in this dialog:
1. the equation specification,
2. the estimation method,
3. the sample to be used in estimation.

In the upper edit box, you can specify the


equation: the dependent (left-hand side) and
independent (right-hand side) variables and the
functional form.

There are two basic ways of specifying an


equation: “by list” and “by formula” or “by
expression”.

Note: The list method is easier but may only be used with
unrestricted linear specifications; the formula method is more
general and must be used to specify nonlinear models or
models with parametric restrictions.
Specifying An Equation – by list
The simplest way to specify a linear equation is to provide a list
of variables that you wish to use in the equation.

First, include the name of the dependent variable or expression, Partial significance
followed by a list of explanatory variables. For example:

gdp c pce inv g

Note: the presence of the series name C in the list of regressors. This is a
built-in EViews series that is used to specify a constant in a regression.
EViews does not automatically include a constant in a regression so you must
explicitly list the constant (or its equivalent) as a regressor.

You may have noticed that there is a pre-defined object C in your workfile.
This is the default coefficient vector—when you specify an equation by listing
variable names, EViews stores the estimated coefficients in this vector, in the
order of appearance in the list. In the example above, the constant will be
stored in C(1), the coefficient on pce will be held in C(2), the coefficient on inv
will be held in C(3), and the coefficient on g will be held in C(4). Overall significance
Specifying An Equation – by list
Lagged series may be included in statistical operations using the same notation as in generating a new
series with a formula—put the lag in parentheses after the name of the series. For example, the
specification:
cs cs(-1) c inc
tells EViews to regress CS on its own lagged value, a constant, and INC. The coefficient for lagged CS will
be placed in C(1), the coefficient for the constant is C(2), and the coefficient of INC is C(3).
You can include a consecutive range of lagged series by using the word “to” between the lags. For
example:
cs c cs(-1 to -4) inc
regresses CS on a constant, CS(-1), CS(-2), CS(-3), CS(-4), and INC. If you don't include the first lag, it is
taken to be zero. For example:
cs c inc(to -2) inc(-4)
regresses CS on a constant, INC, INC(-1), INC(-2), and INC(-4).
You may include auto-series in the list of variables. If the auto-series expressions contain spaces, they
should be enclosed in parentheses. For example:
log(cs) c log(cs(-1)) ((inc+inc(-1)) / 2)
specifies a regression of the natural logarithm of CS on a constant, its own lagged value, and a two period
moving average of INC.
Specifying An Equation – by formula
An equation formula in EViews is a mathematical
expression involving regressors and coefficients.
To specify an equation using a formula, simply
enter the expression in the dialog in place of the
list of variables.

When you specify an equation by list, EViews


converts this into an equivalent equation formula.
For example, the list,
gdp c pce inv g
is interpreted by EViews as:
gdp = c(1) + C(2)*pce + c(3)*inv + (c4)*g
Equations do not have to have a dependent
variable followed by an equal sign and then an
expression.

Note: The “=” sign can be anywhere in the formula


Logistic or Probit Regression

+ Dependent variable: binary

+ Independent variable: nominal, ordinal, interval, or ratio scale

+ Estimation Setting: BINARY

+ Basic Assumption tests:

+ Multicollinearity

+ Residual diagnostic
Time Series Model in E-Views
(Forecasting)
Stationary Test
+ A series is said to be (weakly or
covariance) stationary if the mean and
autocovariances of the series do not
depend on time.

+ The formal method to test the


stationarity of a series is the unit root
test.

+ To begin, double click on the series


name to open the series window, and
choose View/Unit Root Tests/Standard
Unit Root Test.
Correlograms
+ Correlogram displays the
autocorrelations and partial
autocorrelations of the first series
in the group.

+ To begin, double click on the


series name to open the series
window, and choose
View/Correlograms.
Cointegration-Test
+ Your series may have nonzero
means and deterministic trends
as well as stochastic trends.
Similarly, the cointegrating
equations may have intercepts
and deterministic trends.
Forecasting
• EViews offers a powerful and easy-to-use forecasting tool that allows
you to obtain forecasts from your estimated models.
• The accuracy of the forecasts depends on the model used to produce
the forecasts: EViews simply handles the mechanics of producing the
forecasts.
• This tutorial explains the basic procedures for forecasting from a
single equation. The tutorial assumes knowledge of estimating
equations in EViews.
Forecasting-Simple Method
+ Exponential Smoothing

Example: gdp

GDP
14,000
13,000
12,000
11,000
10,000
9,000
8,000
7,000
6,000
5,000
1980 1985 1990 1995 2000 2005 2010
Forecasting-Simple Method
+ Exponential Smoothing

Example: gdp
14,000
13,000
12,000
11,000
10,000
9,000
8,000
7,000
6,000
5,000
1980 1985 1990 1995 2000 2005 2010

GDP GDPSM
Data and Workfile Documentation
• Data.wf1 and Data.xls have monthly data from January 1960-March 2013.

✓ payroll – employment levels, thousands of employees (source: Bureau of


Labor Statistics)
✓ IP –industrial production, index levels (source: Board of Governors of the
Federal Reserve)
✓ ISM – The Institute for Supply Management Manufacturing Index, Index
level (source: St. Louis’ FRED Database).
✓ Tbill 3M– 3-month US Treasury rate (source: Board of Governors of the
Federal Reserve)
✓ We will create a few equations to forecast the payroll series using EViews
Forecasting with Exogenous Variables
Example 1
• Suppose we want to forecast the level of non-farm payroll employment for the
period from 2014m04 to 2014m12.
• To accomplish this task, we first need to specify and estimate a model. Let’s
model the payroll level as a linear function of a time trend and seasonal
factors.
Example 1: Estimation
1. Type in the command window:
ls payroll c @trend @expand(@month, @dropfirst)
2. Press Enter (save this equation as eq01).
*Note: This equation is saved as eq01 in
Results.wf1 workfile.

Note that command @expand(@month) creates 12 dummy variables, one for each month
of the year. These are the seasonal factors. Because we have included a constant, we
need to exclude one of the dummy variables in order not to fall in the dummy variable
trap. Here we have chosen to exclude January, by using the option @dropfirst.
Forecasting with Exogenous Variables
Example 1
• Estimation output is shown here. Note
that EViews has estimated the model over
the period 1960m01 to 2013m03, for which
we have payroll data.
• We also plot the actual and fitted values
of the model (shown below), by pressing
View → Actual, Fitted, Residual → Actual
Fitted Residual Graph.
Forecasting with Exogenous Variables
Example 1: Forecasting
• Now, let’s produce a forecast for the payroll series based on our model.
• For this, all we have to do is press the button in the equation toolbar.
Example 1: Forecasting
1. Open eq01. On the equation box toolbar, press the
button. The Forecast dialog box opens up.
2. Under Series name, specify a name for the forecast
series. EViews suggests a name (payrollf) but this series
will be overwritten every time a new model is estimated.
Let’s save our series as eq01_f.
3. Under Forecast sample, select the sample over which the
forecast will be carried out. Here we type, 2013m04 @last.
4. Check “Insert actuals for out-of-sample observations.”
5. Under Method, notice that EViews indicates this is a Static
forecast (no dynamics in the equation) (more details later).
6. Under Output, check Forecast graph and Forecast
evaluation.
7. Click OK.
Forecasting with Exogenous Variables
Example 1: Forecasting
• The Forecast Output is shown
here. Notice that EViews shows
the series Eq01_f over the
forecast sample, together with 2
standard error bands.
Forecasting with Exogenous Variables
Example 1: Forecasting
• Note also that there is now a new series eq01_f saved in the workfile.
Let’s open this series and the original payroll series as a group to
inspect them more closely.
• Notice that the two series are identical when looking at the historical
data. This is because we elected to check the box “Insert actuals for
out-of-sample observations” which instructs EViews to use actual
payroll data for the out-of-forecast sample.
• However, the eq01_f series contains actual forecasts of the payroll
series for future periods. How does EViews compute these values?
• Recall that the explanatory variables in this model are @trend and
seasonal factors. EViews computes the forecast for April 2013 as
follows:
✓ @trendApril 2013 = 639; @trend coefficient=144.4909
✓ @month=4; @month=4 coefficient 1,476.381.
✓ constant=51,730.04
✓ eq01_f April 2013= 51,730.04+144.4909*639+1,476.381*1
=145,536.076
Forecasting with Exogenous Variables
Example 1: : Forecast Sample Changes
What would happen if we set the forecast sample to be the entire range
of the workfile?

Example 1: Forecast Sample Changes


1. Open eq01 and press the button. The
Forecast dialog box opens up.
2. Under Series name, name the new forecasted series
eq01_f3.
3. Set all the other options as we did before (check
Forecast graph and Forecast evaluation, check
“Insert actuals for out-of-sample observations.”
4. Under Forecast Sample, set the sample to the entire
workfile range (1960m01 2014m12).
5. Click OK.
Forecasting with Exogenous Variables
Example 1: : Forecast Evaluation
• The Forecast Output is shown here. Notice that EViews has computed eq01_f3 and the
corresponding standard error bands over the entire sample. Notice also that, in addition to
the graph, EViews has produced a small table: this is the Forecast Evaluation table.
✓ Although, we had checked the
Forecast evaluation box in the
previous illustrations, EViews was
unable to produce an output when the
forecast sample was set for future
periods (2013m04 to 2014m012).
✓ This is because EViews could not
check how well the forecasting model
works since the payroll data beyond
2013m03 is missing. We would have to
wait until a future date when payroll
data becomes available in order to
compare our forecasts with what
actually happens.
✓ When we set the forecast sample to the entire workfile range (or a sample that includes actual
historical data), it is possible to check for forecast accuracy. EViews compares the forecasted
(predicted) values from the model (over the period 1960m01 to 2013m03) to the actual data and
computes the forecast evaluation table.
Forecasting with Exogenous Variables
Example 1: : Forecast Evaluation
• We can inspect in more detail the
differences between the actual payroll
series and the forecasted eq01_f3 series.
We can open them as a group and plot
them together.
• As seen from the graph, values differ over
the historical range (1960m01 to 2013m03)
because eq01_f3 series comes from the
fitted values of eq01, whereas the payroll
series contains actual data.
• Of course, the eq01_f3 series is also longer
because it includes the future (predicted
values) over the period 2013m04 to
2014m12.
Forecasting with AR terms
Example 2
• Models with ARMA terms are also widely used in forecasting.
• The presence ARMA terms involve some additional complexities in forecasting, which we
highlight in this section.

Example 6: Estimation with AR terms


1. Let’s first specify a model with two AR terms.
Type in the command window:
smpl sample_est
ls payroll c ar(1) ar(2) @trend
@expand(@month, @droplast)

2. Press Enter (the second command should be


typed in one line).
Forecasting with AR terms
Example 2
• Let’s produce dynamic and static forecast for the AR(2) model we
just estimated.
Example 6: Forecasting with AR terms
1. Open eq06 and click the button.
As usual, the Forecast dialog box
opens up. Name the series eq06_dyn
for the dynamic series and eq06_stat
for the static forecast series.
2. Under Forecast Sample set the
sample to sample_for. Under Method,
select Dynamic forecast (for the
dynamic series), and Static forecast
(for the static series). Set the rest of the
parameters as shown here.
3. Click OK.
Forecasting with AR terms
Example 2
• The Forecast Output for both methods is shown
here. To produce forecasts with AR terms,
EViews adds forecasts of the residuals to the
forecasts of the structural model (structural
model is based solely on explanatory variables).
• As expected, the static forecast (bottom graph)
goes up to 2013m04, and performs better than
the dynamic forecast.
• In the dynamic forecast (top graph), the lagged
residuals are forecasted dynamically. This
means that future values of lagged residuals are
formed using the forecasted values of the
dependent variable.
• In contrast, the static forecast uses actual
lagged residuals and actual values for the
dependent variable to produce forecasts.
Forecasting with MA terms
Example 3
It is just as easy in EViews to produce forecasts from models with MA errors.
Example 3: Estimation with MA terms
1. Let’s first specify a model with one MA
term. Type in the command window:
smpl sample_est
ls payroll c ma(1) @trend
@expand(@month, @droplast)

2. Press Enter (the second command


should be typed in one line).
Forecasting with MA terms
Example 3
• Let’s produce dynamic and static forecast for the MA(1) model we just estimated.
Example 3: Forecasting with MA terms
1. Open eq08 and click the button. As usual,
the Forecast dialog box opens up. Name the series
eq08_dyn and eq08_stdev_dyn for the dynamic
series and eq08_stat and eq08_stdev_stat for the
static forecast series.
2. Under Forecast Sample set the sample to
sample_for.
3. Note that a new field MA backcast appears. Here
you can choose either of two options: Estimation
period (the default) and Forecast available (v5).
Let’s choose Estimation period.
4. Click OK.
Forecasting with MA terms
Example 3
• The Forecast Output for both methods are
shown here.
• Because the forward recursion for static
forecasts are performed through the end of the
forecast period, EViews is able to produce Static
forecasts that cover the entire forecast sample
(2013m04 to 2014m12).
• Moreover, beyond 2013m04, forecasts from
Dynamic and Static model are identical (this is
because the forward recursion used to obtain
the pre-forecast sample innovations produces
same innovations after the end of the historical
in 2013m03).
Panel Data Regression
Benefits of Panel Data
+ Controlling for individual heterogeneity

+ Give more: informative data, variability, degree of freedom, efficiency

+ Better able to study the dynamic of adjustment

+ Better able to identify & measure effects that are simply not
detectable in pure cross-section or time-series

+ To construct & test more complicated behavioral models than purely


cross-section or time-series data

+ Usually gathered on micro units (i.e. individuals, firm, etc.)


Panel Data Regression Estimation

β1, β2, β3: β1, β2, β3:


β2, β3: constant across time and
constant across time vary over
individual
and individuals individual and
β1 varies over individual
time

OLS/Common Random
Fixed Effects
Effects Effects
Choice of Panel Data Regression Estimation
Panel Data Regression
Open “dataset data panel.wf1”
OLS/Common Effect Fixed Effect
the equation specification: the equation specification:
y c x1 x2 x3 y c x1 x2 x3
Change panel option, cross
section “Fixed”
Panel Data Regression
Chow Test
Click View \ Fixed Random Effect Testing \ Redundant Fixed Effect – Likelihood Ratio

< 0.05 → select FE


Panel Data Regression
Open “dataset data panel.wf1”
Random Effect
the equation specification:
y c x1 x2 x3
Change panel option, cross section “Random”
Panel Data Regression
Hausman Test
Click View \ Fixed Random Effect Testing \ Correlated Random Effect – Hausman Test

< 0.05 → select FE


Please
ask
us
anything We are happy to
help!
Have a poke around and get to know us a bit better

Let’s connect
M+ Software thank you all for your consideration to be your project partner
for digital.

We have experience, expertise and capacity to support you in the background.

Test us with a project. . . let’s connect!

Nola Romana I nola.romana@mplus.software I Tel / WhatsApp: +62 812 8961


6155 I mplus.software

Hope to see you soon!

You might also like