library(readxl)
## Warning: package 'readxl' was built under R version 4.3.3
library(car)
## Warning: package 'car' was built under R version 4.3.3
## Loading required package: carData
library(zoo)
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(lmtest)
## Warning: package 'lmtest' was built under R version 4.3.3
library(urca)
library(fUnitRoots)
## Warning: package 'fUnitRoots' was built under R version 4.3.3
##
## Attaching package: 'fUnitRoots'
## The following objects are masked from 'package:urca':
##
## punitroot, qunitroot, unitrootTable
library(vars)
## Warning: package 'vars' was built under R version 4.3.3
## Loading required package: MASS
## Loading required package: strucchange
## Warning: package 'strucchange' was built under R version 4.3.3
## Loading required package: sandwich
## Warning: package 'sandwich' was built under R version 4.3.3
library(AER)
## Warning: package 'AER' was built under R version 4.3.3
## Loading required package: survival
load("D:/An_Sem3_2024/ResearchMethod/macro.RData")
load("D:/An_Sem3_2024/ResearchMethod/UKHP.RData")
load("D:/An_Sem3_2024/ResearchMethod/SandPhedge.RData")
load("D:/An_Sem3_2024/ResearchMethod/fred.RData")
inf_iv = ivreg(inflation ~ rsandp + dprod + dcredit + dmoney |
dcredit + dprod + rterm + dspread + dmoney, data = macro)
summary(inf_iv)
##
## Call:
## ivreg(formula = inflation ~ rsandp + dprod + dcredit + dmoney |
## dcredit + dprod + rterm + dspread + dmoney, data = macro)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.40799 -0.33680 -0.01575 0.31978 2.61026
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.212932 0.037096 5.740 1.94e-08 ***
## rsandp 0.103674 0.033564 3.089 0.00216 **
## dprod 0.030860 0.050326 0.613 0.54012
## dcredit -0.005182 0.001917 -2.704 0.00717 **
## dmoney -0.002787 0.001062 -2.624 0.00905 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5428 on 379 degrees of freedom
## Multiple R-Squared: -1.827, Adjusted R-squared: -1.857
## Wald test: 5.375 on 4 and 379 DF, p-value: 0.0003213
For the inflation regression: + Endogenous variable: Inflation + Exogenous variables: rsandp, dprod, dcredit, dmoney +Instrument variables: dcredit, dprod, rterm, dspread, dmoney.
ret_iv = ivreg(rsandp ~ inflation + dprod + dspread + rterm |
dcredit + dprod + rterm + dspread + dmoney, data = macro)
summary(ret_iv)
##
## Call:
## ivreg(formula = rsandp ~ inflation + dprod + dspread + rterm |
## dcredit + dprod + rterm + dspread + dmoney, data = macro)
##
## Residuals:
## Min 1Q Median 3Q Max
## -25.0829 -2.1293 0.2958 2.6311 11.9850
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.4802 0.6468 2.289 0.02266 *
## inflation -3.9592 2.8354 -1.396 0.16342
## dprod -0.1591 0.4045 -0.393 0.69437
## dspread -11.7333 3.7799 -3.104 0.00205 **
## rterm -0.3259 1.0564 -0.308 0.75791
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.391 on 379 degrees of freedom
## Multiple R-Squared: -0.01033, Adjusted R-squared: -0.02099
## Wald test: 3.612 on 4 and 379 DF, p-value: 0.006634
\(\textbf{For the return regression: Endogenous variable: return; Exogenous variables: inflation, dprod, dspread, and rterm; Instrument variables: dcredit, dprod, rterm, dspread, dmoney.}\)
\(\textbf{The results show that the stock index returns are a positive and significant determinant of inflation (changes in the money supply negatively affect inflation), while inflation has a negative effect on the stock market, albeit not significantly so.}\)
\(\textbf{Hausman test for the endogeneity of the inflation and stock return variables: To do this, we estimate the reduced form equations and add the fitted values to these equations. Hence, we run the simple OLS regressions and save the results as follows.}\)
inf_ols = lm(inflation ~ dprod + dspread + rterm + dcredit + dmoney, data = macro)
ret_ols = lm(rsandp ~ dprod + dspread + rterm + dcredit + dmoney , data = macro )
macro$inffit = c(NA, inf_ols$fitted.values )
macro$retfit = c(NA, ret_ols$fitted.values )
\(\textbf{Before we add the fitted values to the following two regressions.}\)
summary(lm(inflation ~ dprod + dcredit + dmoney + rsandp + retfit , data = macro))
##
## Call:
## lm(formula = inflation ~ dprod + dcredit + dmoney + rsandp +
## retfit, data = macro)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.68510 -0.15962 -0.01702 0.15680 0.99725
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.2129317 0.0202279 10.527 < 2e-16 ***
## dprod 0.0308597 0.0274420 1.125 0.261
## dcredit -0.0051825 0.0010452 -4.958 1.08e-06 ***
## dmoney -0.0027873 0.0005793 -4.811 2.17e-06 ***
## rsandp -0.0025990 0.0035490 -0.732 0.464
## retfit 0.1062734 0.0186425 5.701 2.41e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.296 on 378 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.1616, Adjusted R-squared: 0.1505
## F-statistic: 14.57 on 5 and 378 DF, p-value: 4.567e-13
\(\textbf{- The fitted stock return term is significant in the inflation equation, suggesting that stock returns are endogenous.}\)
summary(lm(rsandp ~ dprod + dspread + rterm + inflation + inffit , data = macro))
##
## Call:
## lm(formula = rsandp ~ dprod + dspread + rterm + inflation + inffit,
## data = macro)
##
## Residuals:
## Min 1Q Median 3Q Max
## -24.8624 -2.3098 0.4615 2.6055 11.3393
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.4802 0.6313 2.345 0.01957 *
## dprod -0.1591 0.3948 -0.403 0.68728
## dspread -11.7333 3.6895 -3.180 0.00159 **
## rterm -0.3259 1.0312 -0.316 0.75217
## inflation -0.5708 0.7617 -0.749 0.45410
## inffit -3.3885 2.8705 -1.180 0.23856
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.286 on 378 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.03994, Adjusted R-squared: 0.02724
## F-statistic: 3.145 on 5 and 378 DF, p-value: 0.008537
\(\textbf{- The inflation fitted value term is not significant in the stock return equation and so inflation can be considered exogenous for stock returns. Thus it would be valid to simply estimate this equation (minus the fitted value term) on its own using OLS.}\)
adfTest(UKHP$hp, lags = 10, type = "c")
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -0.3948
## P VALUE:
## 0.9039
##
## Description:
## Sat Aug 10 22:35:54 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.9039 > significant level (5%) --> Do not reject the null hypothesis. Hence the series is not stationary}\)
adfTest(UKHP$dhp, lags = 10, type = "c")
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -3.1191
## P VALUE:
## 0.02672
##
## Description:
## Sat Aug 10 22:35:54 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.02672 < significant level (5%) --> Reject the null hypothesis. Hence the series is stationary}\)
adfgls = urersTest(UKHP$hp, type ="DF-GLS", model = "trend", lag.max = 10)
adfgls@test$test@teststat
## [1] -1.681065
adfgls@test$test@cval
## 1pct 5pct 10pct
## critical values -3.48 -2.89 -2.57
\(\textbf{Under the null hypothesis is the series is not stationary. Because Test statistics TS = -1.681065 > Critical value at significant level (1%, 5%, 10%) --> Do not reject the null hypothesis. Hence the series is not stationary}\)
SandPhedge$rspot = c(NA,100*diff(log(SandPhedge$Spot)))
SandPhedge$rfutures = c(NA,100*diff(log(SandPhedge$Futures)))
SandPhedge$lspot = log(SandPhedge$Spot)
SandPhedge$lfutures = log(SandPhedge$Futures)
adfTest(SandPhedge$lspot, lags = 10, type = "c")
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -0.5569
## P VALUE:
## 0.8491
##
## Description:
## Sat Aug 10 22:35:55 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value =0.8491 > significant level (5%) --> Do not reject the null hypothesis. Hence the series is not stationary}\)
adfTest(SandPhedge$lfutures, lags = 10, type = "c")
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -0.5378
## P VALUE:
## 0.8562
##
## Description:
## Sat Aug 10 22:35:55 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.8562 > significant level (5%) --> Do not reject the null hypothesis. Hence the series is not stationary}\)
adfTest(diff(SandPhedge$lspot), lags = 10, type = "c")
## Warning in adfTest(diff(SandPhedge$lspot), lags = 10, type = "c"): p-value
## smaller than printed p-value
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -4.1973
## P VALUE:
## 0.01
##
## Description:
## Sat Aug 10 22:35:55 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.01 2 < significant level (5%) --> Reject the null hypothesis. Hence the series is stationary}\)
adfTest(diff(SandPhedge$lfutures), lags = 10, type = "c")
## Warning in adfTest(diff(SandPhedge$lfutures), lags = 10, type = "c"): p-value
## smaller than printed p-value
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -4.1957
## P VALUE:
## 0.01
##
## Description:
## Sat Aug 10 22:35:55 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.01 < significant level (5%) --> Reject the null hypothesis. Hence the series is stationary}\)
log_lm = lm(lspot ~ lfutures, data = SandPhedge)
par(lwd=2,cex.axis = 2)
plot(SandPhedge$Date,SandPhedge$lspot,type = "l",xlab = "",ylab = "",col="red")
lines(SandPhedge$Date,log_lm$fitted.values)
par(new=T)
plot(SandPhedge$Date,log_lm$residuals,col="blue",axes=F,type="l",xlab = "",ylab = "")
axis(side=4, at = pretty(range(log_lm$residuals)))
legend("bottomleft", legend=c("Actual", "Fitted"),col=c("black","red"),lty= 1)
legend("bottomright", legend=c("Resid"),col=c("blue"),lty= 1)
\(\textbf{- Short term relationship in 2
variables and long term relationship in error term. A plot of the levels
of the residuals (blue line), which looks much more like a stationary
series than the original spot series (the red line corresponding to the
actual values of y). Note how close together the actual and fitted lines
are - the two are virtually indistinguishable and hence the very small
right-hand scale for the residuals. }\)
urersTest(log_lm$residuals, type = "DF-GLS", model = "trend", lag.max = 12)@test$test@teststat
## [1] -1.458417
urersTest(log_lm$residuals, type = "DF-GLS", model = "trend", lag.max = 12)@test$test@cval
## 1pct 5pct 10pct
## critical values -3.48 -2.89 -2.57
\(\textbf{Under the null hypothesis is the series is not stationary. Because Test statistics TS = -1.458417 > Critical value at significant level (1%, 5%, 10%) --> Do not reject the null hypothesis. Hence the series is not stationary, the cointegration does not exist}\)
summary(lm(SandPhedge$rspot[-1] ~ SandPhedge$rfutures[-1] + log_lm$residuals[-247]))
##
## Call:
## lm(formula = SandPhedge$rspot[-1] ~ SandPhedge$rfutures[-1] +
## log_lm$residuals[-247])
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.44248 -0.06592 0.04480 0.17764 1.58732
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.009331 0.025210 0.370 0.712
## SandPhedge$rfutures[-1] 0.984771 0.005781 170.344 <2e-16 ***
## log_lm$residuals[-247] -55.060243 5.784972 -9.518 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3936 on 243 degrees of freedom
## Multiple R-squared: 0.9918, Adjusted R-squared: 0.9917
## F-statistic: 1.473e+04 on 2 and 243 DF, p-value: < 2.2e-16
\(\textbf{While the coefficient on the error correction term shows the expected negative sign, indicating that if the difference between the logs of the spot and futures prices is positive in one period, the spot price will fall during the next period to restore equilibrium, and vice versa, the size of the coefficient is not really plausible as it would imply a large adjustment. Given that the two series are not cointegrated, the results of the ECM need to be interpreted with caution and a model that regresses spot returns on futures returns, lagged spot and lagged futures returns, would be more appropriate}\)
pca = prcomp(fred[c("GS3M","GS6M","GS1","GS3","GS5","GS10")],scale. = T,retx = T)
plot(fred$Date , fred$GS3M , type ="l", xlab ="", ylab ="")
lines(fred$Date , fred$GS6M , col = "red")
lines(fred$Date , fred$GS1, col = "blue")
lines(fred$Date , fred$GS3, col = "brown")
lines(fred$Date , fred$GS5, col = "orange")
lines(fred$Date , fred$GS10, col ="darkgreen")
\(\textbf{- The series generally follow a
linear downward trend, though some series show stronger intertemporal
variation, with large drops, than other series. Additionally, while all
series seem to be related in some way, we find that the plots of some
rates resemble each other more strictly than others, e.g., the GS3M,
GS6M and GS1 rates}\)
adfTest(fred$GS3M, lags = 10, type = "c")
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -1.7014
## P VALUE:
## 0.4243
##
## Description:
## Sat Aug 10 22:35:56 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.4243 > significant level (5%) --> Do not reject the null hypothesis. Hence the series is not stationary}\)
adfTest(diff(fred$GS3M), lags = 10, type = "c")
## Warning in adfTest(diff(fred$GS3M), lags = 10, type = "c"): p-value smaller
## than printed p-value
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -5.936
## P VALUE:
## 0.01
##
## Description:
## Sat Aug 10 22:35:56 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.01 < significant level (5%) --> Reject the null hypothesis. Hence the series is stationary}\)
adfTest(fred$GS6M, lags = 10, type = "c")
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -1.7147
## P VALUE:
## 0.4193
##
## Description:
## Sat Aug 10 22:35:56 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.4193 > significant level (5%) --> Do not reject the null hypothesis. Hence the series is not stationary}\)
adfTest(diff(fred$GS6M), lags = 10, type = "c")
## Warning in adfTest(diff(fred$GS6M), lags = 10, type = "c"): p-value smaller
## than printed p-value
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -6.0334
## P VALUE:
## 0.01
##
## Description:
## Sat Aug 10 22:35:56 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.01 < significant level (5%) --> Reject the null hypothesis. Hence the series is stationary}\)
adfTest(fred$GS1, lags = 10, type = "c")
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -1.7484
## P VALUE:
## 0.4068
##
## Description:
## Sat Aug 10 22:35:56 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.4068 > significant level (5%) --> Do not reject the null hypothesis. Hence the series is not stationary}\)
adfTest(diff(fred$GS1), lags = 10, type = "c")
## Warning in adfTest(diff(fred$GS1), lags = 10, type = "c"): p-value smaller than
## printed p-value
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -5.9981
## P VALUE:
## 0.01
##
## Description:
## Sat Aug 10 22:35:56 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.01 < significant level (5%) --> Reject the null hypothesis. Hence the series is stationary}\)
adfTest(fred$GS3, lags = 10, type = "c")
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -1.6986
## P VALUE:
## 0.4254
##
## Description:
## Sat Aug 10 22:35:56 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.4254 > significant level (5%) --> Do not reject the null hypothesis. Hence the series is not stationary}\)
adfTest(diff(fred$GS3), lags = 10, type = "c")
## Warning in adfTest(diff(fred$GS3), lags = 10, type = "c"): p-value smaller than
## printed p-value
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -6.1679
## P VALUE:
## 0.01
##
## Description:
## Sat Aug 10 22:35:56 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.01 < significant level (5%) --> Reject the null hypothesis. Hence the series is stationary}\)
adfTest(fred$GS5, lags = 10, type = "c")
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -1.7323
## P VALUE:
## 0.4128
##
## Description:
## Sat Aug 10 22:35:56 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.4128 > significant level (5%) --> Do not reject the null hypothesis. Hence the series is not stationary}\)
adfTest(diff(fred$GS5), lags = 10, type = "c")
## Warning in adfTest(diff(fred$GS5), lags = 10, type = "c"): p-value smaller than
## printed p-value
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -6.3315
## P VALUE:
## 0.01
##
## Description:
## Sat Aug 10 22:35:56 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.01 < significant level (5%) --> Reject the null hypothesis. Hence the series is stationary}\)
adfTest(fred$GS10, lags = 10, type = "c")
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -1.6556
## P VALUE:
## 0.4414
##
## Description:
## Sat Aug 10 22:35:56 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.4414 > significant level (5%) --> Do not reject the null hypothesis. Hence the series is not stationary}\)
adfTest(diff(fred$GS10), lags = 10, type = "c")
## Warning in adfTest(diff(fred$GS10), lags = 10, type = "c"): p-value smaller
## than printed p-value
##
## Title:
## Augmented Dickey-Fuller Test
##
## Test Results:
## PARAMETER:
## Lag Order: 10
## STATISTIC:
## Dickey-Fuller: -6.5163
## P VALUE:
## 0.01
##
## Description:
## Sat Aug 10 22:35:56 2024 by user: Admin
\(\textbf{Under the null hypothesis is the series is not stationary. Because p-value = 0.01 < significant level (5%) --> Reject the null hypothesis. Hence the series is stationary}\) ## VECM
VARselect(fred[c("GS3M", "GS6M", "GS1", "GS3", "GS5", "GS10")], lag.max = 12)
## $selection
## AIC(n) HQ(n) SC(n) FPE(n)
## 2 2 2 2
##
## $criteria
## 1 2 3 4 5
## AIC(n) -3.048588e+01 -3.088381e+01 -3.087091e+01 -3.087216e+01 -3.082098e+01
## HQ(n) -3.032768e+01 -3.059002e+01 -3.044151e+01 -3.030717e+01 -3.012039e+01
## SC(n) -3.008544e+01 -3.014014e+01 -2.978399e+01 -2.944201e+01 -2.904759e+01
## FPE(n) 5.756508e-14 3.867052e-14 3.918238e-14 3.915114e-14 4.123784e-14
## 6 7 8 9 10
## AIC(n) -3.083823e+01 -3.081106e+01 -3.081602e+01 -3.074647e+01 -3.070735e+01
## HQ(n) -3.000205e+01 -2.983928e+01 -2.970863e+01 -2.950349e+01 -2.932877e+01
## SC(n) -2.872161e+01 -2.835121e+01 -2.801292e+01 -2.760014e+01 -2.721778e+01
## FPE(n) 4.057676e-14 4.175760e-14 4.163494e-14 4.474874e-14 4.668409e-14
## 11 12
## AIC(n) -3.065424e+01 -3.058976e+01
## HQ(n) -2.914007e+01 -2.893998e+01
## SC(n) -2.682144e+01 -2.641372e+01
## FPE(n) 4.942441e-14 5.296642e-14
\(\textbf{- The four information criteria provide conclusive results regarding the optimal lag length. All four criteria, FPE, AIC, HQIC and SBIC, suggest an optimal lag length of two.}\)
summary(ca.jo(fred[c("GS3M", "GS6M", "GS1", "GS3", "GS5", "GS10")], K = 2, ecdet = "const", type ="trace"))
##
## ######################
## # Johansen-Procedure #
## ######################
##
## Test type: trace statistic , without linear trend and constant in cointegration
##
## Eigenvalues (lambda):
## [1] 1.933608e-01 1.441940e-01 1.112046e-01 4.191212e-02 1.951328e-02
## [6] 1.837159e-02 -6.011223e-17
##
## Values of teststatistic and critical values of test:
##
## test 10pct 5pct 1pct
## r <= 5 | 8.07 7.52 9.24 12.97
## r <= 4 | 16.64 17.85 19.96 24.60
## r <= 3 | 35.26 32.00 34.91 41.07
## r <= 2 | 86.54 49.65 53.12 60.16
## r <= 1 | 154.28 71.86 76.07 84.45
## r = 0 | 247.75 97.18 102.14 111.01
##
## Eigenvectors, normalised to first column:
## (These are the cointegration relations)
##
## GS3M.l2 GS6M.l2 GS1.l2 GS3.l2 GS5.l2 GS10.l2
## GS3M.l2 1.0000000 1.0000000 1.0000000 1.00000 1.0000000 1.0000000
## GS6M.l2 -1.8361728 -1.7240301 -7.8260887 -45.44358 -2.2414315 -2.1083618
## GS1.l2 0.6584909 1.5591332 10.3520558 64.84908 1.0119005 0.4455494
## GS3.l2 0.7935402 -2.0124537 -9.3559469 36.99190 0.9399850 0.6478099
## GS5.l2 -0.7572572 1.4945981 8.5581204 -111.48938 -1.0083630 -7.7888536
## GS10.l2 0.1275615 -0.2493571 -2.7878414 55.56632 0.4129490 8.1180175
## constant 0.1581499 -0.1180595 0.5424579 -9.32844 -0.5161628 -5.7936204
## constant
## GS3M.l2 1.0000000
## GS6M.l2 0.7974764
## GS1.l2 -2.7026864
## GS3.l2 3.1335814
## GS5.l2 -11.5201333
## GS10.l2 11.7683970
## constant -28.8343237
##
## Weights W:
## (This is the loading matrix)
##
## GS3M.l2 GS6M.l2 GS1.l2 GS3.l2 GS5.l2
## GS3M.d 0.4401418 -0.27515704 0.03139674 0.0004933753 -0.04251249
## GS6M.d 0.6134722 -0.12926923 0.01290303 0.0000976568 -0.03596756
## GS1.d 0.5562986 -0.04534895 -0.01178610 -0.0001540930 -0.04416737
## GS3.d 0.4869795 0.16241326 -0.01436364 0.0006761659 -0.05816293
## GS5.d 0.5302487 0.18077756 -0.02830696 0.0011619122 -0.05582945
## GS10.d 0.5536302 0.18370135 -0.02705497 0.0006235189 -0.05394235
## GS10.l2 constant
## GS3M.d 0.0042441020 1.645681e-16
## GS6M.d 0.0053450249 3.471301e-16
## GS1.d 0.0059033018 3.844782e-16
## GS3.d 0.0046972595 6.173475e-16
## GS5.d 0.0025825107 7.030048e-16
## GS10.d -0.0001778005 5.828148e-16
\(H_0: r=0 \space vs \space H_a: r>0\) $TS = 247.75 > 102.14 = CV at 5% -> Not Reject H_0 $
\(H_0: r=1 \space vs \space H_a: r>1\) $o TS = 154 > 76 = CV at 5% -> Not Reject H_0 $
\(H_0: r=0 \space vs \space H_a: r>0\) $TS = 86 > 53 = CV at 5% -> Not Reject H_0 $
\(H_0: r=0 \space vs \space H_a: r>0\) $TS = 35 < 41 = CV at 5% -> Not Reject H_0 $
\(\textbf{Run VECM with r = 3}\)
vecm = ca.jo(fred[c("GS3M", "GS6M", "GS1", "GS3", "GS5", "GS10")], K = 2, ecdet = "const", type ="trace")
cajorls(vecm,r=3)
## $rlm
##
## Call:
## lm(formula = substitute(form1), data = data.mat)
##
## Coefficients:
## GS3M.d GS6M.d GS1.d GS3.d GS5.d
## ect1 0.1963815 0.4971060 0.4991636 0.6350292 0.6827193
## ect2 -0.5795111 -1.0045571 -0.8510384 -1.0617728 -1.0637614
## ect3 0.1858437 0.3359907 0.1736022 0.4252023 0.3379851
## GS3M.dl1 0.8046578 1.0052603 0.7937785 0.7297938 0.7851838
## GS6M.dl1 -1.3002259 -1.7480493 -1.3158642 -1.4676407 -1.4515766
## GS1.dl1 0.7261699 1.0482154 0.7538492 0.9610662 0.7470956
## GS3.dl1 0.3414507 -0.0154097 -0.0679247 -0.2322351 -0.0695104
## GS5.dl1 -0.1705721 0.2690776 0.4427480 0.5318636 0.3428756
## GS10.dl1 -0.0816765 -0.1924225 -0.2043656 -0.1335948 -0.0008461
## GS10.d
## ect1 0.7102766
## ect2 -1.1215328
## ect3 0.3709008
## GS3M.dl1 0.7296653
## GS6M.dl1 -1.3219279
## GS1.dl1 0.6686458
## GS3.dl1 -0.3048205
## GS5.dl1 0.4572949
## GS10.dl1 0.0573718
##
##
## $beta
## ect1 ect2 ect3
## GS3M.l2 1.000000e+00 -2.220446e-16 -3.122502e-17
## GS6M.l2 0.000000e+00 1.000000e+00 5.551115e-17
## GS1.l2 -4.440892e-16 -2.220446e-16 1.000000e+00
## GS3.l2 -2.499094e+00 -2.786098e+00 -2.768639e+00
## GS5.l2 1.573232e+00 2.073284e+00 2.242124e+00
## GS10.l2 9.893932e-02 -1.585894e-01 -3.987532e-01
## constant -5.346689e-01 -4.664695e-01 -2.485984e-01
cajorls(vecm,r=3)$rlm
##
## Call:
## lm(formula = substitute(form1), data = data.mat)
##
## Coefficients:
## GS3M.d GS6M.d GS1.d GS3.d GS5.d
## ect1 0.1963815 0.4971060 0.4991636 0.6350292 0.6827193
## ect2 -0.5795111 -1.0045571 -0.8510384 -1.0617728 -1.0637614
## ect3 0.1858437 0.3359907 0.1736022 0.4252023 0.3379851
## GS3M.dl1 0.8046578 1.0052603 0.7937785 0.7297938 0.7851838
## GS6M.dl1 -1.3002259 -1.7480493 -1.3158642 -1.4676407 -1.4515766
## GS1.dl1 0.7261699 1.0482154 0.7538492 0.9610662 0.7470956
## GS3.dl1 0.3414507 -0.0154097 -0.0679247 -0.2322351 -0.0695104
## GS5.dl1 -0.1705721 0.2690776 0.4427480 0.5318636 0.3428756
## GS10.dl1 -0.0816765 -0.1924225 -0.2043656 -0.1335948 -0.0008461
## GS10.d
## ect1 0.7102766
## ect2 -1.1215328
## ect3 0.3709008
## GS3M.dl1 0.7296653
## GS6M.dl1 -1.3219279
## GS1.dl1 0.6686458
## GS3.dl1 -0.3048205
## GS5.dl1 0.4572949
## GS10.dl1 0.0573718
cajorls(vecm,r=3)$beta
## ect1 ect2 ect3
## GS3M.l2 1.000000e+00 -2.220446e-16 -3.122502e-17
## GS6M.l2 0.000000e+00 1.000000e+00 5.551115e-17
## GS1.l2 -4.440892e-16 -2.220446e-16 1.000000e+00
## GS3.l2 -2.499094e+00 -2.786098e+00 -2.768639e+00
## GS5.l2 1.573232e+00 2.073284e+00 2.242124e+00
## GS10.l2 9.893932e-02 -1.585894e-01 -3.987532e-01
## constant -5.346689e-01 -4.664695e-01 -2.485984e-01
H = matrix(c(0,0,1,0,0,0,0), c(7,1))
A = matrix(c(0,0,1,0,0,0,0), c(7,1))
summary(blrtest(vecm,H=H, r=1))
##
## ######################
## # Johansen-Procedure #
## ######################
##
## Estimation and testing under linear restrictions on beta
##
## The VECM has been estimated subject to:
## beta=H*phi and/or alpha=A*psi
##
## [,1]
## [1,] 0
## [2,] 0
## [3,] 1
## [4,] 0
## [5,] 0
## [6,] 0
## [7,] 0
##
## Eigenvalues of restricted VAR (lambda):
## [1] 0.0297
##
## The value of the likelihood ratio test statistic:
## 80.36 distributed as chi square with 6 df.
## The p-value of the test statistic is: 0
##
## Eigenvectors, normalised to first column
## of the restricted VAR:
##
## [,1]
## [1,] NaN
## [2,] NaN
## [3,] Inf
## [4,] NaN
## [5,] NaN
## [6,] NaN
## [7,] NaN
##
## Weights W of the restricted VAR:
##
## [,1]
## GS3M.d NaN
## GS6M.d NaN
## GS1.d NaN
## GS3.d NaN
## GS5.d NaN
## GS10.d NaN