Economics 384
Time Series Econometrics
Write a Matlab or Stata code for each of the sections below. In a separate document
to be submitted, briey describe your answers when requested. If you do not know what
some of the indicated tests or procedures are, look them up in a textbook or google them.
1 Random Numbers, Moving Averages, and Autoregressive
Processes
1. Generate 100 standard normal random numbers and check the properties of normality
of the created variable using the Jarque-Bera test.
2. Generate 100 numbers randomly drawn from a Students T distribution with 3 degrees
of freedom. Use the Jarque-Bera test to check if the generated data are normal. In
particular, pay attention to the entity of excess kurtosis.
3. Generate several other sequences of numbers randomly drawn from Students T dis-
tributions with an increasing number of degrees of freedom. Empirically determine
for which number of degrees of freedom the Jarque-Bera test stops rejecting the null
of normality.
4. Generate a sequence of 100 numbers randomly drawn from a 22 distribution. Empiri-
cally determine the 5% critical value of a random variable with such a distribution. In
other words, from the histogram of the randomly generated data, you should determine
the value along the horizontal axis that leaves 5% of the total number of observations
on its right-hand side. Increase the number of observations in the sample to improve
the accuracy of your result and compare.
5. Generate a sequence of 200 numbers randomly (and independently) drawn from a
normal distribution with mean equal to 0 and variance equal to 2. Analyze with a
correlogram the properties of the generated variable. Is it a white noise process?
6. Generate four di¤erent moving average processes using a previously created Gaussian
white noise. Check the correlogram of each process. What can you say about their
autocorrelation structures? What is the relationship between the order of the moving
average process and the lag in correspondence to which the autocorrelation becomes
statistically non-di¤erent from zero?
1
7. Generate two moving average processes,
yt = "t + 0:5"t1
xt = "t + 2"t1.
Check their correlograms. Are these two variables stationary? Do you see substantial
di¤erences between the two variables in terms of their autocorrelation structure? Take
the two generated series and estimate an MA(1) model on each of them. What do
you notice? Can you explain what is happening?
Now take the di¤erence between the two processes,
zt = yt xt,
and check its empirical autocorrelation structure. Explain what you see.
Consider yt again. Express the corresponding stochastic process using the lag opera-
tor. What can you say about the invertibility property of the resulting lag polynomial?
Can you express yt as an autoregressive process of order 1? Derive the AR(1) rep-
resentation of yt.
Consider the AR(1) representation of yt and approximate it with a reasonable num-
ber of lags, say 10. Estimate an AR(10) model for yt and compare the estimated
coe¢ cients with the corresponding theoretical coe¢ cients in the AR(1) representa-
tion of yt. Report them in a table. Save the residuals and compare them with the
values in the white noise series that you used to generate yt in the
rst place. Explain.
2 ARIMA Models
In class we saw that, if we want to estimate an ARMA model, we should use least-squares or
maximum likelihood techniques. In most situations, the objective function to be optimized
is non-linear. We will use a simple MA(1) process to understand how an iterative algorithm
can be devised to estimate the parameters of a model. For this purpose, follow the steps
described below.
1. Using a sample of 300 observations, generate the MA(1) process
yt = "t + 0:7"t1
after creating a standard Gaussian white noise (make sure you actually generated a
white noise variable!)
2. By OLS, estimate the equation
yt = "t + "t1
and keep track of the estimated value of , the standard error of the regression,p
b2 =
qPT
t=1b"
2t
TK ; and the sum of squared residuals,
PT
t=1b"
2
t.
3. Pretend for a moment that the software you are using is not able to directly estimate
the equation above. We could try to implement an ad-hoc iterative procedure with
the purpose of estimating . We shall proceed in the following way.
2
(a) Note that, if the true process is yt = "t + "t1, then "t = yt "t1 and we can
construct a sequence of values f"tgTt=1 starting from an initial value "0, an initial
hypothesis on , and the knowledge of yt, which is the data we observe.
(b) Given that "0 is not known, we can set it equal to its expected value, which is 0.
We can generate several sequences f"tgTt=1 using di¤erent values of .
(c) We can choose (as our point estimate) the value of that minimizes, exactly as
in the OLS framework, the sum of the squared errors, PTt=1"2t, or, equivalently,
the expression,
qPT
t=1 "2tTK . Note that this procedure requires j j < 1, so that
the initial condition does not lose its importance for the generation of "t as the
time index increases. For this reason, when iterative algorithms of this kind are
used, the unique invertible representation of the series is always estimated; the
non-invertible representation of the process describing the data is disregarded.
Now write a short code to implement the procedure described above for di¤erent initial
values of . Save the sum of the squared errors generated at each replication (that is,
for each value of ) in a storage variable. Plot that storage variable at the end of the
iterative procedure against the set of initial values of that you used. What is the
minimizer of the storage variable?
4. Select and download
ve time series from FRED, the database of the Federal Reserve
Bank of St. Louis. Estimate the best ARIMA model for each of those series. Apply
all the techniques that we have seen in class and show your work. You can answer
this question without writing a speci
c code.
3 ARCH and GARCH Models
We will see how to use ARCH and GARCH models to analyze the volatility of a stock
market index. Volatility is a particularly interesting feature of the data, especially if the
frequency of the dataset is high. We will examine weekly data. The weekly data in the
le
dowjones.txt correspond to the closing prices of the Dow Jones index reported on Wednes-
days. The choice of this day of the week is motivated by the fact that anomalies and outliers
are more likely to occur at the beginning and the end of each trading week. Wednesday
data generally appear to be more robust to transitory disturbances. The period of analysis
is June 1896 to March 2012. From now on, we will consider the natural logarithm of the
Dow Jones series.
1. Determine if the time series has a unit root by using an augmented Dickey-Fuller test.
Compare the results of a test in which the number of lags in the augmentation of the
test regression is determined automatically on the basis of an information criterion of
your choice and the results of a test in which the number of lags is set equal to 52
(i.e., the number of weeks in one year).
2. Determine the order of integration of the time series. Explain.
3. If you look at the graphical evolution of the time series, you will notice a few anomalies.
Speci
cally, you will see sharp drops in correspondence of episodes of stock market
crashes (in 1929, 1974, 1987, 2002, and 2009, for example). One could argue that
a unit root test performed on the entire sample would be a¤ected by the presence
of these sudden drops. To validate the results of your previous analysis, re-run the
test on a few subsamples (between market crashes) and check if you get to the same
conclusion.
3
4. Now consider the series of weekly returns (compute it using the logarithmic transfor-
mation of the original Dow Jones series). Check if the series is a white noise and if
its distribution is normal. What are the values of skewness and kurtosis? Repeat the
analysis for di¤erent subsamples to check the robustness of the statistical properties
of the variable over time.
5. Analyze the graph of weekly returns. What can you say about its variance and its
mean?
6. How would you model the mean? How would you model the variance?
7. If you are thinking about the possibility of using an ARCH or GARCH model for
the mean and variance of the weekly returns, you can test for the presence of ARCH
e¤ects using the following approach.
(a) Run a regression of the weekly returns on a constant term (for simplicity, assume
that the weekly returns do not depend on any exogenous variables).
(b) Take the residuals of the regression and square them.
(c) The squared residuals are a representation of the conditional volatility properties
of the series over the subsample you are using.
(d) Observe their graph.
(e) Analyze the correlogram of the squared residuals.
(f) Run a Lagrange multiplier test on the squared residuals. In other words, regress
the squared residuals on a constant term and their lagged values (you choose
how many). Then test the null hypothesis that all coe¢ cients associated with
the lagged values are jointly equal to zero. If you reject the null, this is indication
that the weekly returns should be modelled using an ARCH or GARCH model.
(g) Repeat the test using di¤erent lags and assess the opportunity of estimating an
ARCH model with a relatively high number of lags versus the opportunity of
estimating a potentially more parsimoniousGARCH model. Use the information
criteria you know where and when appropriate. Assume normal error terms.
8. Test the possibility of using an IGARCH by running an appropriate Wald test on
the coe¢ cients of the variance equation of your GARCH speci
cation(s).
9. The goodness of the models you have estimated should be assessed not just in terms
of parsimony. For example, one should also verify if the model is able to replicate the
volatility clustering properties of the original series and/or the moments of its distri-
bution. To do so, follow these steps (make sure you use exactly the same subsamples
you used above when estimating the models).
(a) From the GARCH output, generate the series representing the estimated con-
ditional variance of the weekly returns.
(b) Subtract the estimated coe¢ cient in the GARCH mean equation from the series
of weekly returns. Square the resulting series.
(c) Compare graphically the two series obtained in this way (points a and b). Ob-
serve their correlation coe¢ cient. Explain.
(d) Compare the distribution of the standardized series of weekly returns with the
distribution of the following transformation of the GARCH residuals, but:
bust;t = butq
bht
,
4
where bht is the GARCH variance series obtained from point a. In particular,
check the values of skewness and kurtosis.
A common
nding is that conditional heteroskedasticity models are able to attenuate,
sometimes by a lot, but are not able to completely eliminate, the kurtosis e¤ects
which are present in a time series. Thus, the residuals tend to remain non-normal.
The obvious consequence is unreliable standard errors. However, standard errors can
be corrected. In order to address the non-normality issue, one can choose a di¤erent
distributional assumption for the error term. For example, a T distribution with a
low number of degrees of freedom could be used to model excess kurtosis. Remember
that a T distribution has fatter tails than a normal distribution. Re-estimate your
ARCH or GARCH models using an appropriate T distribution for the error terms.
10. Estimate the best conditional heteroskedasticity model over two subsamples of your
choice. Initially assume normality of the error term. Explain the results. Assess the
sensitivity of your results when you change assumption on the distribution of the error
term.
4 Detrending Macroeconomic Time Series
For this part, use the monthly series of the U.S. industrial production index in the
le
production.txt. The relevant series, in levels, is named indpro and refers to the period
1919-2011. As usual, model the natural logarithm of the variable of interest.
1. Detrend the series using a deterministic polynomial of order one.
2. Detrend the series using the HP
lter.
3. Detrend the series using the Baxter-King
lter.
4. Test for the presence of a unit root in the series. If you
nd a unit root, apply an
appropriate transformation (the
rst di¤erence) to remove the stochastic trend from
the series and make it I (0).
5. Plot on the same graph the four I (0) components of the original series estimated
following the four di¤erent methods proposed above. Compare and explain the di¤er-
ences.
6. Baxter and King (1999) show that a symmetric moving average with the sum of the
weights equal to one is able to generate an I (0) variable from series containing a linear
or quadratic trend or a stochastic trend. To see this property, consider the following
example based on arti
cial data and a sample of 150 observations.
(a) Generate a series, ut, of independent standard normal numbers.
(b) Generate a time index, t.
(c) Generate the process
ylt = 0:1t+ 0:01t2 +ut.
(d) Generate the process
yst = 0:5 +yst1 + 0:7yst1 yst2+ut.
5
ylt is an arti
cial series with a quadratic trend. yst is an arti
cial series with a stochastic
trend and drift. Now apply the
lters
yl;bkt = ylt 0:5
ylt1 +ylt+1
ys;bkt = yst 0:5yst1 +yst+1
Plot the series just created and analyze their correlograms. Determine if the detrended
series (the moving averages just computed on ylt and yst) are I (0).
7. The length of the moving average and its weights are crucial for the determination of
the cyclical properties of the generated series. Using the same arti
cial data, ylt and
yst, try di¤erent lengths and weighting schemes. Compare the plots of the resulting
moving averages and their correlograms.
8. When we try to detrend a macroeconomic time series (GDP, industrial production,
consumption, investment, etc.), our ultimate goal is to isolate the cyclical components
at the business cycle frequency. According to the NBER, the U.S. business cycles
exhibit durations between 2 and 8 years. Based on spectral analysis considerations,
Baxter and King (1999) argue that the optimal choice of the weights in the moving
average should be able to produce a band-pass
lter between these two frequencies.
For quarterly data, the frequencies corresponding to the U.S. business cycles should
be included between 6 and 32 quarters. They suggest that the optimal length of the
moving average should be equal to three years on each side. The consequence is that,
when we apply the Baxter-King
lter, we lose 3 observations at the beginning and 3
observations at the end of the sample, if we use annual data. With quarterly data we
lose 12 observations at the beginning and 12 at the end of the sample. Baxter and
King (1999) also suggest the optimal weights:
Lag BP(6,32) - Quarterly Data BP(2,8) - Annual Data
yt contains a pure sinusoidal oscillation with a frequency corresponding to 5 years.
A Baxter-King
lter would do a good job at detrending such a variable if the 5-year
6
frequency were conserved and all the other frequencies were
ltered out. Under the
assumption that the generated series is annual, apply a Baxter-King
lter on yt using
the described moving-average approach and the weights reported in the table above.
Also apply the Baxter-King procedure using the corresponding built-in function of
the software you are using. Compare the two results, then apply the HP
lter.
Plot and compare the three cyclical components obtained from the application of
the three
lters with the c5t series. Which
ltering technique yields better results?
Provide a quantitative measure to support your conclusion.