Learn R Programming

cfid (version 0.1.8)

probability: Symbolic Probability Distributions

Description

Defines an interventional or observational (conditional) probability \(P(y|do(x),z)\). For formatting options, see format.probability().

Usage

probability(val = NULL, var = NULL, do = NULL, cond = NULL)

# S3 method for probability format(x, use_do = FALSE, ...)

# S3 method for probability print(x, ...)

Value

An object of class probability, which is a list containing all of the arguments of the constructor.

A character representation of the probability object in LaTeX syntax.

Arguments

val

An integer value of either 0 or 1 for almost sure events.

var

A list of objects of class counterfactual_variable (without interventions and with value assignments). var defines the observations \(y\) in \(P(y|do(x),z)\).

do

A list of counterfactual_variable variable objects (without interventions and with value assignments). Defines the intervention set \(x\) in \(P(y|do(x),z)\).

cond

A list of counterfactual_variable variable objects (without interventions and with value assignments).Defines the conditioning set \(z\) in \(P(y|do(x),z)\).

x

A probability object.

use_do

A logical value. If TRUE, the explicit do-operation is used to denote interventional probabilities (e.g., \(P(y|do(x))\)). If FALSE (the default), the subscript notation is used instead (e.g., \(P_x(y)\)).

...

Additional arguments passed to format.

See Also

counterfactual_variable(), functional()

Examples

Run this code
# Example from Makhlouf, Zhioua and Palamidessi (2021)
g2 <- dag("C -> A -> Y; C -> Y")
v1 <- cf("Y", 0, c(A = 1))
v2 <- cf("A", 0)
c1 <- conj(v1)
c2 <- conj(v2)
f <- identifiable(g2, c1, c2)$formula

# Default, using primes and subscript notation
format(f)

# Without primes, no do-operator
format(f, use_primes = FALSE)

# Primes, with do-operator
format(f, use_do = TRUE)

# Without primes, with do-operator
format(f, use_primes = FALSE, use_do = TRUE)

Run the code above in your browser using DataLab