Closed UzmaHasan closed 2 years ago
@UzmaHasan Thanks for using lingam.
VARLiNGAM uses a VAR of statsmodels. In this VAR, the optimal order is calculated by specifying the Information criterion. https://www.statsmodels.org/dev/generated/statsmodels.tsa.vector_ar.var_model.VAR.fit.html#statsmodels.tsa.vector_ar.var_model.VAR.fit
You can specify the criterion at instance creation in VARLiNGAM as well. The default setting is bic, and the optimal order is used below the value specified for lags. Therefore, even if you specify lags=2, the optimal lags=1 may be selected as a result.
If you set criterion=None, the specified lags should be used as is.
import lingam
model = lingam.VARLiNGAM(lags=30, criterion=None, prune=True)
model.fit(X)
Thanks @ikeuchi-screen for such a quick and detailed solution. Appreciate it a lot!
Closing it as @ikeuchi-screen provided the solution already.
I simply tried to test a dataset with lag=30 with the bellow code snippet but it gives at most 14 adjacency matrix as output. What could be the resaon?
model = lingam.VARLiNGAM(lags=30, criterion='bic',prune=True)
model.fit(X)
print(model._adjacency_matrices)