Econometrics With Eviews Chapter 17 Version 4 Discrete and Limited Dependent Variable Models Part 1: - PowerPoint PPT Presentation

1 / 54
About This Presentation
Title:

Econometrics With Eviews Chapter 17 Version 4 Discrete and Limited Dependent Variable Models Part 1:

Description:

PROC UCM is experimental in SAS/ETS Version 9. UCMs model a time series as a sum of components, ... obtaining a model-based seasonal decomposition of the series ... – PowerPoint PPT presentation

Number of Views:255
Avg rating:3.0/5.0
Slides: 55
Provided by: HALL2
Category:

less

Transcript and Presenter's Notes

Title: Econometrics With Eviews Chapter 17 Version 4 Discrete and Limited Dependent Variable Models Part 1:


1
PROC UCM Unobserved Component Models
March 9, 2005 Charlie Hallahan
2

Overview
  • PROC UCM is experimental in SAS/ETS Version 9.
  • UCMs model a time series as a sum of components,
    both observed and unobserved.
  • The unobserved components could be trends,
    cycles, and/or seasonals.
  • The observed components could be regression
    effects.
  • UCMs are also called structural models (see
    Harvey, 1989).
  • UCMs can be formulated as state space models.
  • State Space models are more general (for the most
    part ) than ARIMA models and
  • exponential smoothing model.
  • Filtered estimates use only past observations,
    while smoothed estimates use all the data.
  • .

3
Overview
  • UCMs can be used for a variety of purposes
  • forecasting the values of the response series
    and the component series in the
  • model
  • obtaining a model-based seasonal decomposition
    of the series
  • obtaining a denoised version and
    interpolating the missing values of the
  • response series in the historical period
  • obtaining the full sample or smoothed
    estimates of the component series in the
  • model
  • studying the effect of changes in the predictor
    values on future values of the
  • response series, that is, the scenario
    analysis.

4
Getting Started
  • Well start by looking at three examples
  • Basic Structural Model includes trend
    seasonality and uses the airline data.
  • Model with a Cycle Component using the sunspot
    data
  • Model with an intervention variable using the
    Nile data

5
Getting Started Example 1
Well start with a simple example, a Seasonal
Series with Linear Trend The dataset is the
familiar airline dataset from Box-Jenkins.
The data is monthly number of airline passengers
from 1949 1960. The data has been logged to
stabilize the variance. There are a clear trend
and seasonality.
6
Getting Started Example 1
7
Getting Started Example 1
The following SAS statements specify a BSM with
these three components proc ucm data
series_g id date interval month
model logair irregular
level slope season length 12
typetrig printsmooth estimate
forecast lead24 printdecomp run
8
Getting Started Example 1
The optional ID statement specifies a date,
datetime, or time identification variable to
label the observations. The MODEL statement
specifies the dependent variable for this
example. The IRREGULAR statement specifies the
irregular component et. The LEVEL and SLOPE
statements specify the trend component ?t. The
SEASON statement specifies the seasonal component
?t. Options on the SEASON statement specify the
seasonal frequency (12) and type of seasonality
(trigonometric). Options on the various component
statements can request that forecasts of that
component be printed. In this example, smoothed
forecasts (using all the data) are requested for
the seasonal component. The ESTIMATE statement
implements maximum likelihood estimation of the
parameters in the model. In this case the
parameters are the variances of the different
disturbance terms. The FORECAST statement
specifies how many forecasts to calculate, and,
in this case, the option PRINTDECOMP requests
printing of the smoothed trend and trend plus
seasonal.
9
Getting Started Example 1
Parameter estimates for the BSM for the Logair
series



The UCM Procedure
Final Estimates of the
Free Parameters
Approx
Approx Component Parameter
Estimate Std Error t Value Pr
gt t Irregular Error Variance
0.00023436 0.0001079 2.17
0.0298 Level Error Variance
0.00029828 0.0001057 2.82
0.0048 Slope Error Variance
9.8572E-13 6.7141E-10 0.00
0.9988 Season Error Variance
0.00000356 1.32347E-6 2.69 0.0072
The estimates suggest that the Slope can be
treated as constant, i.e., has zero variance. The
next question to ask is can the slope component
be dropped? This can be checked by examining the
significance analysis table of components (based
on the Final State)
10
Getting Started Example 1



Significance Analysis of Components
(Based on the
Final State)
Component DF Chi-Square Pr gt ChiSq
Irregular 1
0.08 0.7747
Level 1 117867
lt.0001 Slope
1 43.78 lt.0001
Season 11 507.75
lt.0001
The slope, at least at the end of the series,
appears to be highly significant and should be
left in the model. The slope component can be
made deterministic by fixing its variance to be
zero
slope variance0 noest
11
Getting Started Example 1
The fit statistics for this new model show a
satisfactory fit

Fit Statistics Based on Residuals
Mean Squared Error
0.00147
Root Mean Squared Error
0.03830 Mean
Absolute Percentage Error 0.54132
Maximum Percent Error
2.19097
R-Square 0.99061
Adjusted R-Square
0.99046
Random Walk R-Square
0.99220 Amemiya's
Adjusted R-Square 0.99017
Number of non-missing
residuals used for
computing the fit statistics 131
12
Getting Started Example 1
Forecasts a feature of UCM models is that
forecasts of each component can be examined
separately. The following code uses the ODS
system to save the appropriate components in
output datasets and renames the variables.
ods select SmoothedTrend ods select
SmoothedSeason ods select SmoothedAllExceptIr
reg ods output SmoothedTrend smtrend
(rename (actuallogair componentseriesSmoothed
Trend timedate) drop _group_ obs)
ods output SmoothedSeason smseason
(rename (actuallogair componentseriesSmoothedS
eason timedate) drop _group_ obs)
ods output SmoothedAllExceptIrreg smmodel
(rename (actuallogair componentseriesSmoothedM
odel timedate) drop _group_ obs)
13
Getting Started Example 1
The model is re-estimated with the noest option
on the slope variance parameter and the output
datasets from ODS are prepared for graphing
proc ucm data series_g id date
interval month model logair
irregular level slope
variance0 noest season length 12
type trig printsmooth estimate
forecast lead 24 printdecomp run
data smtrend set smtrend if
date lt '01jan1961'd then lower . if date
lt '01jan1961'd then upper . label
logair 'Log_Air' label date 'Date'
label SmoothedTrend 'Smoothed Trend'
run
14
Getting Started Example 1
data smseason set smseason
if date lt '01jan1961'd then lower . if
date lt '01jan1961'd then upper . label
logair 'Log_Air' label date 'Date'
label SmoothedSeason 'Smoothed Season'
run data smmodel set smmodel
if date lt '01jan1961'd then lower . if
date lt '01jan1961'd then upper . label
logair 'Log_Air' label date 'Date'
label SmoothedModel 'Smoothed Trend Plus
Seasonal' run
15
Getting Started Example 1
A number of graphs will be produced using PROC
GPLOT. The code for setting up the first graph
will be shown. Similar code applies to the other
graphs.
title1 title2
symbol1 symbol2 symbol3
symbol4 symbol1 colorred
valuecircle height1 symbol2
fontmarker valuepoint colorblue
interpolspline height2 symbol3
fontmarker valuepoint colororange
interpolspline height2
line20 symbol4 fontmarker valuepoint
colororange interpolspline
height2 line20
title1 "Logair Trend Plot" title2
"Forecast Plot of the Series and Smoothed Trend"
legend1 labelnone
shapesymbol(2,1) position(top left
inside) across1 modeshare
proc gplot datasmtrend format
date monyy5. plot logair date
SmoothedTrend date (lower
upper) date / overlay
legendlegend1 HREF'01jan1961'd
run quit
16
Getting Started Example 1
17
Getting Started Example 1
18
Getting Started Example 1
Model seems to fit the data very well.
19
Getting Started Example 2
The second example involves a series with a
cyclical component. The dataset in this example
is the Wolfer sunspot data, annual sunspot
numbers recorded from 1749 to 1924. The data is
known to have a cyclical pattern of around 11
years. A plot of the data shows cyclical
behavior, but no trend.
20
Getting Started Example 2
Since the data exhibits no trend, an UCM with a
cycle and level component will be fit. In this
case, the trend is modeled as a time-varying
level component without a slope component. The
cycle is modeled as a damped sinusoidal with
time-varying amplitude and fixed period.. The
parameters in this model are the period of
the cycle, the damping factor, and the variances
of the stochastic components.
proc ucm datasunspot id year
intervalyear model wolfer
irregular level cycle
printsmooth estimate
forecast lead12 printdecomp run
21
Getting Started Example 2

The UCM Procedure
Final Estimates of the Free
Parameters
Approx
Approx Component Parameter
Estimate Std Error t Value Pr gt
t Irregular Error Variance
0.00827 3.00558 0.00 0.9978
Level Error Variance
2576.40074 1174.7 2.19 0.0283
Cycle Damping Factor
0.93606 0.01955 47.89 lt.0001
Cycle Period
10.58312 0.41233 25.67 lt.0001
Cycle Error Variance
11677 3354.3 3.48 0.0005
Note the estimated period of 10.58 years,
consistent with known results. Plots of the
estimated components follow.
22
Getting Started Example 2
23
Getting Started Example 2
24
Getting Started Example 2
25
Getting Started Example 3
A Series with a Level Shift the last example
consists of the yearly level readings of the
river Nile recorded at Aswan from 1871 to 1970.
While no trend is apparent in the plot, a level
shift around 1899 could be due to the building of
the Aswan dam.
26
Getting Started Example 3
To model the level of the river as a locally
constant series with a shift in the year 1899, a
dummy regressor is included.
data nile set nile
if year gt '1jan1899'd then Shift1899 1.0
else Shift1899 0 run
title "Nile River Level Data" symbol1
isplines vcircle h1 proc gplot
datanile plot levelyear /
HREF'01jan1899'd run quit proc
ucm datanile id year intervalyear
model level shift1899 irregular
level estimate forecast
printdecomp run
27
Getting Started Example 3
Well first look at a plot of the smoothed trend
without including the shift variable
Note the drop in the smoothed river level around
1899.
28
Getting Started Example 3
Well now include the shift dummy for 1899.
The smoothed level now takes on a much simpler
form.
29
An Introduction to Unobserved Component Models
30
Modeling the Trend
31
Modeling a Cycle
32
Modeling a Cycle
33
Modeling a Cycle
34
Modeling a Cycle
35
Modeling a Seasonal
36
Modeling the Autoregression
37
The Regression Terms
38
The Model Parameters
The parameters of the unobserved component mode
consist of the variances of the disturbance terms
for the components in the model, the damping
coefficients and frequencies in the cycles, the
damping coefficient in the autoregression, and
the regression coefficients in the regression
terms. The parameters are estimated by maximum
likelihood. Model parameters can be set to fixed
values by the user. The documentation has a
good discussion of how the UCMs can be thought of
as State Space Models.
39
Example Variable Star Data
This is an example of finding more than one cycle
in a non-seasonal series. The data consists of
brightness measurements (magnitude) of a variable
star taken at midnight for 600 consecutive days.
The data can be downloaded from a time series
archive maintained by the University of York,
England (http//www.york.ac.uk/depts/maths/data/t
s/welcome.htm series 26).
data star input magnitude _at__at_ day _n_
datalines 25 28 31 32 33 33 32 31 28 25 22 18
14 10 7 4 2 0 0 0 2 4 8 11 15 19 23 26
29 32 / -- data lines removed - / 31 33 34 34
33 31 29 26 22 18 15 11 8 5 3 2 2 2 4 5

40
Example Variable Star Data
proc gplot datastar symbol ispline vcircle
h1 plot magnitude day title1 "Variable
Star Series Plot" run
The data definitely appears to be cyclic. In his
text Bloomfield (2000) models this data as
having two deterministic cycles with periods of
29.0003 and 24.0001 days, a constant term, and
a simple error term. He discusses the
difficulty of estimating these periods from the
data using least squares. This example is
presented in the PROC UCM documentation as
an example of using UCMs to reveal the hidden
cycles.
41
Example Variable Star Data
The first model estimated has only a single
stochastic cycle along with level and irregular
components. The idea is that a single stochastic
cycle with time varying amplitude and phase might
be sufficient to explain the observed series.
proc ucm datastar model magnitude
irregular level cycle
forecast printforecasts run
Note that the user need not specify an initial
value for the frequency or period.
42
Example Variable Star Data

The UCM Procedure
Final Estimates of
the Free Parameters
Approx
Approx Component
Parameter Estimate Std Error t
Value Pr gt t Irregular
Error Variance 0.02094 0.0076007
2.76 0.0059 Level Error
Variance 3.6126E-10 2.2014E-7 0.00
0.9987 Cycle Damping
Factor 0.99906 0.0007969 1253.65
lt.0001 Cycle Period
27.12640 0.17225 157.48
lt.0001 Cycle Error Variance
0.20111 0.16895 1.19 0.2339

Fit Statistics Based on Residuals
Mean Squared Error
0.31481
Root Mean Squared Error
0.56108 Mean
Absolute Percentage Error 4.55372
Maximum Percent Error
60.57167
R-Square 0.99609
Adjusted R-Square
0.99607
Random Walk R-Square
0.94510 Amemiya's
Adjusted R-Square 0.99603
43
Example Variable Star Data
The model fit appears to be pretty good, however,
the residuals still exhibit some serial
correlation, suggesting an additional cycle may
be present.
The
ARIMA Procedure
Autocorrelation Check for White Noise
To Chi- Pr gt Lag
Square DF ChiSq --------------------Aut
ocorrelations-------------------- 6
124.37 6 lt.0001 -0.026 0.293
0.053 0.340 0.023 0.013 12
292.49 12 lt.0001 -0.085 -0.013
-0.146 -0.367 -0.268 -0.198 18
487.44 18 lt.0001 -0.256 -0.351
-0.259 -0.049 -0.239 -0.033 24
865.64 24 lt.0001 -0.156 0.287
0.014 0.255 -0.029 0.657
44
Example Variable Star Data
A plot of the residuals also suggests cyclic
behavior of the residuals. (At least
the documentation says so it takes a better eye
than mine to spot a cycle in this plot).
45
Example Variable Star Data
Note on p.42 that the damping factor of the cycle
is essentially equal to 1 and that the
disturbance variance for the level is essentially
0. Hence, the two cycle model estimated below
will treat the level as deterministic and fix the
damping factors for the two cycles at 1.
title "Variable Star Data Series" title2 "Two
Cycle Model" proc ucm datastar model
magnitude irregular level
var0 noest cycle rho1 noestrho
cycle rho1 noestrho forecast
printforecasts run
The SAS documentation uses the optional
statement nloptions technrr
maxiter100 maxfunc1000 although this doesnt
seem to be necessary in this case.
46
Example Variable Star Data
Likelihood Optimization Algorithm
Converged in 36 Iterations.
Final Estimates of the Free
Parameters
Approx
Approx Component Parameter
Estimate Std Error t Value Pr gt
t Irregular Error Variance
0.09189 0.0053275 17.25 lt.0001
Cycle_1 Period
29.00027 0.0013891 20877.6 lt.0001
Cycle_1 Error Variance
5.32405E-12 4.15205E-9 0.00 0.9990
Cycle_2 Period
24.00010 0.0013330 18004.4 lt.0001
Cycle_2 Error Variance
3.82082E-12 3.54021E-9 0.00
0.9991 Fit
Statistics Based on Residuals
Mean Squared Error
0.19206 Root Mean
Squared Error 0.43825
Mean Absolute Percentage Error
2.72498
Maximum Percent Error 39.03001
R-Square
0.99759
Adjusted R-Square
0.99758 Random
Walk R-Square 0.96935
Amemiya's
Adjusted R-Square 0.99755
Note that the two cycles are essentially
deterministic and the results agree
with Bloomfields conclusions using a different,
but more laborious, approach.
47
Example Variable Star Data
Residual plot (with same scale on vertical axis)
looks better than the one-cycle model (see plot
on p. 44). (Again, its difficult for me to
conclude one of these plots is more random than
the other but the ACF reveals the truth)
48
Example Spirits Data
This last example uses data that accompanies the
program STAMP, which specializes in structural
models or UCMs. It illustrates the use of
explanatory variables in addition to a random
trend. The SAS results agree with STAMP. The
SPIRIT data set consists of annual observations
from 1870 to 1938 on the logarithms of three
variables, the per capita consumption of spirits
in the UK, per capita income, and the relative
price of spirits. The data set was used as a test
bed for the Durbin-Watson statistic in 1951. The
standard econometric approach for this data is to
estimate a regression model with a linear or
quadratic trend and an AR(1) disturbance. PROC
UCM will use a stochastic trend with the
explanatory variables.
49
Example Spirits Data
data spirits set sigstat.spirits year 1869
_n_ yr "0101" put(year,z4.) date
input(yr,mmddyy8.) run ods output
SmoothedTrend smtrend (rename
(actualspirits componentseriesSmoothedTrend
timedate) drop _group_ obs) ods output
SmoothedTrendReg smtrendreg (rename
(actualspirits componentseriesSmoothedTrendReg
timedate) drop _group_ obs) proc ucm
dataspirits id date intervalyear model
spirit price income irregular level slope
forecast lead0 printdecomp run
50
Example Spirits Data
Spirits Data from STAMP
The UCM
Procedure
Input Data Set
Name WORK.SPIRITS
Time ID Variable
date
Estimation Span Summary
First Last
Standard
Variable Type Obs Obs NObs NMiss
Min Max Mean
Deviation Spirit Dependent 1870 1938
69 0 1.25270 2.06780
1.77037 0.27116 Price Predictor
1870 1938 69 0 1.87270
2.50480 2.11838 0.20886 Income
Predictor 1870 1938 69 0
1.76690 2.12050 1.96215 0.09641

Forecast Span Summary
First Last
Standard Variable Type
Obs Obs NObs NMiss Min
Max Mean Deviation Spirit
Dependent 1870 1938 69 0
1.25270 2.06780 1.77037 0.27116
Price Predictor 1870 1938 69 0
1.87270 2.50480 2.11838
0.20886 Income Predictor 1870 1938
69 0 1.76690 2.12050 1.96215
0.09641

51
Example Spirits Data

Preliminary Estimates
of the Free Parameters
Component Parameter
Estimate
Irregular Error Variance 0.43736
Level Error
Variance 0.16401
Slope Error Variance
0.16401
Likelihood Based Fit Statistics
Full Log-Likelihood
155.24347 Diffuse
Part of Log-Likelihood 9.55142
Normalized Residual Sum of
Squares 64.99999
Akaike Information Criterion
-296.48693 Bayesian
Information Criterion -280.84819
Number of non-missing
observations used
for computing the log-likelihood 69
Likelihood Optimization Algorithm Converged in 8
Iterations.
52
Example Spirits Data

Final Estimates of the Free Parameters

Approx Approx
Component Parameter Estimate
Std Error t Value Pr gt t
Irregular Error Variance 0.00013377
0.00008042 1.66 0.0962
Level Error Variance 0.00009002
0.0001887 0.48 0.6333
Slope Error Variance 0.00002988
0.00002818 1.06 0.2889
Price Coefficient -0.94955
0.06701 -14.17 lt.0001
Income Coefficient 0.69492
0.12265 5.67 lt.0001

Number of non-missing residuals used
for computing the fit
statistics 65
Significance Analysis of Components
(Based on the Final
State)
Component DF Chi-Square Pr gt ChiSq
Irregular 1
0.07 0.7855
Level 1 48.31
lt.0001 Slope
1 1.58 0.2094
53
Example Spirits Data
54
Example Spirits Data
Write a Comment
User Comments (0)
About PowerShow.com