ananke.models package¶
Submodules¶
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='trustexact')[source]¶ Bases:
object

draw
(direction=None)[source]¶ Visualize the graph.
:return : dot language representation of the graph.

fit
(X, weights=None, tol=1e06, 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).
Returns: self.

neg_loglikelihood
(X, weights=None)[source]¶ Calculate loglikelihood 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).
Returns: a float corresponding to the loglikelihood.

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.
Returns: a float corresponding to the total causal effect.
