Distributional Inference

# Distributional Inference

Note

TLDR: Omega allows you to turn a distributional property (e.g. `mean`, `var`, `kurtosis`), from a concrete value (e.g. a `Float64`) into a `RandVar`. These `RandVar`s can then be conditioned.

Use either `rcd`, `rcdₛ` or `rid`.

``````rcd
rid
rcdₛ``````

`rid` are `rcd` are equivlaet in some cases. `rid` is much more efficient, so use that if possible. If they are not equivlanet and you must use `rcd`, it's likely you will want to use the `rcdₛ` which uses soft equality [ref]

Since this is a new concept, it requires some explanation.

# Random Distributional Properties

Distributional properties are fixed (often real) values, but in a sense they are random variables too. For example, rainfall depends on temperature, the season, the presence of clouds, and so on. With respect to a model, expected rainfall is a real value, but it changes if we obtain new information. For example it rises if we observe clouds and falls to zero if we observe their absence. These two expectations becomes a random variable over expectations – a conditional expectation – when we take into account the probabilities of the presence or absence of clouds. Moreover, for each random variable in the model there is a corresponding conditional expectation. For instance, with respect to the season, conditional expected rainfall is a random variable over four expectations, one for each season; with respect to temperature it is a continuous distribution. These conditional expectations capture the uncertainty over expected rainfall that results from other variables in the model, whereas the unconditional expected rainfall averages all the uncertainty away.

Omega has a number of mechanisms to automatically capture the uncertainty over any distributional property. It is based on a new concept called the random conditional distribution.

## Random Conditional Distribution

``````rcd(x, θ)
rcd(x, θ, eq)
``````

Random Conditional Distribution of `x` given `Θ`.

Random conditional distributions provide a mechanism to condition distributional properties. Given two random variables \$X\$ and \$Θ\$, the random conditional distribution of \$X\$ given \$Θ\$ – which we denote \$X ∥ Θ\$ – is a a random distribution: a random variable whose `elemtype` is a random variables. In particular, each realization of \$X ∥ Θ\$ is the random variable \$X\$ conditioned on \$Θ = θ\$ where \$θ ∼ Θ\$ is a realization of \$Θ\$:

The random conditional distribution (rcd) of a random variable \$X: Ω → τ_1\$ given \$Θ: Ω → τ_2\$ is a random variable \$X ∥ Θ: Ω → ( Ω → τ_1)\$, defined as:

\$(x ∥ θ) = ω -> x | (Θ = Θ(ω))\$

source

## Random Interventional Distribution

``````rid(x, θ)
``````

Random Interventional Distribution of `x` given `Θ`

``````μ = uniform([-100.0, 100.0])
x = normal(μ, 1.0)
x_ = rid(x, μ)
mean(x_)``````

Given two random variables \$X\$ and \$Θ\$, the random interventional distribution of \$X\$ given \$Θ\$ is a a random distribution (`RandVar` with `elemtype` `RandVar`). In particular, each realization of \$rid(X, Θ)\$ is the random variable \$X\$ subject to the intervention \$Θ = Θ\$ where \$Θ ∼ Θ\$ is a realization of \$Θ\$:

The random interventional distribution of a random variable `X` with elem type `tau_1` given \$Θ: Ω → τ_2\$ is a random variable \$x ∥ do(θ): Ω → (Ω → τ_1)\$, defined as:

\$x ∥ do(θ) = ω → x | do(θ = θ(ω))\$

source

## rcd or rid?

In many cases `rcd` and `rid` are equivalent. In these cases you should prefer `rid`, since it is much more efficient. The conditions with which they are equivalent are a bit subtle.