MACHINE LEARNING RECIPES
DATA CLEANING PYTHON
DATA MUNGING
PANDAS CHEATSHEET
ALL TAGS
# How to compare 2 time series data points using Grangers test?

# How to compare 2 time series data points using Grangers test?

This recipe helps you compare 2 time series data points using Grangers test

How to compare 2 time series data points using Grangers test?

Granger relation check is employed to see if just once series is going to be helpful to forecast another variable by investigation relation between 2 variables in a very statistic. The strategy could be a probabilistic account of causality; it uses discovered knowledge sets to search out patterns of correlation. One smart issue regarding statistic vector auto regression (VAR) is that we have a tendency to check ‘causality’ in some sense.

How Granger Causality works:

It is supported the concept that if X causes Y, then the forecast of Y supported previous values of Y and also the previous values of X ought to the best lead to the forecast of Y supported previous values of Y alone. Granger relation shouldn't be accustomed check if a lag of Y causes Y. Instead, it's typically used on exogenous (not Y lag) variables solely. In easy terms ‘X is alleged to Granger-cause Y if Y is higher expected victimization the histories of each X and Y than it will by using the history of Y alone.

Assumtions we made while performing Granger Causality Test:- 1. Future values cannot cause the past values. 2. A notably distinct data is contained in cause regarding impact which is able to not be accessible elsewhere

We will import all the Libraries including grangercausalitytests.

```
from statsmodels.tsa.stattools import grangercausalitytests
import pandas as pd
import numpy as np
```

```
df = pd.read_csv("/content/sample_data/california_housing_train.csv")
df.head()
```

This test is a X/Y based test. We have to feed two columns thorugh this test.

```
res = grangercausalitytests(df[['median_income', 'median_house_value']], maxlag=4)
```

In this data science project, you will work with German credit dataset using classification techniques like Decision Tree, Neural Networks etc to classify loan applications using R.

In this project, we are going to talk about Time Series Forecasting to predict the electricity requirement for a particular house using Prophet.

In this ensemble machine learning project, we will predict what kind of claims an insurance company will get. This is implemented in python using ensemble machine learning algorithms.

In this project you will use Python to implement various machine learning methods( RNN, LSTM, GRU) for fake news classification.

Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.

Build your own image similarity application using Python to search and find images of products that are similar to any given product. You will implement the K-Nearest Neighbor algorithm to find products with maximum similarity.

Data Science Project in Python- Given his or her job role, predict employee access needs using amazon employee database.

In this machine learning pricing project, we implement a retail price optimization algorithm using regression trees. This is one of the first steps to building a dynamic pricing model.

In this data science project, you will contextualize customer data and predict the likelihood a customer will stay at 100 different hotel groups.

In this machine learning resume parser example we use the popular Spacy NLP python library for OCR and text classification.