% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/granger.R
\name{granger_test}
\alias{granger_test}
\title{Dumitrescu-Hurlin Panel Granger Causality Test}
\usage{
granger_test(data, unit_index, time_index, y, x, lags = 1L)
}
\arguments{
\item{data}{A panel data.frame.}

\item{unit_index}{Character: unit identifier column.}

\item{time_index}{Character: time identifier column.}

\item{y}{Character: name of the dependent variable.}

\item{x}{Character: name of the potential Granger-causing variable.}

\item{lags}{Integer: lag order \eqn{K} for both variables. Default 1.}
}
\value{
An object of class \code{dcce_granger} with elements:
\describe{
\item{W_bar}{Mean Wald statistic across units.}
\item{Z_bar}{Standardised statistic (large-T).}
\item{Z_bar_tilde}{Small-sample adjusted statistic.}
\item{p_value_Z}{p-value for Z-bar.}
\item{p_value_Zt}{p-value for Z-bar tilde.}
\item{unit_wald}{Named vector of per-unit Wald statistics.}
\item{N}{Number of units used.}
\item{T_bar}{Average time-series length.}
\item{lags}{Lag order.}
}
}
\description{
Tests whether \eqn{x} Granger-causes \eqn{y} in a heterogeneous panel,
following Dumitrescu & Hurlin (2012). For each unit \eqn{i} a bivariate
VAR-type regression is fitted:
\deqn{y_{it} = \alpha_i + \sum_{k=1}^{K} \gamma_{ik} y_{i,t-k}
                        + \sum_{k=1}^{K} \beta_{ik} x_{i,t-k}
                        + u_{it},}
and the individual Wald statistic for
\eqn{H_0^{(i)}: \beta_{i1} = \cdots = \beta_{iK} = 0} is computed.
}
\details{
The panel statistics are:
\describe{
\item{W-bar}{The cross-sectional average of the N unit-level Wald
statistics.}
\item{Z-bar}{Standardised version:
\eqn{\tilde{Z} = \sqrt{N/(2K)} (W\text{-bar} - K)
    \xrightarrow{d} \mathcal{N}(0,1)}.}
\item{Z-bar tilde}{Small-sample adjusted version using
\eqn{E[W_i]} and \eqn{Var(W_i)} from the \eqn{F(K, T-3K-1)}
distribution.}
}
}
\examples{
data(pwt8)
gc <- granger_test(
  data = pwt8, unit_index = "country", time_index = "year",
  y = "d_log_rgdpo", x = "log_ck", lags = 1
)
print(gc)
}
\references{
Dumitrescu, E.-I., & Hurlin, C. (2012). Testing for Granger
non-causality in heterogeneous panels. \emph{Economic Modelling},
29(4), 1450--1460.
}
