First, we load the USA dataset, declaring its time series nature.

library(urca)
library(vars)
## Loading required package: MASS
## Loading required package: strucchange
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Loading required package: sandwich
## Loading required package: lmtest
library(xts)
tab <- read.csv("powerng1.csv", header=T)
tab$Date <- as.Date(tab$Date,"%Y/%m/%d")
names(tab)
## [1] "Date"   "Power"  "NatGas"
plot(as.Date(tab$Date),tab$Power,type="l",col="red",ylim=range(10:150),xlab="", ylab="$/MWh")
lines(as.Date(tab$Date),tab$NatGas,col="blue")
legend("topright",c("Power","NatGas"),title="USA",col=c("red","blue"),lty=c(1,1),lwd=c(1,1),bty="n")

x1 <- diff(tab$Power,1)
x2 <- diff(tab$NatGas,1)
plot(x1,type="l",col="red") 
lines(x2,col="blue")
legend("topright",c("Power","NatGas"),col=c("red","blue"),lty=c(1,1),lwd=c(1,1),bty="n")

summary(ur.kpss(tab$Power))
## 
## ####################### 
## # KPSS Unit Root Test # 
## ####################### 
## 
## Test is of type: mu with 5 lags. 
## 
## Value of test-statistic is: 1.8036 
## 
## Critical value for a significance level of: 
##                 10pct  5pct 2.5pct  1pct
## critical values 0.347 0.463  0.574 0.739
summary(ur.kpss(tab$NatGas))
## 
## ####################### 
## # KPSS Unit Root Test # 
## ####################### 
## 
## Test is of type: mu with 5 lags. 
## 
## Value of test-statistic is: 1.4438 
## 
## Critical value for a significance level of: 
##                 10pct  5pct 2.5pct  1pct
## critical values 0.347 0.463  0.574 0.739
ur.kpss(diff(tab$Power,1))
## 
## ####################################### 
## # KPSS Unit Root / Cointegration Test # 
## ####################################### 
## 
## The value of the test statistic is: 0.0605
ur.kpss(diff(tab$NatGas,1))
## 
## ####################################### 
## # KPSS Unit Root / Cointegration Test # 
## ####################################### 
## 
## The value of the test statistic is: 0.0584

Very large t-stat for both variables indicative of unit root. Since first order differencing eliminates the unit root, the maximum order of integration is concluded to be I(1). Since the optimal lag is 5, we set up the econometric model with 6 lags.

tmp <- tab[,2:3] 
momo1<-VAR(tmp,p=6,type="both")
#summary(momo1)
causality(momo1,'Power')
## $Granger
## 
##  Granger causality H0: Power do not Granger-cause NatGas
## 
## data:  VAR object momo1
## F-Test = 0.31615, df1 = 6, df2 = 484, p-value = 0.9286
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: Power and NatGas
## 
## data:  VAR object momo1
## Chi-squared = 32.651, df = 1, p-value = 1.103e-08
causality(momo1,'NatGas')
## $Granger
## 
##  Granger causality H0: NatGas do not Granger-cause Power
## 
## data:  VAR object momo1
## F-Test = 5.6376, df1 = 6, df2 = 484, p-value = 1.13e-05
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: NatGas and Power
## 
## data:  VAR object momo1
## Chi-squared = 32.651, df = 1, p-value = 1.103e-08

Power -> NatGas has p-value 92% thus definitely does not cause but NatGas -> Power has p-value so small (<1‰) it clearly causes power price movements

test for var(5) which does not count the cointegration, we obtain the same qualitative results.

momo2 <- VAR(tmp,p=5,type="both")
causality(momo2,'Power')
## $Granger
## 
##  Granger causality H0: Power do not Granger-cause NatGas
## 
## data:  VAR object momo2
## F-Test = 0.44601, df1 = 5, df2 = 490, p-value = 0.8162
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: Power and NatGas
## 
## data:  VAR object momo2
## Chi-squared = 33.539, df = 1, p-value = 6.984e-09
causality(momo2,'NatGas')
## $Granger
## 
##  Granger causality H0: NatGas do not Granger-cause Power
## 
## data:  VAR object momo2
## F-Test = 7.1394, df1 = 5, df2 = 490, p-value = 1.841e-06
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: NatGas and Power
## 
## data:  VAR object momo2
## Chi-squared = 33.539, df = 1, p-value = 6.984e-09

Now the Europe dataset, similar unit root diagnostics and optimal 5 lags.

tab <- read.csv("powerng2.csv", header=T)
tab$Date <- as.Date(tab$Date,"%Y/%m/%d")
plot(as.Date(tab$Date),tab$Power,type="l",col="red",ylim=range(10:150),xlab="", ylab="$/MWh")
lines(as.Date(tab$Date),tab$NatGas,col="blue")
legend("topright",c("Power","NatGas"),title="Europe",col=c("red","blue"),lty=c(1,1),lwd=c(1,1),bty="n")

summary(ur.kpss(tab$Power))
## 
## ####################### 
## # KPSS Unit Root Test # 
## ####################### 
## 
## Test is of type: mu with 5 lags. 
## 
## Value of test-statistic is: 0.8911 
## 
## Critical value for a significance level of: 
##                 10pct  5pct 2.5pct  1pct
## critical values 0.347 0.463  0.574 0.739
summary(ur.kpss(tab$NatGas))
## 
## ####################### 
## # KPSS Unit Root Test # 
## ####################### 
## 
## Test is of type: mu with 5 lags. 
## 
## Value of test-statistic is: 1.1575 
## 
## Critical value for a significance level of: 
##                 10pct  5pct 2.5pct  1pct
## critical values 0.347 0.463  0.574 0.739
ur.kpss(diff(tab$Power,1))
## 
## ####################################### 
## # KPSS Unit Root / Cointegration Test # 
## ####################################### 
## 
## The value of the test statistic is: 0.0351
ur.kpss(diff(tab$NatGas,1))
## 
## ####################################### 
## # KPSS Unit Root / Cointegration Test # 
## ####################################### 
## 
## The value of the test statistic is: 0.185

This time we find a bidirectional influence p-values of <1‰ and 4%.

tmp <- tab[,2:3] 
momo1<-VAR(tmp,p=6,type="both")
#summary(momo1)
causality(momo1,'Power')
## $Granger
## 
##  Granger causality H0: Power do not Granger-cause NatGas
## 
## data:  VAR object momo1
## F-Test = 5.0311, df1 = 6, df2 = 490, p-value = 5.083e-05
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: Power and NatGas
## 
## data:  VAR object momo1
## Chi-squared = 7.3528, df = 1, p-value = 0.006696
causality(momo1,'NatGas')
## $Granger
## 
##  Granger causality H0: NatGas do not Granger-cause Power
## 
## data:  VAR object momo1
## F-Test = 2.1457, df1 = 6, df2 = 490, p-value = 0.04701
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: NatGas and Power
## 
## data:  VAR object momo1
## Chi-squared = 7.3528, df = 1, p-value = 0.006696

Lastly, the Asian dataset, similar unit root diagnostics and optimal 5 lags.

tab <- read.csv("powerng3.csv", header=T)
tab$Date <- as.Date(tab$Date,"%Y/%m/%d")
plot(as.Date(tab$Date),tab$Power,type="l",col="red",ylim=range(10:150),xlab="", ylab="$/MWh")
lines(as.Date(tab$Date),tab$NatGas,col="blue")
legend("topright",c("Power","NatGas"),title="Asia",col=c("red","blue"),lty=c(1,1),lwd=c(1,1),bty="n")

summary(ur.kpss(tab$Power))
## 
## ####################### 
## # KPSS Unit Root Test # 
## ####################### 
## 
## Test is of type: mu with 5 lags. 
## 
## Value of test-statistic is: 1.8995 
## 
## Critical value for a significance level of: 
##                 10pct  5pct 2.5pct  1pct
## critical values 0.347 0.463  0.574 0.739
summary(ur.kpss(tab$NatGas))
## 
## ####################### 
## # KPSS Unit Root Test # 
## ####################### 
## 
## Test is of type: mu with 5 lags. 
## 
## Value of test-statistic is: 1.8662 
## 
## Critical value for a significance level of: 
##                 10pct  5pct 2.5pct  1pct
## critical values 0.347 0.463  0.574 0.739
ur.kpss(diff(tab$Power,1))
## 
## ####################################### 
## # KPSS Unit Root / Cointegration Test # 
## ####################################### 
## 
## The value of the test statistic is: 0.0757
ur.kpss(diff(tab$NatGas,1))
## 
## ####################################### 
## # KPSS Unit Root / Cointegration Test # 
## ####################################### 
## 
## The value of the test statistic is: 0.1418

Like in the US, the power price does not cause the natural gas price (p-value 48%) but hte reverse holds true (p-value <1‰).

tmp <- tab[,2:3] 
momo1<-VAR(tmp,p=6,type="both")
#summary(momo1)
causality(momo1,'Power')
## $Granger
## 
##  Granger causality H0: Power do not Granger-cause NatGas
## 
## data:  VAR object momo1
## F-Test = 0.9153, df1 = 6, df2 = 468, p-value = 0.4835
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: Power and NatGas
## 
## data:  VAR object momo1
## Chi-squared = 8.5817, df = 1, p-value = 0.003396
causality(momo1,'NatGas')
## $Granger
## 
##  Granger causality H0: NatGas do not Granger-cause Power
## 
## data:  VAR object momo1
## F-Test = 5.0151, df1 = 6, df2 = 468, p-value = 5.368e-05
## 
## 
## $Instant
## 
##  H0: No instantaneous causality between: NatGas and Power
## 
## data:  VAR object momo1
## Chi-squared = 8.5817, df = 1, p-value = 0.003396