Total Effect

We use lingam package:

import lingam

Then, we create a DirectLiNGAM object and call the fit() method:

model = lingam.DirectLiNGAM()
model.fit(X)

To estimate the total effect, we can call estimate_total_effect() method. The following example estimates the total effect from x3 to x1.

te = model.estimate_total_effect(X, 3, 1)
print(f'total effect: {te:.3f}')
total effect: 21.002

For details, see also https://github.com/cdt15/lingam/blob/master/examples/TotalEffect.ipynb