Granger causality (prediction)
HTML-код
- Опубликовано: 11 сен 2024
- This video lesson is part of a complete course on neuroscience time series analyses.
The full course includes
- over 47 hours of video instruction
- lots and lots of MATLAB exercises and problem sets
- access to a dedicated Q&A forum.
You can find out more here:
www.udemy.com/...
For more online courses about programming, data analysis, linear algebra, and statistics, see
sincxpress.com/
Wow, I am amazed by your comprehensible explanations. Thanks a lot for that! You really can get people hooked on statistics :-)
Glad it was helpful!
One of the best explanations of time series I've heard so far - thanks for sharing
Glad you enjoyed it!
This is by far the best presentation of what granger causality is that I’ve come across. Bravo
Thank you, kind internet stranger.
I cannot belive something so descriptive on the topic exists. You are awesome!!
No, *you're* awesome, Pranjal!
The clearest explanation I've ever seen. I was looking the thumbs up (like) x100 button, thanks bro!
Thanks Jose. I don't do it for the likes, so I'm happy with just one :P
Thank you very much for the effort you put in this video. Thanks to you, I finally understand what is granger causality.
Awesome
Hi Mike, it really helped me a lot to get used the terms and concepts! Thanks !
The warning at the end about spectral granger causality might have saved me. I was going to do that with wavelets on a project I’m working on. I now no longer have a plan on how to do it right. Haha.
Awesome :)
You make things look so easy and fun! Thanks again Mike :)
My pleasure!
Oh man I suck at math (even more when it is explained in English which is not my native language), but this was great and very easy to understand, thank you very much. I subscribed.
Nice, I'm glad you found it useful.
Mike . Come on . We need more amazing vidio for the world like this video
Thank you kindly, Kane. More coming out!
About Spectral Granger causality, you said that the way to compute it is using a Fourier transform over the autoregressive coefficients. Does it mean that we can use the stfft to get the time-frequency plot of the Granger causality?
Thank you for the explanaition
Hi J. That's kindof correct. It's not formally a Fourier transform; it is a decomposition of the autoregressive coefficients that is conceptually similar to the Fourier transform, in that it involves computing the dot product between the coefficients time series and a transfer function that contains complex-valued sine waves.
Thanks for the useful video. I have a confusion about model order and I will be thankful if you could elaborate more on that.
Around the minute: 18:56, you mentioned we have an assumption in statistics that if we have 2k parameters compared to having k parameters, then necessarily we are able to explain more variance in the data and explain the data better. So, the model with 2k parameters are better to be fitted to the data.
What is k? the number of datapoints happened in the past of one of the signals.
On the other hand, in minute: 25:22, when you are talking about the model order, k, and pros/cons, you said that when we have higher order model, we have more parameters to AR model to estimate that can lead to poor model estimation.
And my impression is these two stuffs contradicts with each other. The higher k should necessarily lead to better fitting the data, better estimation, on the other hand, having more parameters leads to poor estimation!!
Could you please clarify it more?
Hi. Yes, 'k' here is the total number of parameters estimated by the model. The fact that more parameters means more variance explained comes from statistics, and is related to overfitting data. I see what you mean about the apparent discrepancy, but explaining more variance in the data does not mean that the individual parameters are more accurate; it means the model overall captures more variance. What we care about with GC (and AR modeling more generally) is the quality of the estimated coefficients. Each coefficient is more accurately estimated when there is a sufficient amount of high-quality data. Furthermore, we don't want to overfit the data, so having fewer parameters is preferred over having more parameters.
@@mikexcohen1 thanks for ur explanation.
your explanation was great, thank you
Sorry I'm going to ask 2 questions about the previous lecture (two methods of power-based connectivity), whose comment function is disabled: 1) for the amplitude envelope correlations, you seems mentioned that the time-series of envelope is obtained by time-frequency analysis like wavelet convolution, etc., but I think that will give us different time-series amplitude/power for each frequency, so the envelope X/envelope Y in your plot is a sort of averaged time-series amplitude/power or a frequency-specific time-series amplitude/power? 2) for the trial-to-trial power coupling, why you use "spearman" instead of "Pearson" for the correlation analysis (shown in the codes)? does that mean, "connectivity" refers to a monotonic pattern regardless of the exact strength of correlation?
Thanks for pointing that out -- the comments were disabled by accident (the video was listed as "appropriate for kids" which auto-disables the comments. It's fixed now -- apologies to all the kids who were trying to learn about narrowband power time series correlations as an index of brain functional connectivity...).
1) Yes, the time series and their temporal characteristics may differ across frequency band, though this is not trivially the case. The relevant source paper is pubmed #10841367 if you want to read about this method in more detail.
2) You can also use Pearson. Raw, single-trial power values can have large outliers, so either a Spearman correlation or a robust regression analysis is recommended. That said, Spearman correlation is still a measure of the strength of the relationship; it just doesn't distinguish between linear and nonlinear-monotonic relationships. Of course, you can fit any other model to the data that is appropriate for your hypothesis; correlations are useful because they are simple, robust, fast, and require no parameters.
@@mikexcohen1 thanks. will keep watching your videos~ I'm still a "kid" in this field :)
Thanks a lot for this great content, super helpful!
Impressive explanation of all concepts! Thank you for sharing these! But I am still curious do you have recommended Python software to implement connectivity methods?
In general, I recommend using whatever language most people in your field use. I use and teach Python quite a bit, but for neuroscience analyses, I stick to MATLAB. Anyway, my guess is that a Python implementation of Granger causality exists somewhere, but I've never looked for it. That said, I suspect the algorithms are better developed in MATLAB.
Very nice lecture. Thank You!
at 25:32, When you talked about model order, why is that the higher order (more parameters in the model), the poorer model estimation? But in general, as you mentioned earlier in this video, a model can be almost always fit better if we add parameter, even though it's not very useful.
Larger number of parameters to estimate lead to larger errors in the parameter estimation. This can lead to overfitting and bias in the variance estimates.
Exactly, thanks for the clear reply.
Is there a way to convert a Bayesian Information Criterion value to a p-value? Or maybe modify an existing Z-score or p-value for the number of parameters?
Interesting question. Not directly that I know of. The BIC values themselves are entirely dependent on the scale and units of the data, so there is no universal H0 distribution to compare against. I suppose you could generate a p-value empirically based on permutation testing (shuffling) to get an empirical H0 distribution. All that said, BIC is generally used to compare various models, not to evaluate the significance of one model.
Great explanation. I have a question also. Shall both x and y time series be stationary? I mean if the series are stationary in the selected window, can we apply bivariate model for nanstationary series?
Yes, definitely the data should be stationary within the window. There are some tests to assess stationarity, but in practice with large datasets, it's common to apply a few strategies like detrending, z-scoring, and using smaller time windows where data are more likely to be stationary. It's also wise not to interpret GC in time windows when you know the data are highly non-stationary.
I do not quite understand why the window is different from order. It seems like they mean the same thing. How order is different from the window? Maybe the reason why we separate the order from the window is in such the case that oder parameter is obtained every second or third whatever sequences (e.g., order5 = 1, 3, 5, 7, 9 or 1, 4, 7, 10, 13) but not every each sequence (1,2,3,4,5)?
The order is how many time points are parameterized by the model, whereas the window is the total amount of data that the model has access to when fitting the parameters. For example, if the order=1 and the window size is 100, then the model fits one parameter using 99 data values. If the order=1 and window size is 5, then the model is trying to fit the same parameter, but has only 4 data values to use. Hence, larger window size will lead to more reliable estimates of the autoregression parameter.
@@mikexcohen1 I understood (order = lag). Thank you!
Another every important parameter is the sampling rate of the signals.
True.
Thank you! Really helpful!
:)
Dude!!! This is amazing, thank you for such a good elcture
Glad you enjoyed it!
Well explained, thank you
I was checking the chapter 28 of the book "Analyzing Neural Time Series Data" to know more about time-frequency domain granger, but unfortunately, it was not much, just few pages, also not about non-parametric granger. I was wondering if you have other videos about these topics? couldn't find any myself .......
Hi Hamideh. I don't have any videos about non-parametric Granger, and I think this video is the only one I have about Granger causality. Sorry to disappoint you ;)
@@mikexcohen1 Thank you for replying to my comment. May I kindly ask you to answer my other question as well?
Great! Sir!
Thanks so much. Amazing video. would you please share a code for implementing the granger causality in Matlab?
I have this code as part of my ANTS book and my online signal-processing courses. You can find it on my github site.
@@mikexcohen1 Thank you for your prompt reply . I couldn't find the code, would you please share the link of that?
It's this repository: github.com/mikexcohen/AnalyzingNeuralTimeSeries
I don't remember which chapter; it's been too long since I've read my own book, lol.
Great video. Thank you for that! :-)
Thanks Prof!
:)
nice lecture
Suppose I sell a bunch of different types of cars. This gives me a sales time series for each car type. I want to know which car types granger-cause which others. Does this lecture mean i just run the GC-process you describe for all combinations of predictor-car-types vs target-car-types, and see what the biggest GC-numbers are?
huh, interesting application. You can run GC on any multivariable time series. But you have to be careful with the interpretation and using the term "causal". That's why I prefer the term "prediction."
@@mikexcohen1 Was just making sure I understood what was going on with a made-up use case. :) Another thing: those single variable linear models - those aren't required are they? I mean, you could have ANY model g(time lagged data points) and still play the same game with the log-variance-ratio number, right? Or am i missing a condition that must be fulfilled which forces linear models?
Mathematically, yes. But for the correct interpretation, one model needs to be a subset of another. So, you have the "full" model and the "reduced" model, and the reduced model is the same as the full model but with one or a few parameters missing. If the reduced model has a different set of parameters (i.e., it's a different model), then you're comparing apples to oranges.