VARMA-LiNGAM¶
-
class
lingam.
VARMALiNGAM
(order=(1, 1), criterion='bic', prune=False, max_iter=100, ar_coefs=None, ma_coefs=None, lingam_model=None, random_state=None)[source]¶ Implementation of VARMA-LiNGAM Algorithm [1]
References
[1] Yoshinobu Kawahara, Shohei Shimizu, Takashi Washio. Analyzing relationships among ARMA processes based on non-Gaussianity of external influences. Neurocomputing, Volume 74: 2212-2221, 2011 -
__init__
(order=(1, 1), criterion='bic', prune=False, max_iter=100, ar_coefs=None, ma_coefs=None, lingam_model=None, random_state=None)[source]¶ Construct a VARMALiNGAM model.
Parameters: - order (turple, length = 2, optional (default=(1, 1))) – Number of lags for AR and MA model.
- criterion ({'aic', 'bic', 'hqic', None}, optional (default='bic')) – Criterion to decide the best order in the all combinations of
order
. Searching the best order is disabled ifcriterion
isNone
. - prune (boolean, optional (default=False)) – Whether to prune the adjacency matrix or not.
- max_iter (int, optional (default=100)) – Maximm number of iterations to estimate VARMA model.
- ar_coefs (array-like, optional (default=None)) – Coefficients of AR of ARMA. Estimating ARMA model is skipped if specified
ar_coefs
and ma_coefs. Shape must be (order[0]
, n_features, n_features). - ma_coefs (array-like, optional (default=None)) – Coefficients of MA of ARMA. Estimating ARMA model is skipped if specified
ar_coefs
and ma_coefs. Shape must be (order[1]
, n_features, n_features). - lingam_model (lingam object inherits 'lingam._BaseLiNGAM', optional (default=None)) – LiNGAM model for causal discovery. If None, DirectLiNGAM algorithm is selected.
- random_state (int, optional (default=None)) –
random_state
is the seed used by the random number generator.
-
adjacency_matrices_
¶ Estimated adjacency matrix.
Returns: adjacency_matrices_ – The adjacency matrix psi and omega of fitted model, where n_features is the number of features. Return type: array-like, shape ((p, n_features, n_features), (q, n_features, n_features))
-
bootstrap
(X, n_sampling)[source]¶ Evaluate the statistical reliability of DAG based on the bootstrapping.
Parameters: - X (array-like, shape (n_samples, n_features)) – Training data, where
n_samples
is the number of samples andn_features
is the number of features. - n_sampling (int) – Number of bootstrapping samples.
Returns: result – Returns the result of bootstrapping.
Return type: TimeseriesBootstrapResult
- X (array-like, shape (n_samples, n_features)) – Training data, where
-
causal_order_
¶ Estimated causal ordering.
Returns: causal_order_ – The causal order of fitted model, where n_features is the number of features. Return type: array-like, shape (n_features)
-
estimate_total_effect
(X, E, from_index, to_index, from_lag=0)[source]¶ Estimate total effect using causal model.
Parameters: - X (array-like, shape (n_samples, n_features)) – Original data, where n_samples is the number of samples and n_features is the number of features.
- E (array-like, shape (n_samples, n_features)) – Original error data, where n_samples is the number of samples and n_features is the number of features.
- from_index – Index of source variable to estimate total effect.
- to_index – Index of destination variable to estimate total effect.
Returns: total_effect – Estimated total effect.
Return type: float
-
fit
(X)[source]¶ Fit the model to X.
Parameters: X (array-like, shape (n_samples, n_features)) – Training data, where n_samples
is the number of samples andn_features
is the number of features.Returns: self – Returns the instance itself. Return type: object
-
get_error_independence_p_values
()[source]¶ Calculate the p-value matrix of independence between error variables.
Returns: independence_p_values – p-value matrix of independence between error variables. Return type: array-like, shape (n_features, n_features)
-
residuals_
¶ Residuals of regression.
Returns: residuals_ – Residuals of regression, where n_samples is the number of samples. Return type: array-like, shape (n_samples)
-