LiNGAM is a new method for estimating structural equation models or linear Bayesian networks. It is based on using the non-Gaussianity of the data.
Python3
numpy
scipy
scikit-learn
graphviz
statsmodels
factor_analyzer
python-igraph
Note: If any problems when installing the packages, please refer to this tutorial for the igraph package and to this tutorial for the factor_analyzer package.
Please make sure that the factor_analyzer package is installed successfully. When employing Confirmatory Factor Analysis to estimate the factor loading matrix $\bar{G}$, for better estimation, we input $G_sign$ as well to help initialization. That is, in confirmatory_factor_analyzer.py , we set
loading_init = self.model.loadings * G_sign
instead of
loading_init = self.model.loadings
Then you may run the code successfully.
To install lingam package, use pip
as follows:
pip install lingam
import numpy as np
import pandas as pd
import lingam
# To run causal discovery, we create a DirectLiNGAM object and call the fit method.
model = lingam.DirectLiNGAM()
model.fit(X)
# Using the causal_order_ properties,
# we can see the causal ordering as a result of the causal discovery.
print(model.causal_order_)
# Also, using the adjacency_matrix_ properties,
# we can see the adjacency matrix as a result of the causal discovery.
print(model.adjacency_matrix_)
We provide several examples of running the LiNGAM algorithm in Jupyter Notebook. lingam/examples
This project is licensed under the terms of the MIT license.
For guidelines how to contribute to lingam package, take a look at CONTRIBUTING.md.
Should you use this package for performing ICA-based LiNGAM algorithm, we kindly request you to cite the following paper:
Should you use this package for performing DirectLiNGAM algorithm, we kindly request you to cite the following two papers:
Should you use this package for performing VAR-LiNGAM, we kindly request you to cite the following paper:
Should you use this package for performing VARMA-LiNGAM, we kindly request you to cite the following paper:
Should you use this package for performing DirectLiNGAM for multiple groups, we kindly request you to cite the following paper:
Should you use this package for performing LiNGAM for longitudinal data, we kindly request you to cite the following paper:
Should you use this package for performing BottomUpParceLiNGAM with Algorithm 1 of the paper below except Step 2 for estimating causal orders, we kindly request you to cite the following paper:
Should you use this package for performing RCD algorithm, we kindly request you to cite the following paper:
Should you use this package for performing LiNA algorithm, we kindly request you to cite the following paper:
Should you use this package for performing estimation of intervension effects on prediction, we kindly request you to cite the following paper:
Version | Tag | Published |
---|---|---|
1.6.0 | 2mos ago | |
1.5.5 | 6mos ago | |
1.5.4 | 1yr ago | |
1.5.3 | 1yr ago |