# LongitudinalLiNGAM¶

class lingam.LongitudinalLiNGAM(n_lags=1, measure='pwling', random_state=None)[source]

Implementation of Longitudinal LiNGAM algorithm [1]

References

 [1] K. Kadowaki, S. Shimizu, and T. Washio. Estimation of causal structures in longitudinal data using non-Gaussianity. In Proc. 23rd IEEE International Workshop on Machine Learning for Signal Processing (MLSP2013), pp. 1–6, Southampton, United Kingdom, 2013.
__init__(n_lags=1, measure='pwling', random_state=None)[source]

Construct a model.

Parameters: n_lags (int, optional (default=1)) – Number of lags. measure ({'pwling', 'kernel'}, default='pwling') – Measure to evaluate independence : ‘pwling’ or ‘kernel’. random_state (int, optional (default=None)) – random_state is the seed used by the random number generator.
adjacency_matrices_

Estimated adjacency matrices.

Returns: adjacency_matrices_ – The list of adjacency matrix B(t,t) and B(t,t-τ) for longitudinal datasets. The shape of B(t,t) and B(t,t-τ) is (n_features, n_features), where n_features is the number of features. If the previous data required for the calculation are not available, such as B(t,t) or B(t,t-τ) at t=0, all elements of the matrix are nan. array-like, shape ((B(t,t), B(t,t-1), .., B(t,t-τ)), ..)
bootstrap(X_list, n_sampling, start_from_t=1)[source]

Evaluate the statistical reliability of DAG based on the bootstrapping.

Parameters: X_list (array-like, shape (X, ..)) – Longitudinal multiple datasets for training, where X is an dataset. The shape of ‘’X’’ is (n_samples, n_features), where n_samples is the number of samples and n_features is the number of features. n_sampling (int) – Number of bootstrapping samples. results – Returns the results of bootstrapping for multiple datasets. array-like, shape (BootstrapResult, ..)
causal_orders_

Estimated causal ordering.

Returns: causal_order_ – The causal order of fitted models for B(t,t). The shape of causal_order is (n_features), where n_features is the number of features. array-like, shape (causal_order, ..)
estimate_total_effect(X_t, from_t, from_index, to_t, to_index)[source]

Estimate total effect using causal model.

Parameters: X_t (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. _t (from) – The timepoint of source variable. from_index – Index of source variable to estimate total effect. to_t – The timepoint of destination variable. to_index – Index of destination variable to estimate total effect. total_effect – Estimated total effect. float
fit(X_list)[source]

Fit the model to datasets.

Parameters: X_list (list, shape [X, ..]) – Longitudinal multiple datasets for training, where X is an dataset. The shape of X is (n_samples, n_features), where n_samples is the number of samples and n_features is the number of features. self – Returns the instance itself. 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. array-like, shape (n_features, n_features)
residuals_

Residuals of regression.

Returns: residuals_ – Residuals of regression, where E is an dataset. The shape of E is (n_samples, n_features), where n_samples is the number of samples and n_features is the number of features. list, shape [E, ..]