Granger Causality Test in R

Опубликовано: 12 Январь 2026
на канале: FINNSTATS
6,767
38

Subscribe to the Channel:
   / @datasciencetutorials4937  

Granger Causality Test in R

The Granger Causality test is used to examine if one time series may be used to forecast another.

Null Hypothesis (H0):

Time series X does not cause time series Y to Granger-cause itself.

Alternative Hypothesis (H1):

Time series X cause time series Y to Granger-cause itself.

Knowing the value of a time series X at a given lag is valuable for forecasting the value of a time series Y at a later time period is referred to as “Granger-causes.”

Granger Causality Test in R
This test generates an F test statistic along with a p-value.

We can reject the null hypothesis and infer that time series X Granger causes time series Y if the p-value is less than a particular significance level (e.g. =.05).

In R, we may use the grangertest() function from the lmtest package to perform a Granger-Causality test, which has the following syntax:

grangertest(X, Y, order = 1)
where:

X: This is the very first time series.

Y: The second set of the time series

order: In the first time series, the number of lags to utilize. The default value is 1.

The step-by-step example below demonstrates how to utilize this function in practice.
For the complete tutorial and code visit
https://finnstats.com/index.php/2021/...

#rstats #string #textmanipulation #plot #textdata #RStudio

You can Contact us
YouTube Channel:-
   / @datasciencetutorials4937  
Website Link:-
https://finnstats.com/index.php/contact/
Facebook Page:-
  / data-science-learning-111288361204015  
Twitter:-
  / finnstats  
Flipboard:-
https://flipboard.com/@finnstats?from...