Professional Documents
Culture Documents
Stoil Pramatarov
Problem #1
.tsline lngdp
9.2
9
8.8
lngdp
8.6
8.4
8.2
We can see that this is a non-stationary stochastic process with a clear positive linear trend and
we must transform it to stationary. The reason for non-stationarity could be a deterministic trend
or a unit root.
. corrgram lngdp
-1 0 1 -1 0 1
LAG AC PAC Q Prob>Q [Autocorrelation] [Partial Autocor]
.
.ac lngdp
1.00
0.50
0.00
-0.50
-1.00
0 10 20 30 40
Lag
Bartlett's formula for MA(q) 95% confidence bands
.pac lngdp
1.00
0.50
0.00
-0.50
0 10 20 30 40
Lag
95% Confidence bands [se = 1/sqrt(n)]
From the first 20 lags we see that the model is at least AR (1) from the corrgraph, but maybe
even AR (2 or 3). Also, we have at least MA (1) or maybe MA (2) form the PACF graph.
. ac lngdp_dt
1.00
0.50
0.00
-0.50
0 10 20 30 40
Lag
Bartlett's formula for MA(q) 95% confidence bands
1.00
0.50
0.00
-0.50
0 10 20 30 40
Lag
95% Confidence bands [se = 1/sqrt(n)]
From the ACF graph we can see that AR(3) is in fact possible. And PACF indicates that MA(5)
is also possible. The ideal model must have no serial correlation and should have as much
ARIMA regression
OPG
lngdp_dt Coef. Std. Err. z P>|z| [95% Conf. Interval]
lngdp_dt
_cons -.0024852 .0023017 -1.08 0.280 -.0069964 .002026
ARMA
ar
L1. .9113501 .1668284 5.46 0.000 .5843725 1.238328
L2. .9729093 .2783564 3.50 0.000 .4273408 1.518478
L3. -.9042099 .1328807 -6.80 0.000 -1.164651 -.6437685
ma
L1. .2572648 2038.151 0.00 1.000 -3994.446 3994.961
L2. -.7920694 2581.025 -0.00 1.000 -5059.509 5057.925
L3. -.2213785 948.3596 -0.00 1.000 -1858.972 1858.529
L4. -.2079293 501.6224 -0.00 1.000 -983.3699 982.954
L5. -.0358886 74.32315 -0.00 1.000 -145.7066 145.6348
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
.arima lngdp_dt, ar(1/2) ma(1) is the a good model. The lower the AIC and BIC, the better.
ARIMA regression
OPG
lngdp_dt Coef. Std. Err. z P>|z| [95% Conf. Interval]
lngdp_dt
_cons .000694 .0073461 0.09 0.925 -.0137041 .0150921
ARMA
ar
L1. 1.712373 .1244745 13.76 0.000 1.468407 1.956338
L2. -.7562214 .1172441 -6.45 0.000 -.9860155 -.5264272
ma
L1. -.5167065 .174625 -2.96 0.003 -.8589653 -.1744478
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
0 10 20 30 40
Lag
Bartlett's formula for MA(q) 95% confidence bands
The graph above is the ACF and the graph below is PACF.
0.30
0.20
0.10
0.00
-0.10
-0.20
0 10 20 30 40
Lag
95% Confidence bands [se = 1/sqrt(n)]
ACF indicates AR(1) and PACF indicates at least MA(1) but it can be up to MA(5)
ARIMA regression
OPG
dlngdp Coef. Std. Err. z P>|z| [95% Conf. Interval]
dlngdp
_cons .0069254 .0011322 6.12 0.000 .0047063 .0091445
ARMA
ar
L1. .5777239 .2093146 2.76 0.006 .1674748 .9879729
ma
L1. -.2994382 .2514368 -1.19 0.234 -.7922452 .1933689
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
iv) Checking “estat ic” of lngdp_dt for ARMA(p,q) whith p-=0,1,2,3 and q=0,1,2,3 and
looking for the lowest values of AIC and BIC we see that the model would be ARMA
(2,1)
ARIMA regression
OPG
lngdp_dt Coef. Std. Err. z P>|z| [95% Conf. Interval]
lngdp_dt
_cons .000694 .0073461 0.09 0.925 -.0137041 .0150921
ARMA
ar
L1. 1.712373 .1244745 13.76 0.000 1.468407 1.956338
L2. -.7562214 .1172441 -6.45 0.000 -.9860155 -.5264272
ma
L1. -.5167065 .174625 -2.96 0.003 -.8589653 -.1744478
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
Performing the same check for dgdp ( We create “.gen dgpd = d.gnp96”)
we see that the model has only significant variables (as well as the previous) and lowest AIC and
BIC.
OPG
dgdp Coef. Std. Err. z P>|z| [95% Conf. Interval]
dgdp
_cons 42.72132 7.764164 5.50 0.000 27.50384 57.9388
ARMA
ar
L1. .7060583 .1299944 5.43 0.000 .451274 .9608426
ma
L1. -.3902875 .1839289 -2.12 0.034 -.7507815 -.0297935
Note: The test of the variance against zero is one sided, and the two-sided
confidence interval is truncated at zero.
. estat ic
We choose the former model as the best one since it has the highest Wald chi2(2) value.
v) Portmanteau test:
. wntestq res1
Problem #2
i)
. varsoc close
Selection-order criteria
Sample: 12jan2001 - 21dec2001, but with gaps
Number of obs = 42
Endogenous: close
Exogenous: _cons
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
close
L1. -.0345337 .0221076 -1.56 0.121 -.0782528 .0091854
LD. .046481 .0807481 0.58 0.566 -.1132033 .2061654
_trend -.0080875 .018719 -0.43 0.666 -.0451055 .0289305
_cons 41.85266 29.0328 1.44 0.152 -15.56147 99.26678
Ho: non-stationary
Ha: stationary
p-value (0.80) is higher than alpha, so we do not reject Ho, meaning that the time series is non-
stationary.
ii)
ACF:
0.20
0.10
0.00
-0.10
-0.20
0 10 20 30 40
Lag
Bartlett's formula for MA(q) 95% confidence bands
PACF:
0.20
0.10
0.00
-0.10
-0.20
0 10 20 30 40
Lag
95% Confidence bands [se = 1/sqrt(n)]
Both graphs suggest ARMA (0,0) or maybe MA(1), but it is unlikely. I think there is a problem
with the data because I have 51 missing values when graphing the ACF and PACF. The problem
started when I generated the d.lclose variable. Best model would be ARMA (0,0) since MA(1)
. predict res, r
(56 missing values generated)
. wntestq res
(note: time series has 51 gaps)
Since there is no serial correlation, the chosen model is a good choice for the best model.
Problem #5
i)
Selection-order criteria
Sample: 1990m5 - 2014m12 Number of obs = 296
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
lusdgbp
L1. -.0453838 .014444 -3.14 0.002 -.0738129 -.0169547
LD. .3813059 .0583912 6.53 0.000 .2663782 .4962335
L2D. -.1202452 .0622548 -1.93 0.054 -.2427773 .0022869
L3D. .1462402 .0619959 2.36 0.019 .0242176 .2682627
L4D. .003736 .0592175 0.06 0.950 -.112818 .1202901
_trend 8.19e-08 .0000146 0.01 0.996 -.0000287 .0000289
_cons -.022776 .0077368 -2.94 0.004 -.0380038 -.0075482
Ho: non-stationary
Ha: stationary
P-value (0.0966) is less than alpha (10%), so we reject Ho, meaning that the nominal ER is
stationary.
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
r_usdgbp
L1. -.0551341 .0157482 -3.50 0.001 -.0861302 -.0241379
LD. .3904644 .0580931 6.72 0.000 .2761236 .5048053
L2D. -.1300249 .0621897 -2.09 0.037 -.2524288 -.0076209
L3D. .1614893 .0617784 2.61 0.009 .0398948 .2830838
L4D. .0136806 .0592202 0.23 0.817 -.1028788 .1302399
_trend -.0000156 .0000155 -1.01 0.314 -.0000461 .0000149
_cons -.0238507 .0072517 -3.29 0.001 -.0381238 -.0095775
Here the P-value is 0.03 and again we reject Ho and we see that the real ER is also stationary.
5%
maximum trace critical
rank parms LL eigenvalue statistic value
0 14 1881.5139 . 13.6698* 15.41
1 17 1887.8902 0.04217 0.9172 3.76
2 18 1888.3488 0.00309
. predict res, r
Interpolated Dickey-Fuller
Test 1% Critical 5% Critical 10% Critical
Statistic Value Value Value
res
L1. -.0063282 .0096935 -0.65 0.514 -.0254073 .0127509
LD. .005477 .059226 0.09 0.926 -.1110937 .1220477
L2D. .0411249 .0570928 0.72 0.472 -.0712472 .1534969
L3D. -.147526 .0570991 -2.58 0.010 -.2599104 -.0351416
L4D. .025751 .0576745 0.45 0.656 -.087766 .1392681
_trend -5.09e-07 4.43e-06 -0.11 0.909 -9.23e-06 8.21e-06
_cons .000099 .0007285 0.14 0.892 -.0013349 .0015328
P-value (0.97) is higher than alpha so we do no reject Ho, meaning there is a unit root = no
cointegration.
Then we create:
Vector autoregression
dr_usdgbp
dr_usdgbp
L1. -.1324402 .2760863 -0.48 0.631 -.6735594 .4086789
dlusdgbp
L1. .4273131 .2825091 1.51 0.130 -.1263946 .9810208
dlusdgbp
dr_usdgbp
L1. -.1010777 .2708183 -0.37 0.709 -.6318718 .4297165
dlusdgbp
L1. .3754296 .2771186 1.35 0.175 -.167713 .9185722
.
iii)
Serial Independence:
. varlmar
Lagrange-multiplier test
1 2.2341 4 0.69279
2 3.5085 4 0.47658
Normality:
. varnorm
Jarque-Bera test
.05
0
0
-.05
-.05
95% CI forecast
observed