ECON60522 Applied Macroeconometrics
R Assessment II
The second R assessment must be submitted online by 23:59 on Friday 12 if
May, 2022. This assessment will account for 15% of the marks in ECON60522.
You are required to submit a written report, with your printed R output ap-
pended to this (you can knit your R code as well). You are advised to write
your student ID number on each page and to keep a copy of everything that
you submit. The assessment will be anonymously marked.
Marks will be allocated for appropriate (econometric) interpretation of re-
sults, as well as being able to use R for the analysis. No GARCH analysis will
be required for this assessment.
The names of the relevant data series can be found in the HW2 alloc 2022.xlsx.
data.Rdata on the Blackboard site for the course. You must analyse 4 specific
series which have been allocated to you (by ID number) in HW2 alloc 2022.xlsx
file. First three series are related to VAR and cointegration questions. The last
series is related to the TAR estimation. The first three series correspond to the
various US/UK interest rates (monthly frequency). The series in data.Rdata
are artificially generated.
Data sources: FRED database, simulated series from random number gen-
erator.
Using R, perform the following analysis, saving all your results to a file (see
nonstationary and VAR tutorials, and coint example1.pdf).
1. Identify the series using their names. Using pdfetch, download the series
from FRED. Graph the series and select a subsample for which all three
series are not missing
2. VAR
Use the series to estimate VAR process using var1 var2 var3 order.
Use BIC criterion to figure out the optimal number of lags.
Perform Cholesky decomposition based on the specification defined
earlier and print impulse response function up to sixty lags
Reestimate VAR using var3 var2 var1 order of variables. Plot impulse
response functions. Compare with the previous graph. If they are
not the same, Explain.
3. Cointegration
Use ADF and KPSS tests to decide whether the series have unit root.
Assuming they are, perform Johansen test for cointegration. What
version of the test will you use Discuss the results.
1
4. TAR model
Download a data from data.Rdata file (use the series assigned to you)
using command
loaddata.Rdata
and define a series
y = data$”variablenamefromexcelfile”
Limit your sample initially to the first 200 observation.
Assume that we know that c = 8, but we don’t know d. To identify
d, do the following:
– Using AIC, define an order of a process AR(p).
– For the determined AR(p) polynomial introduce set of dummies,
typing:
D1 = lag.xts(y, 1) > 8
D2 = lag.xts(y, 2) > 8
D3 = lag.xts(y, 3) > 8
D4 = lag.xts(y, 4) > 8
D5 = lag.xts(y, 5) > 8
D6 = lag.xts(y, 6) > 8
– For each dummy Di run the following regression:
yt = α0 + α2Di +
P∑
p=1
0pyt p +Di
P∑
p=1
2pyt p
Say, for P = 2, the model to estimate in R would be:
out < (lm(formula = y ~ 1+(lag.xts(y, 1)+lag.xts(y, 2)) (Di)))
summary(out)
and save R2i . Pick i that corresponds to the largest R
2. You
found the lag that triggers your model between two regimes.
Write down two equations that correspond to two different states.
Repeat your analysis for 500 observation.
Based on your R results, write a brief report (maximum 500 words) on your
findings. In particular, take care to cover the following aspects:
VAR
– Comment briefly on the characteristics of the data you analyze.
– Compare impulse response functions generated by different orderings
of the data. Explain if they are not the samen.
2
Cointegration
– Discuss the implications of including an intercept in the cointegration
equations.
– How many cointegrating relationships do you observe
– What would be the implications of a zero matrix Π Of a full-ranked
matrix Π
TAR
– Test the series for stationarity using KPSS and ADF tests. Compare
results. The data generating process IS stationary. How would you
explain the discrepancy (if any) between the tests results and your
knowledge about the process
– Write down the AR(p) equations that correspond to each of the two
different states that you estimate. Compare your findings for two
sample sizes (200 and 500). The data generating process for your
series is TAR with p = 2 and d which depends on the series. How
would you explain the discrepancy (if any) in p between your resulting
model and the data generating process
All statistical tests should be performed at the 5% level of significance, al-
though you may also wish to mention whether the conclusions are clear and
whether other significance levels (such as 10% or 1%) would lead to different
conclusions.
3