Aapo Hyvärinen

Menu

Code for Pairwise Causality Measures

This page contains code for computing the pairwise causality measures introduced in:
A. Hyvärinen and S. M. Smith. Pairwise Likelihood Ratios for Estimation of Non-Gaussian Structural Equation Models. J. of Machine Learning Research 14:111-152, 2013.

Download Matlab code here.

A simple example of using the code:

LR=pwling(X,1);
where X is the data matrix with variables as rows, and observations as columns. The number 1 refers to the causality measure and can be 1...5. Measure #1 is the general-purpose one. Use it unless you know you have a good reason to use something else.

The output is the matrix LR which contains the causality measures between all possible pairs of variables. If entry LR(i,j) is positive, the estimate of causal direction is i -> j, otherwise it is j-> i. This matrix is by definition skew-symmetric.

This code only finds the directionalities, and does not estimate the existence of connections. That is, it gives the estimated direction for each possible pair of variables. You should use some other method (e.g. inverse covariance matrix or matrix of partial correlations) to infer which variables are connected at all.