/* Apostolos Thomadakis
S2.125
Email: a.thomadakis@warwick.ac.uk
Personal webpage: https://sites.google.com/site/apostolosthomadakis/ */
cap log close
log using "H:\Documents\WESS\2016\Class1\gdp.smcl", replace
set more off
use "H:\Documents\WESS\2016\Class1\gdp.dta", clear
/*******************/
/* Questions 1 */
/*******************/
tsset
describe
sum deflator gdp gdp2005
tsline gdp2005
/* The upward trend of GDP over time is unmistakanle. The downward "hook" near
the end of the series is evidence of the recession that began in 2008. */
/*******************/
/* Questions 2 */
/*******************/
/* It is often useful to find a transformation that induces a straing-line relationship
between the variable of interest and trend. From the graph, it appears that GDP
is characterised by exponential growth, so a log transformation may be useful. */
generate lgdp2005 = log(gdp2005)
label variable lgdp2005 "Log of real GDP"
tsline lgdp2005
/*******************/
/* Questions 3 */
/*******************/
/* Fitting a straight line to this transformationof GDP provides an estimate of
trend growth. The slope of the regression line measures the average growth rate
of GDP. */
regress lgdp2005 date
display 400 * _b[date]
/* From 1947:1 through 2012:1, the USE economy as measured by GDP grew at an average
annual real rate if 3.2%. */
/*******************/
/* Questions 4 */
/*******************/
ac lgdp2005
/* The filled circles indicate the values of the autocorrelations. The dropeed lines
anchor the autocorrelations to 0. The shaded region indicates the 95% confidence
region.
The autocorrelations clearly decline linearly and do not collapse to 0. */
pac lgdp2005
/* Only the first two parial autocorrelations stand out, suggesting an AR(2)
process. */
/*******************/
/* Questions 5 */
/*******************/
arima lgdp2005, ar(1 2)
estat ic
/* Both AR coefficients are highly significant at 1%, however, they differ in sign
and magnitude.
Let's estimate different models and compoare them using information criteria. */
arima lgdp2005, ar(1)
estat ic
arima lgdp2005, ar(1 2 3)
estat ic
arima lgdp2005, ar(1 2 3 4)
estat ic
/*
Model AIC BIC
AR(1) -1526.888 -1516.194
AR(2) -1648.678 -1634.42
AR(3) -1659.772 -1641.95
AR(4) -1657.776 -1636.389
Both information criteria suggest AR(3), whcih is in contrast to what ACF and PACF
indicated. */
/*******************/
/* Questions 6 */
/*******************/
generate growth = lgdp2005 - L.lgdp2005
label variable growth "Growth rate of real GDP"
ac growth, name(ac, replace) lag(20)
pac growth, name(pac, replace) lag(20)
graph combine ac pac
/* Now the autocorrelations quickly collapse to insignificance. The first two stand
out, suggesting a first- or second-order MA process.
Only the first partial autocorrelation lies outside the 95% confidence band,
suggesting that a first-order AR process may be sufficient. So these sample statistics
point us in the direction of either an ARMA (1,1) or an ARM1(1,2) procees for GDP
grwoth. */
/*******************/
/* Questions 7 */
/*******************/
arima growth, arima(1,0,2)
/* NOTE: Stata rewrote our single-equation model as two equations. A wire range
of time series models can be recast as state-space models. A state-space model
describes the relationship between one or more observable time series and a vector
of unobservable state variables that characterize the "state of the world".
The model is composed of to equations:
- a measurement or observation equation, y=μ+η, that describes the relationship
between the observable variable y and the unobservable state variable η
- a transition or state equation, φ(L)η=θ(L)ε, that describes the evolution of the
state variable η given the the AR and MA components and the white-noise ε.
It can be shown that the μ in the original ARMA is replaced by (1-φ)μ in the state-space
representation. */
estat ic
display 400 * _b[growth:_cons]
/* The average growth rate is 3.1%, similar to our previous estimates.
The only parameter that is highly significant is the constant, μ, which is approximately
0.008. The second MA component is significant at 5% level. Sigma is roughly 0.009,
indicating that the variability of the white-noise disturbances is large relative
to the mean of the process. */
arima growth, arima(1,0,1)
estat ic
display 400 * _b[growth:_cons]
/*
Model AIC BIC
ARMA(1,2) -1695.886 -1678.083
ARMA(1,1) -1694.232 -1679.989
The overall fit of the model is about the same as before, but μ and the AR component
are significant, while the MA term is insignificant. The AR coefficient is twice
as large in this specification as it is in the ARMA(1,2) model, but the coefficients
are not significantly different from one anothee (look at the 95% confidence intervaks).
These results are not very encouraging. The data are not pinning down the coefficients
very precisely, which implies that the data are not providing a very precise estimate
of the dynamic response of GDP growth to economic shocks. */
/*******************/
/* EXTRA */
/*******************/
/* Let's estimate some pure AR processes
arima growth, ar(1)
estat ic
arima growth, ar(1 2)
estat ic
arima growth, ar(1 2 3)
estat ic
arima growth, ar(1 2 3 4)
estat ic
Model AIC BIC
AR(1) -1695.086 -1684.403
AR(2) -1695.035 -1680.792
AR(3) -1696.651 -1678.848
AR(4) -1696.284 -1674.92
AIC selects AR(3), while BIC sellects AR(1) */
/* Let's estimate some pure MA processes
arima growth, ma(1)
estat ic
arima growth, ma(1 2)
estat ic
arima growth, ma(1 2 3)
estat ic
arima growth, ma(1 2 3 4)
estat ic
MA(1) -1685.064 -1674.382
MA(2) -1696.533 -1682.29
MA(3) -1696.271 -1678.468
MA(4) -1694.321 -1672.957
Both AIC and BIC sellects MA(2) */
/* Let's estimate some ARMA processes
arima growth, arima(2,0,1)
estat ic
arima growth, arima(2,0,2)
estat ic
arima growth, arima(3,0,1)
estat ic
arima growth, arima(3,0,2)
estat ic
arima growth, arima(1,0,3)
estat ic
arima growth, arima(2,0,3)
estat ic
arima growth, arima(3,0,3)
estat ic
Model AIC BIC
ARMA(1,2) -1695.886 -1678.083
ARMA(1,1) -1694.232 -1679.989
ARMA(2,1) -1694.811 -1677.007
ARMA(2,2) -1697.853 -1676.489
ARMA(3,1) -1696.72 -1675.356
ARMA(3,2) -1702.557 -1676.632
ARMA(1,3) -1694.282 -1672.918
ARMA(2,3) -1699.139 -1674.214
ARMA(3,3) -1694.332 -1665.847
AIC selects ARMA(3,2), while BIC sellects ARMA(1,1) */
cap log close