Lab 4
Lab 4
Note for labs: Students will be rewarded a 5-mark bonus to their project mark for submitting the do-files (on
Learn) before labs (by Monday 9 am UK time). This bonus is applied to individual students after the group mark
has been set. To get the full bonus, you need to submit 5 out of 8 labs (1 mark bonus per accepted do-file). For
example, if your group mark for the project is 60 and you did all 5 labs, then your mark for the project will be 65.
The do-files should incorporate Stata codes, a brief description of why a specific line of code is executed, and a
short discussion of the results obtained. Do-files with insufficient information or explanations of the results
gathered will not be accepted. The produced results do not need to be correct to be awarded the bonus but have to
reflect a serious attempt at solving the questions. This has to be completed individually and reflect your work.
You are not allowed to copy from another student. That is considered academic misconduct (see
https://www.ed.ac.uk/academic-services/students/conduct/academic-misconduct/what-is-academic-misconduct
).
Question 1
(i) Generate two random walks (a yt and an xt) over 10,000 observations. Note
that you need to generate two separate error terms for this since we don’t
want the two series to be the same. Graph the two functions over time with
a line graph and comment on their relationship.
(iii) Predict the residual from the previous regression. Graph the residual over
time. Does it look like it follows a random walk or any other time series
process?
1
Question 2
(i) Find the first-order autocorrelation in log (invpc). Now, and the
autocorrelation after linearly detrending log (invpc). Do the same for log
(price). Which of the two series may have a unit root?
(ii) Now find the first-order autocorrelation for these variables using AR(1)
models with and without trends. Why are the answers slightly different to part
(i)?
(iii) Based on your findings in parts (i) and (ii), estimate the equation
and report the results in standard form. Interpret the predicted coefficient
b1 and determine whether it is statistically significant.
(iv) Linearly detrend log (invpct) and use the detrended version as the
dependent variable in the regression from part (iii) (see Section 10-5). What
happens to R2?
(v) Now use log (invpct) as the dependent variable. How do your results change
from part (iii)? Is the time trend still significant? Why or why not?
2
Question 3
This question uses CONSUMP data from Wooldridge's textbook. This is a yearly data
from 1959 to 1995. In particular, let's consider lc and ly, namely the natural log of per
capita real consumption and per capita real disposable income respectively.
(ii) Predict the residuals and plot them. Does this look like a stationary process?
What are the implications in terms of lc and ly being cointegrated?
(iii) Formally test your statement from (ii) using an augmented Dickey-Fuller
(ADF) test with a trend and one lag of ut . Hint: See help dfuller.
(iv) Repeat (iii) but this time run ADF manually and confirm the two
approaches return the same coefficients. Hint: You need to estimate the
underlying regression, using the command reg.
(v) Run the model in (i) but in first differences. Interpret the coefficient and
comment on whether this is statistically significant. Do you think we had a
spurious correlation in the first place?