# CS计算机代考程序代写 data structure AFE Lab 2

AFE Lab 2
Unit Root tests and non-stationary time series
This set of exercises are adapted from Example 3.2 of Mills and Markellos (2008). We shall be using the same data as in Lab 1 ‘FTSE.csv’. The learn- ing objective is to understand (a) the unit root tests and (b) the difference between a trend stationary and a difference stationary process. We shall be exploring different unit root tests both manually and using built in tests in both Stata and R software packages.
Task 0: Before the start of the Lab session
Using your skills developed so far or the do file, RScript file you have from Lab 1,
(a) Open RStudio, open a new script file and save it in the same folder as in Lab 1. Set the working directory, load the data file ‘FTSE.csv’. Check the data structure with the command ‘str’. If the date variable is character, follow Lab 1 to format it to a numeric date variable. Convert the data as an xts object: FT xts. Generate the lags and difference variables as in Lab 1.
(b) Open Stata, create and save a do file and a log file, change working directory, and load the data file ‘FTSE.csv’. Check the data with the commands ‘des’, ‘sum’ and format the date variable as in Lab 1. Declare time series using the formatted date variable.
Task 1: The Dickey-Fuller (DF) and Augmented Dickey-Fuller (ADF) tests of unit root
(a) Plot a time series line graph to check the data. Do you think there is a trend in the variable?
Stata: tsline ftse R: plot(FT_xts)
(b) Let us run a simple DF test using the built in commands in Stata first. 1

dfuller ftse
– Write down the equation for the above DF test, the null and the alternative hypothesis.
– Does the series have a unit root?
(c) Let us run the same test using the built in commands in R and check if our conclusion from Stata matches. Install the package urca and run the following code:
install.packages(urca)
library(urca)
# DF test with intercept (drift), no lags (DF), no trend