0
$\begingroup$

I am investigating two time series where the first is the daily closing stock price changes and the other is the daily changes in the PCE index.

I want to investigate how much the PCE index explains the returns by using a rolling granger causality like this one: enter image description here

I can't find a way to get a rolling granger causality in python. Would someone mind helping me out or do I need to rethink the concept?

$\endgroup$

1 Answer 1

0
$\begingroup$

I believe this may be of help: https://www.statsmodels.org/dev/generated/statsmodels.tsa.stattools.grangercausalitytests.html

This allows you to run a granger causality of two variables. As for rolling, use a rolling index loop over an array:

for i in range(window, max_idx):
     sub_view = my_array[i-window:i+1,:]
# use function here 
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.