Giuseppe Vittucci
1.0
2017-03-25
Dumitrescu-Hurlin (2012) test: Granger causality for panel data
C23 C52
Computes the Granger causality test for panel data put forward by Dumitrescu and Hurlin (2012).
In the test, all the coefficients are allowed to vary across cross-sections in the panel.
The test is computed by running standard Granger causality regressions for each cross-section,
taking the average of the test statistics (W-bar) and standardizing it (Z-bar).
Z-bar follows a standard normal distribution
The number of lags in the Granger causality regression, K, and
the number of time-periods in each cross-sectional unit i, Ti,
must satisfy the following condition:
T > 5 + 2*K
If the condition is not met, the function returns the number of (one of)
the unit where the condition fails.
A row vector containing Z-bar is available for assignment on return.
Reference:
Dumitrescu, E.-I. and Hurlin, C. (2012), Testing for Granger non-causality in heterogeneous panels, Economic Modelling 29 (4), 1450-1460.
Syntax: dumitrescu_hurlin_test(series Y, series X, int K)
Y series
X series
# lags
```
#Dumitrescu-Hurlin test (Granger causality for panel data)
#Dumitrescu, E.-I. and Hurlin, C. (2012), Testing for Granger non-causality in heterogeneous panels, Economic Modelling 29 (4), 1450-1460
# Giuseppe Vittucci Marzetti (2017).
scalar e = 0
series id = $unit
scalar N = max(id)
list X = y x
list ylags = lags(K,y)
list xlags = lags(K,x)
matrix W = zeros(N,2)
matrix E = zeros(N,1)
matrix V = zeros(N,1)
loop i=1..N --quiet
smpl id == i --restrict --replace
ols y const ylags xlags --quiet
omit xlags --test-only --silent
W[i,1] = $test
ols x const xlags ylags --quiet
omit ylags --test-only --silent
W[i,2] = $test
scalar T = sum(ok(X))
if T > 5 + 2*K
E[i] = K*(T-2*K-1)/(T-2*K-3)
V[i] = 2*K*(T-2*K-1)^2*(T-K-3)/((T-2*K-3)^2*(T-2*K-5))
else
e = i
break
endif
endloop
smpl full
if e
printf "\nT <= 5 + 2K in unit %g\n\n", e
return {NA,NA}
else
M = meanc(W)
matrix Z = (M - mean(E))/sqrt(mean(V)/N)
colnames(Z,"Zxy Zyx")
matrix P = 2*pvalue(z, abs(Z))
printf "\nDumitrescu-Hurlin (2012) test (Granger causality test for panel data)\n"
printf "\nLags: %g",K
printf "\nNull hypothesis W-bar Z-bar p-value\n"
printf "----------------------------------------------------------------------------------\n"
printf "X does not homogeneously Granger-cause Y %7.4f %7.4f %7.4f\n",M[1],Z[1],P[1]
printf "Y does not homogeneously Granger-cause X %7.4f %7.4f %7.4f\n",M[2],Z[2],P[2]
printf "----------------------------------------------------------------------------------\n"
return Z
endif
```

include dumitrescu_hurlin_test.gfn
open greene14_1.gdt
logs C PF
matrix Z = dumitrescu_hurlin_test (l_C,l_PF,2)