gctest
Granger causality and block exogeneity tests for vector autoregression (VAR) models
Description
The gctest
object function can conduct leave-one-out,
exclude-all, and block-wise Granger causality tests for the
response variables of a fully specified vector autoregression (VAR)
model (represented by a varm
model object).
To conduct a block-wise Granger causality test from specified sets of time series data
representing "cause" and "effect" multivariate response variables, or to address possibly
integrated series for the test, see the gctest
function.
returns
the test decision h
= gctest(Mdl
)h
from conducting leave-one-out Granger causality tests on all
response variables that compose the VAR(p) model
Mdl
.
uses additional options specified by one or more name-value pair arguments. For example,
h
= gctest(Mdl
,Name,Value
)'Type',"block-wise",'Cause',1:2,'Effect',3:5
specifies conducting a
block-wise test to assess whether the response variables
Mdl.SeriesNames(1:2)
Granger-cause the response variables
Mdl.SeriesNames(3:5)
conditioned on all other variables in the
model.
Examples
Conduct Leave-One-Out Granger Causality Test
Conduct a leave-one-out Granger causality test to assess whether each variable in a 3-D VAR model Granger-causes another variable, given the third variable. The variables in the VAR model are the M1 money supply, consumer price index (CPI), and US gross domestic product (GDP).
Load the US macroeconomic data set Data_USEconModel.mat
.
load Data_USEconModel
The data set includes the MATLAB® timetable DataTimeTable
, which contains 14 variables measured from Q1 1947 through Q1 2009.
M1SL
is the table variable containing the M1 money supply.CPIAUCSL
is the table variable containing the CPI.GDP
is the table variable containing the US GDP.
For more details, enter Description
at the command line.
Visually assess whether the series are stationary.
plot(DataTimeTable.Time,DataTimeTable.M1SL)
ylabel("Money Supply");
plot(DataTimeTable.Time,DataTimeTable.CPIAUCSL)
ylabel("CPI");
plot(DataTimeTable.Time,DataTimeTable.GDP)
ylabel("GDP")
All series are nonstationary.
Stabilize the series.
Convert the M1 money supply prices to returns.
Convert the CPI to the inflation rate.
Convert the GDP to the real GDP rate with respect to year 2000 dollars.
m1slrate = price2ret(DataTimeTable.M1SL); inflation = price2ret(DataTimeTable.CPIAUCSL); rgdprate = price2ret(DataTimeTable.GDP./DataTimeTable.GDPDEF);
Preprocess the data by removing all missing observations (indicated by NaN
).
tbl = table(m1slrate,inflation,rgdprate);
tbl = rmmissing(tbl);
T = size(tbl,1); % Total sample size
Fit VAR models, with lags ranging from 1 to 4, to the series. Initialize each fit by specifying the first four observations. Store the Akaike information criteria (AIC) of the fits.
numseries = 3; numlags = (1:4)'; nummdls = numel(numlags); % Partition time base. maxp = max(numlags); % Maximum number of required presample responses idxpre = 1:maxp; idxest = (maxp + 1):T; % Preallocation EstMdl(nummdls) = varm(numseries,0); aic = zeros(nummdls,1); % Fit VAR models to data. Y0 = tbl{idxpre,:}; % Presample Y = tbl{idxest,:}; % Estimation sample for j = 1:numel(numlags) Mdl = varm(numseries,numlags(j)); Mdl.SeriesNames = tbl.Properties.VariableNames; EstMdl(j) = estimate(Mdl,Y,'Y0',Y0); results = summarize(EstMdl(j)); aic(j) = results.AIC; end [~,bestidx] = min(aic); p = numlags(bestidx)
p = 3
BestMdl = EstMdl(bestidx);
A VAR(3) model yields the best fit.
For each variable and equation in the system, conduct a leave-one-out Granger causality test to assess whether a variable in the fitted VAR(3) model is the 1-step Granger-cause of another variable, given the third variable.
h = gctest(BestMdl)
H0 Decision Distribution Statistic PValue CriticalValue _______________________________________________ __________________ ____________ _________ _________ _____________ "Exclude lagged inflation in m1slrate equation" "Cannot reject H0" "Chi2(3)" 7.0674 0.069782 7.8147 "Exclude lagged rgdprate in m1slrate equation" "Cannot reject H0" "Chi2(3)" 2.5585 0.4648 7.8147 "Exclude lagged m1slrate in inflation equation" "Cannot reject H0" "Chi2(3)" 2.7025 0.4398 7.8147 "Exclude lagged rgdprate in inflation equation" "Reject H0" "Chi2(3)" 14.338 0.0024796 7.8147 "Exclude lagged m1slrate in rgdprate equation" "Cannot reject H0" "Chi2(3)" 7.0352 0.070785 7.8147 "Exclude lagged inflation in rgdprate equation" "Reject H0" "Chi2(3)" 12.006 0.0073619 7.8147
h = 6x1 logical array
0
0
0
1
0
1
gctest
conducts six tests, so h
is a 6-by-1 logical vector of test decisions corresponding to the rows of the test summary table. The results indicate the following decisions, at a 5% level of significance:
Do not reject the claim that the inflation rate is not the 1-step Granger-cause of the M1 money supply rate, given the real GDP rate (
h(1)
=0
).Do not reject the claim that the real GDP rate is not the 1-step Granger-cause of the M1 money supply rate, given the inflation rate (
h(2)
=0
).Do not reject the claim that the M1 money supply rate is not the 1-step Granger-cause of the inflation rate, given the real GDP rate (
h(3)
=0
).Reject the claim that the real GDP rate is not the 1-step Granger-cause of the inflation rate, given the M1 money supply rate (
h(4)
= 1).Do not reject the claim that the M1 money supply rate is not the 1-step Granger-cause of the real GDP rate, given the inflation rate (
h(5)
=0
).Reject the claim that the inflation rate is not the 1-step Granger-cause of the real GDP rate, given the M1 money supply rate (
h(6)
= 1).
Because the inflation and real GDP rates are 1-step Granger-causes of each other, they constitute a feedback loop.
Conduct Exclude-All Granger Causality Test
Consider the 3-D VAR(3) model and leave-one-out Granger causality test in Conduct Leave-One-Out Granger Causality Test.
Load the US macroeconomic data set Data_USEconModel.mat
. Preprocess the data. Fit a VAR(3) model to the preprocessed data.
load Data_USEconModel m1slrate = price2ret(DataTimeTable.M1SL); inflation = price2ret(DataTimeTable.CPIAUCSL); rgdprate = price2ret(DataTimeTable.GDP./DataTimeTable.GDPDEF); tbl = table(m1slrate,inflation,rgdprate); tbl = rmmissing(tbl); Mdl = varm(3,3); Mdl.SeriesNames = tbl.Properties.VariableNames; EstMdl = estimate(Mdl,tbl{5:end,:},'Y0',tbl{2:4,:});
Conduct an exclude-all Granger causality test on the variables of the fitted model.
h = gctest(EstMdl,'Type',"exclude-all");
H0 Decision Distribution Statistic PValue CriticalValue ________________________________________________________ __________________ ____________ _________ _________ _____________ "Exclude all but lagged m1slrate in m1slrate equation" "Cannot reject H0" "Chi2(6)" 9.477 0.14847 12.592 "Exclude all but lagged inflation in inflation equation" "Reject H0" "Chi2(6)" 19.475 0.0034327 12.592 "Exclude all but lagged rgdprate in rgdprate equation" "Reject H0" "Chi2(6)" 19.16 0.0039014 12.592
gctest
conducts numtests
= 3 tests. The results indicate the following decisions, each at a 5% level of significance:
Do not reject the claim that the inflation and real GDP rates do not Granger-cause the M1 money supply rate.
Reject the claim that the M1 money supply and real GDP rates do not Granger-cause the inflation rate.
Reject the claim that the M1 money supply and inflation rates do not Granger-cause the real GDP rate.
Adjust Significance Level for Multiple Tests
The false discovery rate increases with the number of simultaneous hypothesis tests you conduct. To combat the increase, decrease the level of significance per test by using the 'Alpha'
name-value pair argument. Consider the 3-D VAR(3) model and leave-one-out Granger causality test in Conduct Leave-One-Out Granger Causality Test.
Load the US macroeconomic data set Data_USEconModel.mat
. Preprocess the data. Fit a VAR(3) model to the preprocessed data.
load Data_USEconModel m1slrate = price2ret(DataTimeTable.M1SL); inflation = price2ret(DataTimeTable.CPIAUCSL); rgdprate = price2ret(DataTimeTable.GDP./DataTimeTable.GDPDEF); tbl = table(m1slrate,inflation,rgdprate); tbl = rmmissing(tbl); Mdl = varm(3,3); Mdl.SeriesNames = tbl.Properties.VariableNames; EstMdl = estimate(Mdl,tbl{5:end,:},'Y0',tbl{2:4,:});
A leave-one-out Granger causality test on the variables in the model results in numtests
= 6 simultaneous tests. Conduct the tests, but specify a family-wise significance level of 0.05 by specifying a level of significance of alpha
= 0.05/numtests
for each test.
numtests = 6; alpha = 0.05/numtests
alpha = 0.0083
gctest(EstMdl,'Alpha',alpha);
H0 Decision Distribution Statistic PValue CriticalValue _______________________________________________ __________________ ____________ _________ _________ _____________ "Exclude lagged inflation in m1slrate equation" "Cannot reject H0" "Chi2(3)" 7.0674 0.069782 11.739 "Exclude lagged rgdprate in m1slrate equation" "Cannot reject H0" "Chi2(3)" 2.5585 0.4648 11.739 "Exclude lagged m1slrate in inflation equation" "Cannot reject H0" "Chi2(3)" 2.7025 0.4398 11.739 "Exclude lagged rgdprate in inflation equation" "Reject H0" "Chi2(3)" 14.338 0.0024796 11.739 "Exclude lagged m1slrate in rgdprate equation" "Cannot reject H0" "Chi2(3)" 7.0352 0.070785 11.739 "Exclude lagged inflation in rgdprate equation" "Reject H0" "Chi2(3)" 12.006 0.0073619 11.739
The test decisions of these more conservative tests are the same as the tests decisions in Conduct Leave-One-Out Granger Causality Test. However, the conclusions of the conservative tests hold simultaneously at a 5% level of significance.
Access Test p-Values
Consider the 3-D VAR(3) model and leave-one-out Granger causality test in Conduct Leave-One-Out Granger Causality Test.
Load the US macroeconomic data set Data_USEconModel.mat
. Preprocess the data. Fit a VAR(3) model to the preprocessed data.
load Data_USEconModel m1slrate = price2ret(DataTimeTable.M1SL); inflation = price2ret(DataTimeTable.CPIAUCSL); rgdprate = price2ret(DataTimeTable.GDP./DataTimeTable.GDPDEF); tbl = table(m1slrate,inflation,rgdprate); tbl = rmmissing(tbl); Mdl = varm(3,3); Mdl.SeriesNames = tbl.Properties.VariableNames; EstMdl = estimate(Mdl,tbl{5:end,:},'Y0',tbl{2:4,:});
Conduct a leave-one-out Granger causality test on the variables of the fitted model. Return the test result summary table and suppress the test results display.
[~,Summary] = gctest(EstMdl,'Display',false)
Summary=6×6 table
H0 Decision Distribution Statistic PValue CriticalValue
_______________________________________________ __________________ ____________ _________ _________ _____________
"Exclude lagged inflation in m1slrate equation" "Cannot reject H0" "Chi2(3)" 7.0674 0.069782 7.8147
"Exclude lagged rgdprate in m1slrate equation" "Cannot reject H0" "Chi2(3)" 2.5585 0.4648 7.8147
"Exclude lagged m1slrate in inflation equation" "Cannot reject H0" "Chi2(3)" 2.7025 0.4398 7.8147
"Exclude lagged rgdprate in inflation equation" "Reject H0" "Chi2(3)" 14.338 0.0024796 7.8147
"Exclude lagged m1slrate in rgdprate equation" "Cannot reject H0" "Chi2(3)" 7.0352 0.070785 7.8147
"Exclude lagged inflation in rgdprate equation" "Reject H0" "Chi2(3)" 12.006 0.0073619 7.8147
Summary
is a MATLAB table containing numtests
= 6 rows. The rows contain the results of each test. The columns are table variables containing characteristics of the tests.
Extract the -values of the tests.
pvalues = Summary.PValue
pvalues = 6×1
0.0698
0.4648
0.4398
0.0025
0.0708
0.0074
Test for Block Exogeneity
Time series are block exogenous if they do not Granger-cause any other variables in a multivariate system. Test whether the effective federal funds rate is block exogenous with respect to the real GDP, personal consumption expenditures, and inflation rates.
Load the US macroeconomic data set Data_USEconModel.mat
. Convert the price series to returns.
load Data_USEconModel
inflation = price2ret(DataTimeTable.CPIAUCSL);
rgdprate = price2ret(DataTimeTable.GDP./DataTimeTable.GDPDEF);
pcerate = price2ret(DataTimeTable.PCEC);
Test whether the federal funds rate is nonstationary by conducting an augmented Dickey-Fuller test. Specify that the alternative model has a drift term and an test.
StatTbl = adftest(DataTimeTable,DataVariable="FEDFUNDS",Model="ard")
StatTbl=1×8 table
h pValue stat cValue Lags Alpha Model Test
_____ ________ _______ _______ ____ _____ _______ ______
Test 1 false 0.071419 -2.7257 -2.8751 0 0.05 {'ARD'} {'T1'}
The test decision h
= 0
indicates that the null hypothesis that the series has a unit root should not be rejected, at 0.05 significance level.
To stabilize the federal funds rate series, apply the first difference to it.
dfedfunds = diff(DataTimeTable.FEDFUNDS);
Preprocess the data by removing all missing observations (indicated by NaN
).
tbl = table(inflation,pcerate,rgdprate,dfedfunds);
tbl = rmmissing(tbl);
T = size(tbl,1); % Total sample size
Assume a 4-D VAR(3) model for the four series. Initialize the model by using the first three observations, and fit the model to the rest of the data. Assign names to the series in the model.
Mdl = varm(4,3); Mdl.SeriesNames = tbl.Properties.VariableNames; EstMdl = estimate(Mdl,tbl{4:end,:},Y0=tbl{1:3,:});
Assess whether the federal funds rate is block exogenous with respect to the real GDP, personal consumption expenditures, and inflation rates. Conduct an -based Wald test, and return the test decision and summary table. Suppress the test results display.
cause = "dfedfunds"; effects = ["inflation" "pcerate" "rgdprate"]; [h,Summary] = gctest(EstMdl,Type="blockwise", ... Cause=cause,Effect=effects,Test="f",Display=false);
gctest
conducts one test. h
= 1
indicates, at a 5% level of significance, rejection of the null hypothesis that the federal funds rate is block exogenous with respect to the other variables in the VAR model. This result suggests that the federal funds rate Granger-causes at least one of the other variables in the system.
Alternatively, you can conduct the same blockwise Granger causality test by passing the data to the gctest
function.
causedata = tbl.dfedfunds; EffectsData = tbl{:,effects}; [hgc,pvalue,stat,cvalue] = gctest(causedata,EffectsData,... NumLags=3,Test="f")
hgc = logical
1
pvalue = 9.0805e-09
stat = 6.9869
cvalue = 1.9265
To determine which variables are Granger-caused by the federal funds rate, conduct a leave-one-out test and specify the "cause" and "effects."
gctest(EstMdl,Cause=cause,Effect=effects);
H0 Decision Distribution Statistic PValue CriticalValue ________________________________________________ ___________ ____________ _________ __________ _____________ "Exclude lagged dfedfunds in inflation equation" "Reject H0" "Chi2(3)" 26.157 8.8433e-06 7.8147 "Exclude lagged dfedfunds in pcerate equation" "Reject H0" "Chi2(3)" 10.151 0.017325 7.8147 "Exclude lagged dfedfunds in rgdprate equation" "Reject H0" "Chi2(3)" 10.651 0.013772 7.8147
The test results suggest the following decisions, each at a 5% level of significance:
Reject the claim that the federal funds rate is not a 1-step Granger-cause of the inflation rate, given all other variables in the VAR model.
Reject the claim that the federal funds rate is not a 1-step Granger-cause of the personal consumption expenditures rate, given all other variables in the VAR model.
Reject the claim that the federal funds rate is not a 1-step Granger-cause of the real GDP rate, given all other variables in the VAR model.
Input Arguments
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: 'Type',"block-wise",'Cause',1:2,'Effect',3:5
specifies
conducting a block-wise test to assess whether the response variables
Mdl.SeriesNames(1:2)
Granger-cause the response variables
Mdl.SeriesNames(3:5)
conditioned on all other variables in the
model.
Type
— Granger causality test to conduct
"leave-one-out"
(default) | "exclude-all"
| "block-wise"
Granger causality test to conduct, specified as the comma-separated pair
consisting of 'Type'
and a value in this table. Suppose that the
VAR model Mdl
is m-D (m =
Mdl.NumSeries
).
Value | Description |
---|---|
"leave-one-out" | Leave-one-out test For j =
1,…,m, k = 1,…,m,
and j ≠ k,
|
"exclude-all" | Exclude-all test For j =
1,…,m, |
"block-wise" | Block-wise test
|
Example: 'Type',"exclude-all"
Data Types: char
| string
Alpha
— Significance level
0.05
(default) | numeric scalar in (0,1)
Significance level for each conducted test (see Type
),
specified as the comma-separated pair consisting of 'Alpha'
and a
numeric scalar in (0,1).
Example: 'Alpha',0.1
Data Types: double
| single
Test
— Test statistic distribution under null hypothesis
"chi-square"
(default) | "f"
Test statistic distribution under the null hypothesis, specified as the
comma-separated pair consisting of 'Test'
and a value in this
table.
Value | Description |
---|---|
"chi-square" | gctest derives outputs from conducting a χ2 test. |
"f" | gctest derives outputs from conducting an F test. |
For test statistic forms, see [4].
Example: 'Test',"f"
Data Types: char
| string
Cause
— VAR model response variables representing Granger-causes
numeric vector of variable indices | vector of variable names
VAR model response variables representing Granger-causes in the 1-step block-wise
test, specified as the comma-separated pair consisting of 'Cause'
and a numeric vector of variable indices or a vector of variable names.
For either input type, values correspond to the response series names in the
SeriesNames
property of the input VAR model object
Mdl
, which you access by using dot notation:
Mdl.SeriesNames
.
Example: 'Cause',["rGDP" "m1sl"]
Example: 'Cause',1:2
Data Types: single
| double
| char
| string
Effect
— VAR model response variables affected by Granger-causes
numeric vector of variable indices | vector of variable names
VAR model response variables affected by Granger-causes in the 1-step block-wise
test, specified as the comma-separated pair consisting of 'Effect'
and a numeric vector of variable indices or a vector of variable names.
For either input type, values correspond to the response series names in the
SeriesNames
property of the input VAR model object
Mdl
, which you access by using dot notation:
Mdl.SeriesNames
.
Example: 'Cause',"inflation"
Example: 'Cause',3
Data Types: single
| double
| char
| string
Display
— Flag to display test summary table
true
(default) | false
Flag to display a test summary table at the command line, specified as the
comma-separated pair consisting of 'Display'
and a value in this
table.
Value | Description |
---|---|
true | Display a test summary table, as returned in
Summary , at the command line. |
false | Do not display a test summary table. |
Example: 'Display',false
Data Types: logical
Output Arguments
h
— Granger causality test decisions
logical scalar | logical vector
Granger causality test decisions, returned as a logical scalar or
numtests
-by-1 logical vector. For
=
1,…,j
numtests
:
h(
=j
)1
indicates that test
rejects the null hypothesis H0 that the "cause" variables are not 1-step Granger-causes of the "effect" variables. Sufficient evidence exists to support Granger causality and endogeneity of the "cause" variables.j
h(
=j
)0
indicates failure to reject H0.
The number of tests conducted depends on the specified test type (see
Type
). For more details on the conducted tests, display or return
the test summary table (see Display
and
Summary
, respectively).
Summary
— Summary of test results
table
Summary of the test results, returned as a table.
Each row of Summary
corresponds to one of the
numtests
conducted tests. The columns describe the characteristics
of the tests.
Column Name | Description | Data Type |
---|---|---|
H0 | Granger causality or block exogeneity test null hypothesis description | String scalar |
Decision | Test decisions corresponding to h | String scalar |
Distribution | Test statistic distribution under the null hypothesis | String scalar |
Statistic | Value of test statistic | Numeric scalar |
PValue | Test p-value | Numeric scalar |
CriticalValue | Critical value for the significance level
Alpha | Numeric scalar |
More About
Granger Causality Test
The Granger causality test is a statistical hypothesis test that assesses whether past and present values of a set of m1 time series variables, called the "cause" variables, affect the predictive distribution of a distinct set of m2 time series variables, called the "effect" variables. The impact is a reduction in forecast mean squared error (MSE) of the "effect" variables. If past values of the "cause" variables affect the "effect" variables h-steps into the forecast horizon, the "cause" variables are h-step Granger-causes of the "effect" variables. If the "cause" variables are h-step Granger-causes of the "effect" variables for all h ≥ 1, the "cause" variables Granger-cause the "effect" variables.
gctest
provides block-wise, leave-one-out,
and exclude-all variations of the Granger causality tests (see 'Type'
) and
χ2-based or F-based Wald
tests (see 'Test'
). For test
statistic forms, see [4].
For all test types, assume the following conditions:
Future values cannot inform past values.
The "cause" variables uniquely inform the "effect" variables. No other variables have the information to inform the "effect" variables.
Let y1,t denote the m1 "cause" variables and y2,t denote the m2 "effect" variables. Consider a stationary VAR(p) model for [y1,t y2,t]:
If Φ21,1 = … = Φ21,p = 0m1,m2, then y1,t is not the block-wise Granger-cause of y2,t + h, for all h ≥ 1 and where 0m2,m1 is an m2-by-m1 matrix of zeros. Also, y1,t is block exogenous with respect to y2,t. Consequently, the block-wise Granger causality test hypotheses are:
H1 implies that at least one h ≥ 1 exists such that y1,t is the h-step Granger-cause of y2,t.
Distinct endogenous variables in the VAR model that are not "causes" or "effects" in
the block-wise test are conditioning variables. If conditioning
variables exist in the model, h = 1. In other words,
gctest
tests the null hypothesis of 1-step
noncausality.
For each response variable and equation in the VAR model,
gctest
removes lags of a variable from an equation, except
self lags, and tests the null hypothesis of 1-step noncausality. Specifically, consider
the m-D VAR(p) model
where:
yj,t and yk,t are 1-D series representing the "cause" and "effect" variables, respectively.
ys,t is an (m – 2)-D series of all other endogenous variables; s = {1,…,m} \ {j,k}.
For ℓ = 1,…,p:
ϕ11,ℓ, ϕ12,ℓ, ϕ21,ℓ, and ϕ22,ℓ are scalar lag coefficients.
ϕ13,ℓ, ϕ31,ℓ, ϕ23,ℓ, and ϕ32,ℓ are (m – 2)-D vectors of lag coefficients.
Φ33,ℓ is an (m – 2)-by-(m – 2) matrix of lag coefficients.
For j = 1,…,m, k =
1,…,m, and j ≠ k,
gctest
tests the null hypothesis that
yj,t
is not a 1-step Granger-cause of
yk,t,
given ys,t:
gctest
conducts
m(m – 1) tests.
For each equation in the VAR model, gctest
removes all lags
from the equation, except self lags, and tests for h-step noncausality.
Specifically, consider the m-D VAR(p) model
where:
y-k,t is an (m – 1)-D series of all endogenous variables in the VAR model (except yk,t) representing the "cause" variables.
yk,t is the 1-D series representing the "effect" variable.
For ℓ = 1,…,p:
ϕkk,ℓ is a scalar lag coefficient.
ϕk-k,ℓ and ϕ-kk,ℓ are (m – 1)-D vectors of lag coefficients.
Φ-k-k,ℓ is an (m – 1)-by-(m – 1) matrix of lag coefficients.
For k = 1,…,m,
gctest
tests the null hypothesis that the variables in
y-k,t
are not h-step Granger-causes of
yk,t:
gctest
conducts m
tests.
Vector Autoregression Model
A vector autoregression (VAR) model is a stationary multivariate time series model consisting of a system of m equations of m distinct response variables as linear functions of lagged responses and other terms.
A VAR(p) model in difference-equation notation and in reduced form is
yt is a
numseries
-by-1 vector of values corresponding tonumseries
response variables at time t, where t = 1,...,T. The structural coefficient is the identity matrix.c is a
numseries
-by-1 vector of constants.Φj is a
numseries
-by-numseries
matrix of autoregressive coefficients, where j = 1,...,p and Φp is not a matrix containing only zeros.xt is a
numpreds
-by-1 vector of values corresponding tonumpreds
exogenous predictor variables.β is a
numseries
-by-numpreds
matrix of regression coefficients.δ is a
numseries
-by-1 vector of linear time-trend values.εt is a
numseries
-by-1 vector of random Gaussian innovations, each with a mean of 0 and collectively anumseries
-by-numseries
covariance matrix Σ. For t ≠ s, εt and εs are independent.
Condensed and in lag operator notation, the system is
where , Φ(L)yt is
the multivariate autoregressive polynomial, and I is the
numseries
-by-numseries
identity matrix.
For example, a VAR(1) model containing two response series and three exogenous predictor variables has this form:
Tips
gctest
uses the series names inMdl
in test result summaries. To make the output more meaningful for your application, specify series names by setting theSeriesNames
property of the VAR model objectMdl
by using dot notation before callinggctest
. For example, the following code assigns names to the variables in the 3-D VAR model objectMdl
:Mdl.SeriesNames = ["rGDP" "m1sl" "inflation"];
The exclude-all and leave-one-out Granger causality tests conduct multiple, simultaneous tests. To control the inevitable increase in the false discovery rate, decrease the level of significance
Alpha
when you conduct multiple tests. For example, to achieve a family-wise significance level of 0.05, specify'Alpha',0.05/numtests
.
Algorithms
The name-value pair arguments Cause
and Effect
apply to the block-wise Granger causality test because they specify which equations have lag
coefficients set to 0 for the null hypothesis. Because the leave-one-out and exclude-all
Granger causality tests cycle through all combinations of variables in the VAR model, the
information provided by Cause
and Effect
is not
necessary. However, you can specify a leave-one-out or exclude-all Granger causality test and
the Cause
and Effect
variables to conduct unusual
tests such as constraints on self lags. For example, the following code assesses the null
hypothesis that the first variable in the VAR model Mdl
is not the 1-step
Granger-cause of
itself:
gctest(Mdl,'Type',"leave-one-out",'Cause',1,'Effect',1);
References
[1] Granger, C. W. J. "Investigating Causal Relations by Econometric Models and Cross-Spectral Methods." Econometrica. Vol. 37, 1969, pp. 424–459.
[2] Hamilton, James D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.
[3] Dolado, J. J., and H. Lütkepohl. "Making Wald Tests Work for Cointegrated VAR Systems." Econometric Reviews. Vol. 15, 1996, pp. 369–386.
[4] Lütkepohl, Helmut. New Introduction to Multiple Time Series Analysis. New York, NY: Springer-Verlag, 2007.
[5] Toda, H. Y., and T. Yamamoto. "Statistical Inferences in Vector Autoregressions with Possibly Integrated Processes." Journal of Econometrics. Vol. 66, 1995, pp. 225–250.
Version History
Introduced in R2019aR2023a: gctest
accepts input data in tables and timetables, and return results in tables and timetables
In addition to accepting input data in numeric arrays,
gctest
accepts input data in tables and timetables. gctest
chooses default series on which to operate, but you can use the following name-value arguments to select variables.
CauseVariables
selects the Granger-cause variables from the input. By default, all variables not specified as Granger-effect variables are Granger-cause variables.EffectVariables
selects the Granger-effect variables from the input. By default, the last variable is the Granger-effect variable.ConditionVariables
selects the conditioning variables from the input. The default is none of the variables.
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)