ananke.models package¶

ananke.models.linear_gaussian_sem module¶

Class for Linear Gaussian SEMs parametrized by a matrix B representing regression coefficients and a matrix Omega representing correlated errors

class ananke.models.linear_gaussian_sem.LinearGaussianSEM(graph, method='trust-exact')[source]

Bases: object

draw(direction=None)[source]

Visualize the graph.

:return : dot language representation of the graph.

fit(X, weights=None, tol=1e-06, disp=None)[source]

Fit the model to data via (weighted) maximum likelihood estimation

Parameters: X – data – a N x M dimensional pandas data frame. weights – optional 1d numpy array with weights for each data point (rows with higher weights are given greater importance). self.
neg_loglikelihood(X, weights=None)[source]

Calculate log-likelihood of the data given the model.

Parameters: X – a N x M dimensional data matrix. weights – optional 1d numpy array with weights for each data point (rows with higher weights are given greater importance). a float corresponding to the log-likelihood.
total_effect(A, Y)[source]

Calculate the total causal effect of a set of treatments A on a set of outcomes Y.

Parameters: A – iterable corresponding to variable names that act as treatments. Y – iterable corresponding to variable names that act as outcomes. a float corresponding to the total causal effect.