For each of the time series you choose determine whether to transform it using logarithm, plot the original and transformed time series. Plot first differences of either original or log-transformed time series. Perform ADF, KPSS and ERS tests on either original or log-transformed time series. If these tests suggest the presence of a unit root also perform these tests for series in first differences, and if necessary also on second differences. Summarize the results of the tests - determine which time series appear to be I(0), I(1), I(2).
library(Quandl)
Quandl.api_key("KmxULt3z1Vz1neVxGioB")
rpce <- Quandl("FRED/A794RX0Q048SBEA", type = "zoo")
lrpce <- log(rpce)
dlrpce <- diff(lrpce)
Now we are going to check whether there is a trend or not.
plot(xts(rpce, order.by = index(rpce)), xlab="Year", ylab="", main="Real Personal Consumption Expenditures Per Capital")
plot(xts(lrpce, order.by = index(lrpce)), xlab="Year", ylab="", main="Logged Real Personal Consumption Expenditures Per Capital")
plot(xts(dlrpce, order.by = index(dlrpce)), xlab="Year", ylab="", main="Logged + Diff. Real Personal Consumption Expenditures Per Capital")
Both raw data and log transformed data have a deterministic trend(Model C).
The logged and differenciated data do not have a deterministic trend.
We performed ADF, KPSS, and ERS tests on log-transformed time series and first difference of log time series. The results of ADF, KPSS, and ERS tests indicate that first difference of log transformed time series does not have unit root. Therefore, we can presume I(1).
# ADF
library(tseries)
adf.test(lrpce)
##
## Augmented Dickey-Fuller Test
##
## data: lrpce
## Dickey-Fuller = -1.2427, Lag order = 6, p-value = 0.8951
## alternative hypothesis: stationary
adf.test(dlrpce)
##
## Augmented Dickey-Fuller Test
##
## data: dlrpce
## Dickey-Fuller = -5.7821, Lag order = 6, p-value = 0.01
## alternative hypothesis: stationary
# KPSS
library(tseries)
kpss.test(dlrpce, null="Trend")
##
## KPSS Test for Trend Stationarity
##
## data: dlrpce
## KPSS Trend = 0.094181, Truncation lag parameter = 3, p-value = 0.1
# ERS : P-test
library(urca)
dlrpce.urs1 <- ur.ers(dlrpce, type="P-test", model="trend")
summary(dlrpce.urs1)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type P-test
## detrending of series with intercept and trend
##
## Value of test-statistic is: 1.4007
##
## Critical values of P-test are:
## 1pct 5pct 10pct
## critical values 3.96 5.62 6.89
# ERS : DF-GLS test
library(urca)
dlrpce.urs2 <- ur.ers(dlrpce, type="DF-GLS", model="trend")
summary(dlrpce.urs2)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type DF-GLS
## detrending of series with intercept and trend
##
##
## Call:
## lm(formula = dfgls.form, data = data.dfgls)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.049531 -0.004098 -0.000192 0.003198 0.032589
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## yd.lag -0.55916 0.09178 -6.093 3.83e-09 ***
## yd.diff.lag1 -0.34986 0.08845 -3.955 9.78e-05 ***
## yd.diff.lag2 0.05094 0.08636 0.590 0.556
## yd.diff.lag3 0.09321 0.08103 1.150 0.251
## yd.diff.lag4 -0.02976 0.06033 -0.493 0.622
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.007794 on 269 degrees of freedom
## Multiple R-squared: 0.5079, Adjusted R-squared: 0.4988
## F-statistic: 55.53 on 5 and 269 DF, p-value: < 2.2e-16
##
##
## Value of test-statistic is: -6.0926
##
## Critical values of DF-GLS are:
## 1pct 5pct 10pct
## critical values -3.48 -2.89 -2.57
sp.all <- Quandl("YAHOO/INDEX_GSPC", type = "zoo")
sp <- sp.all$Close
lsp <- log(sp)
dlsp <- diff(lsp)
Now we are going to check whether there is a trend or not.
plot(xts(sp, order.by = index(sp)), xlab="Year", ylab="", main="S&P 500 Index")
plot(xts(lsp, order.by = index(lsp)), xlab="Year", ylab="", main="(Log) S&P 500 Index")
plot(xts(dlsp, order.by = index(dlsp)), xlab="Year", ylab="", main="(Log Diff.) S&P 500 Index")
Both raw data and log transformed data have a deterministic trend(Model C).
The logged and differenciated data do not have a deterministic trend.
We performed ADF, KPSS, and ERS tests on log-transformed time series and first difference of log time series. The results of ADF, KPSS, and ERS tests indicate that first difference of log transformed time series does not have unit root. Therefore, we can presume I(1).
# ADF
library(tseries)
adf.test(lsp)
##
## Augmented Dickey-Fuller Test
##
## data: lsp
## Dickey-Fuller = -2.2329, Lag order = 25, p-value = 0.4797
## alternative hypothesis: stationary
adf.test(dlsp)
##
## Augmented Dickey-Fuller Test
##
## data: dlsp
## Dickey-Fuller = -26.405, Lag order = 25, p-value = 0.01
## alternative hypothesis: stationary
# KPSS
kpss.test(dlsp, null="Trend")
##
## KPSS Test for Trend Stationarity
##
## data: dlsp
## KPSS Trend = 0.066239, Truncation lag parameter = 29, p-value =
## 0.1
# ERS : P-test
library(urca)
dlsp.urs1 <- ur.ers(dlsp, type="P-test", model="trend")
summary(dlsp.urs1)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type P-test
## detrending of series with intercept and trend
##
## Value of test-statistic is: 0.0134
##
## Critical values of P-test are:
## 1pct 5pct 10pct
## critical values 3.96 5.62 6.89
# ERS : DF-GLS test
dlsp.urs2 <- ur.ers(dlsp, type="DF-GLS", model="trend")
summary(dlsp.urs2)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type DF-GLS
## detrending of series with intercept and trend
##
##
## Call:
## lm(formula = dfgls.form, data = data.dfgls)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.216997 -0.006451 -0.001622 0.003481 0.131864
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## yd.lag -0.390294 0.011289 -34.57 <2e-16 ***
## yd.diff.lag1 -0.451084 0.011585 -38.94 <2e-16 ***
## yd.diff.lag2 -0.368314 0.011097 -33.19 <2e-16 ***
## yd.diff.lag3 -0.234705 0.009854 -23.82 <2e-16 ***
## yd.diff.lag4 -0.117211 0.007643 -15.34 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0103 on 16881 degrees of freedom
## Multiple R-squared: 0.4198, Adjusted R-squared: 0.4196
## F-statistic: 2443 on 5 and 16881 DF, p-value: < 2.2e-16
##
##
## Value of test-statistic is: -34.5717
##
## Critical values of DF-GLS are:
## 1pct 5pct 10pct
## critical values -3.48 -2.89 -2.57
gdp <- Quandl("FRED/GDPDEF", type = "zoo")
lgdp <- log(gdp)
dlgdp <- diff(lgdp)
ddlgdp = diff(dlgdp)
Now we are going to check whether there is a trend or not.
plot(xts(gdp, order.by = index(gdp)), xlab="Year", ylab="", main="Gross Domestic Product: Implicit Price Deflator")
plot(xts(lgdp, order.by = index(lgdp)), xlab="Year", ylab="", main="(Log) Gross Domestic Product: Implicit Price Deflator")
plot(xts(dlgdp, order.by = index(dlgdp)), xlab="Year", ylab="", main="(Log Diff.) Gross Domestic Product: Implicit Price Deflator")
plot(xts(ddlgdp, order.by = index(ddlgdp)), xlab="Year", ylab="", main="(Log Diff.) Gross Domestic Product: Implicit Price Deflator")
Both raw data and log transformed data have a deterministic trend(Model C).
The logged and differenciated data do not have a deterministic trend but it does not seem to be stanionary. Therefore, we condcuted second difference.
We performed ADF, KPSS, and ERS tests on log-transformed time series and first difference of log time series. The results of ADF, KPSS, and ERS tests indicate that first difference of log transformed time series does not have unit root. However, the results of ADF and KPSS are different. Thus, we conduct the tests of second difference data. he results of ADF, KPSS, and ERS tests indicate that second difference of log transformed time series does not have unit root, and the results of ADF and KPSS are the same. Therefore, we can presume I(2).
# ADF
library(tseries)
adf.test(lgdp)
##
## Augmented Dickey-Fuller Test
##
## data: lgdp
## Dickey-Fuller = -1.0427, Lag order = 6, p-value = 0.9304
## alternative hypothesis: stationary
adf.test(dlgdp)
##
## Augmented Dickey-Fuller Test
##
## data: dlgdp
## Dickey-Fuller = -3.5413, Lag order = 6, p-value = 0.03919
## alternative hypothesis: stationary
adf.test(ddlgdp)
##
## Augmented Dickey-Fuller Test
##
## data: ddlgdp
## Dickey-Fuller = -10.103, Lag order = 6, p-value = 0.01
## alternative hypothesis: stationary
# KPSS
kpss.test(dlgdp, null="Trend")
##
## KPSS Test for Trend Stationarity
##
## data: dlgdp
## KPSS Trend = 0.7009, Truncation lag parameter = 3, p-value = 0.01
# ERS : P-test
library(urca)
dlgdp.urs1 <- ur.ers(dlgdp, type="P-test", model="trend")
summary(dlgdp.urs1)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type P-test
## detrending of series with intercept and trend
##
## Value of test-statistic is: 2.7719
##
## Critical values of P-test are:
## 1pct 5pct 10pct
## critical values 3.96 5.62 6.89
# ERS : DF-GLS test
dlgdp.urs2 <- ur.ers(dlgdp, type="DF-GLS", model="trend")
summary(dlgdp.urs2)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type DF-GLS
## detrending of series with intercept and trend
##
##
## Call:
## lm(formula = dfgls.form, data = data.dfgls)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0225613 -0.0017828 -0.0002331 0.0013980 0.0182848
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## yd.lag -0.14752 0.04007 -3.682 0.00028 ***
## yd.diff.lag1 -0.27011 0.06529 -4.137 4.71e-05 ***
## yd.diff.lag2 -0.09393 0.06583 -1.427 0.15473
## yd.diff.lag3 0.06496 0.06427 1.011 0.31306
## yd.diff.lag4 0.04599 0.05916 0.778 0.43754
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.003774 on 269 degrees of freedom
## Multiple R-squared: 0.1701, Adjusted R-squared: 0.1546
## F-statistic: 11.03 on 5 and 269 DF, p-value: 1.136e-09
##
##
## Value of test-statistic is: -3.6818
##
## Critical values of DF-GLS are:
## 1pct 5pct 10pct
## critical values -3.48 -2.89 -2.57
# KPSS
kpss.test(ddlgdp, null="Trend")
##
## KPSS Test for Trend Stationarity
##
## data: ddlgdp
## KPSS Trend = 0.018593, Truncation lag parameter = 3, p-value = 0.1
# ERS : P-test
library(urca)
ddlgdp.urs1 <- ur.ers(ddlgdp, type="P-test", model="trend")
summary(ddlgdp.urs1)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type P-test
## detrending of series with intercept and trend
##
## Value of test-statistic is: 0.5416
##
## Critical values of P-test are:
## 1pct 5pct 10pct
## critical values 3.96 5.62 6.89
# ERS : DF-GLS test
ddlgdp.urs2 <- ur.ers(ddlgdp, type="DF-GLS", model="trend")
summary(ddlgdp.urs2)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type DF-GLS
## detrending of series with intercept and trend
##
##
## Call:
## lm(formula = dfgls.form, data = data.dfgls)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0294488 -0.0023297 -0.0004795 0.0011940 0.0162278
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## yd.lag -0.98483 0.15115 -6.515 3.57e-10 ***
## yd.diff.lag1 -0.27129 0.13758 -1.972 0.0497 *
## yd.diff.lag2 -0.27318 0.12037 -2.269 0.0240 *
## yd.diff.lag3 -0.12444 0.09442 -1.318 0.1887
## yd.diff.lag4 -0.01466 0.05876 -0.249 0.8032
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.004058 on 268 degrees of freedom
## Multiple R-squared: 0.634, Adjusted R-squared: 0.6272
## F-statistic: 92.85 on 5 and 268 DF, p-value: < 2.2e-16
##
##
## Value of test-statistic is: -6.5154
##
## Critical values of DF-GLS are:
## 1pct 5pct 10pct
## critical values -3.48 -2.89 -2.57
dgs <- Quandl("FRED/DGS10", type="zoo")
ldgs <- log(dgs)
dldgs <- diff(ldgs)
Now we are going to check whether there is a trend or not.
plot(xts(dgs, order.by = index(dgs)), xlab="Year", ylab="", main="10-Year Treasury Constant Maturity Rate")
plot(xts(ldgs, order.by = index(ldgs)), xlab="Year", ylab="", main="10-Year Treasury Constant Maturity Rate")
plot(xts(dldgs, order.by = index(dldgs)), xlab="Year", ylab="", main="10-Year Treasury Constant Maturity Rate")
Both raw data and log transformed data have a deterministic trend(Model B).
The logged and differenciated data do not have a deterministic trend.
We performed ADF, KPSS, and ERS tests on log-transformed time series and first difference of log time series. The results of ADF, KPSS, and ERS tests indicate that first difference of log transformed time series does not have unit root. Therefore, we can presume I(1).
# ADF
library(tseries)
adf.test(ldgs)
##
## Augmented Dickey-Fuller Test
##
## data: ldgs
## Dickey-Fuller = -2.2743, Lag order = 23, p-value = 0.4622
## alternative hypothesis: stationary
adf.test(dldgs)
##
## Augmented Dickey-Fuller Test
##
## data: dldgs
## Dickey-Fuller = -23.063, Lag order = 23, p-value = 0.01
## alternative hypothesis: stationary
# KPSS
kpss.test(dldgs, null="Trend")
##
## KPSS Test for Trend Stationarity
##
## data: dldgs
## KPSS Trend = 0.023913, Truncation lag parameter = 27, p-value =
## 0.1
# ERS : P-test
library(urca)
dldgs.urs1 <- ur.ers(dldgs, type="P-test", model="trend")
summary(dldgs.urs1)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type P-test
## detrending of series with intercept and trend
##
## Value of test-statistic is: 0.0178
##
## Critical values of P-test are:
## 1pct 5pct 10pct
## critical values 3.96 5.62 6.89
# ERS : DF-GLS test
dldgs.urs2 <- ur.ers(dldgs, type="DF-GLS", model="trend")
summary(dldgs.urs2)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type DF-GLS
## detrending of series with intercept and trend
##
##
## Call:
## lm(formula = dfgls.form, data = data.dfgls)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.184942 -0.002324 0.003321 0.007816 0.094627
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## yd.lag -0.598998 0.015010 -39.908 < 2e-16 ***
## yd.diff.lag1 -0.283956 0.014337 -19.806 < 2e-16 ***
## yd.diff.lag2 -0.219314 0.013160 -16.666 < 2e-16 ***
## yd.diff.lag3 -0.126455 0.011313 -11.177 < 2e-16 ***
## yd.diff.lag4 -0.059233 0.008513 -6.958 3.6e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.01326 on 13756 degrees of freedom
## Multiple R-squared: 0.4398, Adjusted R-squared: 0.4396
## F-statistic: 2160 on 5 and 13756 DF, p-value: < 2.2e-16
##
##
## Value of test-statistic is: -39.9077
##
## Critical values of DF-GLS are:
## 1pct 5pct 10pct
## critical values -3.48 -2.89 -2.57
lfp <- Quandl("FRED/CIVPART", type="zoo")
llfp <- log(lfp)
dllfp <- diff(llfp)
ddllfp = diff(dllfp)
Now we are going to check whether there is a trend or not.
plot(xts(lfp, order.by = index(lfp)), xlab="Year", ylab="", main="Labor Force Participation Rate")
plot(xts(llfp, order.by = index(llfp)), xlab="Year", ylab="", main="Labor Force Participation Rate")
plot(xts(dllfp, order.by = index(dllfp)), xlab="Year", ylab="", main="Labor Force Participation Rate")
plot(xts(ddllfp, order.by = index(ddllfp)), xlab="Year", ylab="", main="Labor Force Participation Rate")
Both raw data and log transformed data have a deterministic trend(Model B).
The logged and differenciated data do not have a deterministic trend.
We performed ADF, KPSS, and ERS tests on log-transformed time series and first difference of log time series. The results of ADF, KPSS, and ERS tests indicate that first difference of log transformed time series does not have unit root. However, the results of ADF and KPSS are different. Thus, we conduct the tests of second difference data. he results of ADF, KPSS, and ERS tests indicate that second difference of log transformed time series does not have unit root, and the results of ADF and KPSS are the same. Therefore, we can presume I(2).
# ADF
library(tseries)
adf.test(llfp)
##
## Augmented Dickey-Fuller Test
##
## data: llfp
## Dickey-Fuller = 0.84234, Lag order = 9, p-value = 0.99
## alternative hypothesis: stationary
adf.test(dllfp)
##
## Augmented Dickey-Fuller Test
##
## data: dllfp
## Dickey-Fuller = -9.9101, Lag order = 9, p-value = 0.01
## alternative hypothesis: stationary
adf.test(ddllfp)
##
## Augmented Dickey-Fuller Test
##
## data: ddllfp
## Dickey-Fuller = -17.669, Lag order = 9, p-value = 0.01
## alternative hypothesis: stationary
# KPSS
kpss.test(dllfp, null="Trend")
##
## KPSS Test for Trend Stationarity
##
## data: dllfp
## KPSS Trend = 0.27007, Truncation lag parameter = 6, p-value = 0.01
# ERS : P-test
library(urca)
dllfp.urs1 <- ur.ers(dllfp, type="P-test", model="trend")
summary(dllfp.urs1)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type P-test
## detrending of series with intercept and trend
##
## Value of test-statistic is: 0.3409
##
## Critical values of P-test are:
## 1pct 5pct 10pct
## critical values 3.96 5.62 6.89
# ERS : DF-GLS test
dllfp.urs2 <- ur.ers(dllfp, type="DF-GLS", model="trend")
summary(dllfp.urs2)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type DF-GLS
## detrending of series with intercept and trend
##
##
## Call:
## lm(formula = dfgls.form, data = data.dfgls)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0131935 -0.0021302 -0.0002437 0.0016600 0.0159664
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## yd.lag -0.25843 0.04670 -5.534 4.23e-08 ***
## yd.diff.lag1 -0.83125 0.05084 -16.349 < 2e-16 ***
## yd.diff.lag2 -0.66341 0.05354 -12.390 < 2e-16 ***
## yd.diff.lag3 -0.42093 0.04883 -8.621 < 2e-16 ***
## yd.diff.lag4 -0.17591 0.03371 -5.219 2.28e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.003367 on 818 degrees of freedom
## Multiple R-squared: 0.5665, Adjusted R-squared: 0.5638
## F-statistic: 213.8 on 5 and 818 DF, p-value: < 2.2e-16
##
##
## Value of test-statistic is: -5.5335
##
## Critical values of DF-GLS are:
## 1pct 5pct 10pct
## critical values -3.48 -2.89 -2.57
##Tests of second difference data
# KPSS
kpss.test(ddllfp, null="Trend")
##
## KPSS Test for Trend Stationarity
##
## data: ddllfp
## KPSS Trend = 0.006525, Truncation lag parameter = 6, p-value = 0.1
# ERS : P-test
library(urca)
ddllfp.urs1 <- ur.ers(ddllfp, type="P-test", model="trend")
summary(ddllfp.urs1)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type P-test
## detrending of series with intercept and trend
##
## Value of test-statistic is: 13.787
##
## Critical values of P-test are:
## 1pct 5pct 10pct
## critical values 3.96 5.62 6.89
# ERS : DF-GLS test
ddllfp.urs2 <- ur.ers(ddllfp, type="DF-GLS", model="trend")
summary(ddllfp.urs2)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type DF-GLS
## detrending of series with intercept and trend
##
##
## Call:
## lm(formula = dfgls.form, data = data.dfgls)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0148912 -0.0024208 -0.0000198 0.0024940 0.0236644
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## yd.lag -0.07144 0.02686 -2.66 0.00797 **
## yd.diff.lag1 -1.47131 0.03980 -36.97 < 2e-16 ***
## yd.diff.lag2 -1.39570 0.05552 -25.14 < 2e-16 ***
## yd.diff.lag3 -0.91510 0.05381 -17.01 < 2e-16 ***
## yd.diff.lag4 -0.34371 0.03209 -10.71 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.004366 on 817 degrees of freedom
## Multiple R-squared: 0.7719, Adjusted R-squared: 0.7705
## F-statistic: 553 on 5 and 817 DF, p-value: < 2.2e-16
##
##
## Value of test-statistic is: -2.6597
##
## Critical values of DF-GLS are:
## 1pct 5pct 10pct
## critical values -3.48 -2.89 -2.57
exj <- Quandl("FRED/EXJPUS", type="zoo")
lexj <- log(exj)
dlexj <- diff(lexj)
Now we are going to check whether there is a trend or not.
plot(xts(exj, order.by = index(exj)), xlab="Year", ylab="", main="Japan / U.K. Foreign Exchange Rate")
plot(xts(lexj, order.by = index(lexj)), xlab="Year", ylab="", main="(Log) Japan / U.K. Foreign Exchange Rate")
plot(xts(dlexj, order.by = index(dlexj)), xlab="Year", ylab="", main="(Log Diff) Japan / U.K. Foreign Exchange Rate")
Both raw data and log transformed data have a deterministic trend(Model C).
The logged and differenciated data do not have a deterministic trend.
We performed ADF, KPSS, and ERS tests on log-transformed time series and first difference of log time series. The results of ADF, KPSS, and ERS tests indicate that first difference of log transformed time series does not have unit root. Therefore, we can presume I(1).
# ADF
library(tseries)
adf.test(lexj)
##
## Augmented Dickey-Fuller Test
##
## data: lexj
## Dickey-Fuller = -2.0413, Lag order = 8, p-value = 0.5608
## alternative hypothesis: stationary
adf.test(dlexj)
##
## Augmented Dickey-Fuller Test
##
## data: dlexj
## Dickey-Fuller = -6.9831, Lag order = 8, p-value = 0.01
## alternative hypothesis: stationary
# KPSS
kpss.test(dlexj, null="Trend")
##
## KPSS Test for Trend Stationarity
##
## data: dlexj
## KPSS Trend = 0.03457, Truncation lag parameter = 5, p-value = 0.1
# ERS : P-test
library(urca)
dlexj.urs1 <- ur.ers(dlexj, type="P-test", model="trend")
summary(dlexj.urs1)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type P-test
## detrending of series with intercept and trend
##
## Value of test-statistic is: 0.3503
##
## Critical values of P-test are:
## 1pct 5pct 10pct
## critical values 3.96 5.62 6.89
# ERS : DF-GLS test
dlexj.urs2 <- ur.ers(dlexj, type="DF-GLS", model="trend")
summary(dlexj.urs2)
##
## ###############################################
## # Elliot, Rothenberg and Stock Unit Root Test #
## ###############################################
##
## Test of type DF-GLS
## detrending of series with intercept and trend
##
##
## Call:
## lm(formula = dfgls.form, data = data.dfgls)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.093483 -0.013630 0.001471 0.017841 0.076581
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## yd.lag -0.72964 0.07075 -10.313 <2e-16 ***
## yd.diff.lag1 0.06945 0.06613 1.050 0.2940
## yd.diff.lag2 0.02402 0.06016 0.399 0.6899
## yd.diff.lag3 0.07436 0.05180 1.436 0.1517
## yd.diff.lag4 0.08035 0.04316 1.862 0.0632 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.02542 on 543 degrees of freedom
## Multiple R-squared: 0.3424, Adjusted R-squared: 0.3363
## F-statistic: 56.55 on 5 and 543 DF, p-value: < 2.2e-16
##
##
## Value of test-statistic is: -10.3129
##
## Critical values of DF-GLS are:
## 1pct 5pct 10pct
## critical values -3.48 -2.89 -2.57
In short, we can conclude that time series of Category A (Real Personal Consumption Expenditures Per Capita), Category B (S&P 500 Index), Category D (10-Year Treasury Constant Maturity Rate), and Category F (Japan / U.K. Foreign Exchange Rate) apear to be I(1). Also, we can conclude that time series of Category C(Gross Domestic Product: Implicit Price Deflator) and Category E(Labor Force Participation Rate) apear to be I(2).