Granger Causality : Time Series Talk

ritvikmath · Intermediate ·🚀 Entrepreneurship & Startups ·6y ago

Key Takeaways

The video discusses Granger causality in time series analysis, including its concept, application, and statistical testing using AR models, t-tests, and F-tests. It provides examples of how Granger causality can be used to determine the relationship between different time series, such as house prices in neighboring areas or currency exchange rates between countries.

Full Transcript

hi everyone welcome back we're gonna continue our discussion on time series with a really cool concept today called Granger causality as we saw in the vector Auto regression videos sometimes we don't care just about one time series and lagged versions of itself we care about multiple time series and about the interactions between them one very specific thing we might care about in that situation is whether one time series is the cause of another time series to give a concrete example let's say you live in a neighborhood and house prices in your neighborhood go up for whatever reason now what you might expect sometime in the future is house prices in a surrounding neighborhood in a different neighborhood that's close to yours might also go up because house prices tend to be tied geographically in that way so these two time series the first one being house price in your neighborhood over time and a different one being house prices in the next neighborhood over time might be linked one might be the cause of the other and we might care about this because it'll help us predict house prices in the future so let me give you a very similar situation in this case and then we'll look at how to maybe figure this out mathematically more robustly rather than just kind of having a guess let's say we have two cities there's a rich City which is this one up here and we have a porous which is the city down here now each of these cities choose to export a certain amount of goods every single year so that's given by R sub T for the rich city so R sub 1 is the number of goods exported by the rich city in year 1 and then P sub 1 is the number of goods exported by the poor city in the first year so let's say the poor city is basically trying to of course get out of its financial deficit or dead the poor city is trying to become more financially viable so it looks to the rich city for guidance and it's basically just going to determine how many goods it exports any given year by basically setting that number to the same as the number of goods exported by the rich city in the year prior this is something pretty common in finance actually even with governments or entire countries you might have that one city who's trying to pull itself out out of poverty might link its currency to the currency of a more financially well-off country in hopes that that simple action will the poorer city out of poverty so we'll be looking at that similar situation here now if the poor city chooses to go about that strategy we would expect the following graph so the blue line you see here is R sub T which is the number of goods exported by the rich city over time and each time stamp let's say is a different year so we see that it goes up and down over time now the poor city in the second year so let me give some labels here let's say this is year one two three four five six and seven let's say the in the first year the rich City exports this many goods now following the strategy in the second year the poor City given by this green dotted trend is going to export the same amount of goods now in the third year the poor city chooses the amount of goods to export based on how many Goods the rich City exported in the second year so basically the poor city's graph is a shifted version of the rich cities graph and the reason for that is because it's basically choosing its export strategy by mimicking the export strategy of the rich city one year prior now that's how we kind of tell graphically but how do we tell mathematically whether or not one time series is linked to another in this way now before I go into the math I want to introduce some terminology because we've been throwing around the word causality like it's no big deal but in all honesty a lot of people in time series and stats take this idea of causality really seriously and it's not something that you can just throw around so that's why we have this idea called Granger causality we say that if two time series are linked in this way such that one time series is basically you can predict it really well by looking at the lagged values of a different time series in this case if we knew for example the rich cities exports in year six then we could predict the poor city's exports in year seven by just choosing the same value and so it becomes very easy to predict the poor city's export strategy if we know the lagged values of the rich cities export strategy so if two time series are linked in that way we say that one time Sirius Granger causes the other it's very important that you put the word Granger there because saying just causality is a whole different ball game and it's much more difficult because we don't truly know if that was the cause but we know that it helps us to predict so maybe that's the next best thing so to reiterate in this case we would say that R sub T which is the rich CDs export strategy will be Granger causing P sub T which is the poor city's export strategy now let's look at a mathematical formulation for proving whether this is true or not not just looking at it visually here are the steps you go through I just want to go through a step-by-step process nothing too fancy the first one is you're going to find the best AR or auto regressive model for P sub T which remember is the poor city's export strategy so let's say we do that using remember the PA CF can be a great tool to help you figure out what are the lags you need in your AR model so we find that P sub T is equal to P 1 P sub T minus 1 plus P V 3 P sub T minus 3 so we find that we use the first lag and the third lag of the time series to help predict the time series in the future so this is our base model notice we haven't brought in any information about the rich city yet and that's because we want to see how good we can get without being cooperating any additional information the another way to say that idea is if we if our prediction using just the lag versions of the poor city's export strategy is just as good as if we started incorporating information about the rich city then the rich city we don't even need that information and it does not range or cause our poor city's strategy so that brings us to step two which is we add the R sub T or rich city export strategy terms into this model and let's say that we find that R sub t minus 3 and r sub t minus 5 are significant now i want to take a quick pause and think about how did i get these values well that ends up being a two-step process so we try out a bunch of different lags we try out r sub t minus 1 t minus 2 there's even strategies to help us get which lags we should consider but let's just say we consider a bunch of different lags of the rich cities export strategy for each one we run it through a t-test so that t-test tells us whether or not that lag by itself is helpful in predicting the poor city's export strategy if it is significant then we keep it if it's not then we do not keep it so at the end of that t-test filter we're gonna have a couple differ lags of the rich cities export strategy that are helpful in predicting the poor city's export strategy the last thing you want to do is take all of those lags that you've gathered for the rich cities export strategy and put them through an F test to see if all of them together are helpful in predicting the poor city's export strategy so you can have cases where the t-test tells you that certain ones are helpful but when you run all of them together through an F test it doesn't say they're significant at which point you drop them so let's say optimistically in this case we find that R sub t minus 3 and r sub t minus 5 passed the t-test filter and they passed the F test filter which tells us that together they're helpful in predicting the poor city's export strategy then we keep them and then the last thing we do is conclude the conclusion part is really simple if we have any any at all lags of the rich cities export strategy in our final model then we conclude that the rich cities export strategy Granger causes the poor city's export strategy the reason being that we found that if we new information about lagged values of the rich cities export strategy our prediction becomes significantly better for the poor so these export strategy therefore that's our Granger causality right there conversely if we went through the t-test and F test filter and found that none of these rich cities export strategy lags were significant then basically we found that we can't make this model from step one any better by including information about lagged values of the rich cities export strategy so we say that the rich City strategy does not Granger cause the poor cities export strategy so that's in a nutshell how Granger causality works the main points I want you to take away from this are the intuition behind it which says that one time series can help predict another and that's the idea of Granger causality the second thing I want you to take away from it is that Granger causality is not causality it's just a more watered down but still helpful version of thinking about one thing causing another and the last thing is these three steps that you would use to mathematically determine whether or not one time series Granger causes a different time series all right so until next time

Original Description

All about Granger Causality in Time Series Analysis!
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from ritvikmath · ritvikmath · 0 of 60

← Previous Next →
1 Math Team Update
Math Team Update
ritvikmath
2 Single Variable Calculus Volume of a Sphere - Proof 1
Single Variable Calculus Volume of a Sphere - Proof 1
ritvikmath
3 Single Variable Calculus Volume of a Sphere - Proof 2
Single Variable Calculus Volume of a Sphere - Proof 2
ritvikmath
4 Multivariable Calculus Volume of a Sphere Proof - Triple Integrals
Multivariable Calculus Volume of a Sphere Proof - Triple Integrals
ritvikmath
5 Multivariable Calculus Volume of a Sphere Proof - Double Integrals
Multivariable Calculus Volume of a Sphere Proof - Double Integrals
ritvikmath
6 The Euclidian Algorithm
The Euclidian Algorithm
ritvikmath
7 Proving the Chain Rule
Proving the Chain Rule
ritvikmath
8 Proving the Fundamental Theorem of Calculus Part 1
Proving the Fundamental Theorem of Calculus Part 1
ritvikmath
9 Proving the Fundamental Theorem of Calculus Part 2
Proving the Fundamental Theorem of Calculus Part 2
ritvikmath
10 Math Puzzle - Poison Perplexity
Math Puzzle - Poison Perplexity
ritvikmath
11 Math Puzzle - Poison Perplexity - Solution
Math Puzzle - Poison Perplexity - Solution
ritvikmath
12 Expected Value and Variance of Continuous Random Variables (Calculus)
Expected Value and Variance of Continuous Random Variables (Calculus)
ritvikmath
13 Expected Value and Variance of Discrete Random Variables (No Calculus)
Expected Value and Variance of Discrete Random Variables (No Calculus)
ritvikmath
14 Array Method
Array Method
ritvikmath
15 Complex Power Series and their Derivatives
Complex Power Series and their Derivatives
ritvikmath
16 Distributions - Intro
Distributions - Intro
ritvikmath
17 The Poisson Distribution
The Poisson Distribution
ritvikmath
18 The Bernoulli Distribution
The Bernoulli Distribution
ritvikmath
19 The Binomial Distribution
The Binomial Distribution
ritvikmath
20 The Continuous Uniform Distribution
The Continuous Uniform Distribution
ritvikmath
21 The Geometric Distribution
The Geometric Distribution
ritvikmath
22 The Triangular Distribution
The Triangular Distribution
ritvikmath
23 The Exponential Distribution
The Exponential Distribution
ritvikmath
24 The Borel Distribution + Notes on Poisson Distribution
The Borel Distribution + Notes on Poisson Distribution
ritvikmath
25 The Gamma Distribution
The Gamma Distribution
ritvikmath
26 The Normal Distribution
The Normal Distribution
ritvikmath
27 The Laplace Distribution
The Laplace Distribution
ritvikmath
28 The Chi - Squared Distribution
The Chi - Squared Distribution
ritvikmath
29 Overfitting
Overfitting
ritvikmath
30 Vector Norms
Vector Norms
ritvikmath
31 Truths Behind the Titanic : K-Nearest Neighbor
Truths Behind the Titanic : K-Nearest Neighbor
ritvikmath
32 The Mathematics of Breakups
The Mathematics of Breakups
ritvikmath
33 Sillyfish
Sillyfish
ritvikmath
34 Finding Optimal Paths - Dynamic Programming
Finding Optimal Paths - Dynamic Programming
ritvikmath
35 HowToDataScience : Scraping Twitter Data
HowToDataScience : Scraping Twitter Data
ritvikmath
36 Decision Trees
Decision Trees
ritvikmath
37 Perceptron
Perceptron
ritvikmath
38 Naive Bayes
Naive Bayes
ritvikmath
39 K-Nearest Neighbor
K-Nearest Neighbor
ritvikmath
40 Evaluating Machine Learning Models
Evaluating Machine Learning Models
ritvikmath
41 Decision Tree Pruning
Decision Tree Pruning
ritvikmath
42 K-Means Clustering
K-Means Clustering
ritvikmath
43 Gaussian Mixture Model
Gaussian Mixture Model
ritvikmath
44 Data Science - Fuzzy Record Matching
Data Science - Fuzzy Record Matching
ritvikmath
45 Time Series Talk : Autocorrelation and Partial Autocorrelation
Time Series Talk : Autocorrelation and Partial Autocorrelation
ritvikmath
46 Time Series Talk : Autoregressive Model
Time Series Talk : Autoregressive Model
ritvikmath
47 Time Series Talk : Moving Average Model
Time Series Talk : Moving Average Model
ritvikmath
48 Time Series Talk : ARMA Model
Time Series Talk : ARMA Model
ritvikmath
49 Time Series Talk : ARCH Model
Time Series Talk : ARCH Model
ritvikmath
50 Time Series Talk : White Noise
Time Series Talk : White Noise
ritvikmath
51 Time Series Talk : Stationarity
Time Series Talk : Stationarity
ritvikmath
52 Time Series Talk : ARIMA Model
Time Series Talk : ARIMA Model
ritvikmath
53 Time Series Talk : Lag Operator
Time Series Talk : Lag Operator
ritvikmath
54 Time Series Talk : What is Seasonality ?
Time Series Talk : What is Seasonality ?
ritvikmath
55 Time Series Talk : Seasonal ARIMA Model
Time Series Talk : Seasonal ARIMA Model
ritvikmath
56 So ... What Actually is a Matrix ? : Data Science Basics
So ... What Actually is a Matrix ? : Data Science Basics
ritvikmath
57 Derivative of a Matrix : Data Science Basics
Derivative of a Matrix : Data Science Basics
ritvikmath
58 Basics of PCA (Principal Component Analysis) : Data Science Concepts
Basics of PCA (Principal Component Analysis) : Data Science Concepts
ritvikmath
59 Eigenvalues & Eigenvectors : Data Science Basics
Eigenvalues & Eigenvectors : Data Science Basics
ritvikmath
60 The Covariance Matrix : Data Science Basics
The Covariance Matrix : Data Science Basics
ritvikmath

This video teaches viewers about Granger causality, a statistical concept used to determine if one time series can be used to predict another. It provides examples and step-by-step instructions on how to apply Granger causality using AR models, t-tests, and F-tests. By watching this video, viewers will gain a deeper understanding of time series analysis and how to identify causal relationships between different variables.

Key Takeaways
  1. Introduce the concept of Granger causality
  2. Provide a concrete example of house prices in a neighborhood and a surrounding neighborhood
  3. Describe a situation where a poor city links its currency to the currency of a more financially well-off country
  4. Graphically represent the relationship between the two time series
  5. Find the best AR model for the time series
  6. Add the lagged values of the other time series
  7. Test for significance using t-tests and F-tests
  8. Run F test on multiple time series to determine if they are helpful in prediction
  9. Run t-test on individual time series to select those that are helpful in prediction
💡 Granger causality is a powerful tool for determining causal relationships between different time series, and can be applied using statistical tests such as t-tests and F-tests.

Related Reads

📰
Why I Built a Trading Marketplace for Monopoly GO Players
Learn how a entrepreneur built a trading marketplace for Monopoly GO players to facilitate sticker trading, a crucial aspect of the game.
Medium · Startup
📰
How to Launch Your Own Custom Headwear Line in Europe
Learn how to launch a custom headwear line in Europe with key steps and considerations for entrepreneurs and startup founders
Medium · Startup
📰
Why Kenya’s revived golden visa matters for venture investors and founders
Kenya's revived golden visa program offers residency to investors who commit capital and create jobs, impacting venture investors and founders
TechCabal
📰
How I Went From Employee to Founder — What Nobody Tells You
Learn what it takes to transition from employee to founder, including unexpected challenges and lessons learned
Medium · Startup
Up next
Watch this before applying for jobs as a developer.
Tech With Tim
Watch →