cca_zoo icon indicating copy to clipboard operation
cca_zoo copied to clipboard

Do you have a CCA method incorporated with Multivariate Granger causality?

Open WantongLi123 opened this issue 2 years ago • 3 comments

Hey James,

Do you have a MCCA method incorporated with Multivariate Granger causality, similar as applied in this paper? https://ieeexplore.ieee.org/document/5959956

Cheers, Wantong

WantongLi123 avatar Jul 31 '23 20:07 WantongLi123

I don't implement this paper and have no particular knowledge of causal methods but I am vaguely aware that there is a connection between CCA and Granger Causality. From a quick scan you can substitute in MCCA or CCA for matlab canoncorr. The residualization steps you'd need to do yourself.

By an odd coincidence I have just written a residualization function for someone else in an unrelated project:

def residualize(X, C):
    """
    A simple function that residualizes the input features X by
    subtracting the contributions from the confound variables C
    """

    # Check and convert the input arrays
    X = check_array(X)
    C = check_array(C, ensure_2d=False)
    if C.ndim == 1:
        C = C[:, np.newaxis]

    # Clone and fit the regression model
    regr_model = LinearRegression()
    regr_model.fit(C, X)

    # Predict and subtract the contributions of confounds
    X_predicted = regr_model.predict(C)
    X_residualized = X - X_predicted

    return X_residualized

Might be able to adapt this to your case!

jameschapman19 avatar Aug 04 '23 11:08 jameschapman19

If you end up implementing the multivariate grainger causality using any of the cca-zoo code give me a shout and I'll put a link to it on the readme page :)

jameschapman19 avatar Aug 04 '23 11:08 jameschapman19

Thanks for your reply! Not yet working on coding the causality by myself. But you pointed good directions for a check later.

WantongLi123 avatar Aug 15 '23 13:08 WantongLi123