Module

Data.Graph.Causal

Package
purescript-causal-graphs
Repository
colehaus/purescript-causal-graphs

#IsCollider Source

data IsCollider collider path graph

#isCollider Source

isCollider :: forall v k g p. Ord k => Proof (IsPathOf p g) -> k -> Named p (Path k) -> Named g (Graph k v) -> Maybe (Proof (IsCollider k p g))

#AreDConnected Source

data AreDConnected vertices conditionedOn graph

#areDConnected Source

areDConnected :: forall v k g m n. Ord k => Proof (AreDisjoint n m) -> Named n (TwoSet k) -> Named m (Set k) -> Named g (Graph k v) -> Maybe (Proof (AreDConnected n m g))

#dConnectedBy Source

dConnectedBy :: forall v k g m n. Ord k => Proof (AreDisjoint n m) -> Named n (TwoSet k) -> Named m (Set k) -> Named g (Graph k v) -> Set (Named (PathOf g) (Path k))

#Blocked Source

data Blocked path conditionedOn graph

#Unblocked Source

data Unblocked path conditionedOn graph

#isBlocked Source

isBlocked :: forall v p m k g. Ord k => Proof (IsPathOf p g) -> Named p (Path k) -> Named m (Set k) -> Named g (Graph k v) -> Either (Proof (Unblocked p m g)) (Proof (Blocked p m g))

#dConnectedTo Source

dConnectedTo :: forall v k m n. Ord k => Proof (AreDisjoint n m) -> Named n k -> Named m (Set k) -> Graph k v -> Set k

#AreDSeparated Source

data AreDSeparated vertices conditionedOn graph

#areDSeparated Source

areDSeparated :: forall v k g m n. Ord k => Proof (AreDisjoint n m) -> Named n (TwoSet k) -> Named m (Set k) -> Named g (Graph k v) -> Maybe (Proof (AreDSeparated n m g))

#dSeparatedFrom Source

dSeparatedFrom :: forall v k m n. Ord k => Proof (AreDisjoint n m) -> Named n k -> Named m (Set k) -> Graph k v -> Set k

#dSeparations Source

dSeparations :: forall v k. Ord k => Set k -> Graph k v -> Set (TwoSet k)

#instruments Source

instruments :: forall v k m n. Ord k => Proof (AreDisjoint n m) -> Named n { cause :: k, effect :: k } -> Named m (Set k) -> Graph k v -> Set k

#IsInstrument Source

data IsInstrument instrument causeEffect conditionedOn graph

#isInstrument Source

isInstrument :: forall v k g m n i. Ord k => Proof (AreDisjoint n m) -> Named i k -> Named n { cause :: k, effect :: k } -> Named m (Set k) -> Named g (Graph k v) -> Maybe (Proof (IsInstrument i n m g))

#intervene Source

intervene :: forall v k. Ord k => k -> Graph k v -> Graph k v

#SatisfiesBackdoor Source

data SatisfiesBackdoor causeEffect conditionedOn graph

#satisfiesBackdoor Source

satisfiesBackdoor :: forall v k g m n. Ord k => Proof (AreDisjoint n m) -> Named n { cause :: k, effect :: k } -> Named m (Set k) -> Named g (Graph k v) -> Maybe (Proof (SatisfiesBackdoor n m g))

#backdoorPaths Source

backdoorPaths :: forall v k g. Ord k => { cause :: k, effect :: k } -> Named g (Graph k v) -> Set (Named (PathOf g) (Path k))

#minimalBackdoorSets Source

minimalBackdoorSets :: forall v k. Ord k => { cause :: k, effect :: k } -> Graph k v -> Set (Set k)

#backdoorSets Source

backdoorSets :: forall v k. Ord k => { cause :: k, effect :: k } -> Graph k v -> Set (Set k)

An empty outer set means the backdoor criterion can't be satisfied. An empty inner set means it's satisfied trivially--i.e. with no conditioning.

#SatisfiesFrontdoor Source

data SatisfiesFrontdoor causeEffect conditionedOn graph

#satisfiesFrontdoor Source

satisfiesFrontdoor :: forall v k g m n. Ord k => Proof (AreDisjoint n m) -> Named n { cause :: k, effect :: k } -> Named m (Set k) -> Named g (Graph k v) -> Maybe (Proof (SatisfiesBackdoor n m g))

#frontdoorPaths Source

frontdoorPaths :: forall v k g. Ord k => { cause :: k, effect :: k } -> Named g (Graph k v) -> Set (Named (PathOf g) (Path k))

An empty outer set means the backdoor criterion can't be satisfied. An empty inner set means it's satisfied trivially--i.e. with no conditioning.

#minimalFrontdoorSets Source

minimalFrontdoorSets :: forall v k. Ord k => { cause :: k, effect :: k } -> Graph k v -> Set (Set k)

#frontdoorSets Source

frontdoorSets :: forall v k. Ord k => { cause :: k, effect :: k } -> Graph k v -> Set (Set k)

Returns either each set of conditioning vertices that satisfies the frontdoor criterion or the frontdoor paths which can't be avoided by any set of conditioning vertices