Skip to content

Distribution

class Distribution<Value> < Object

Probability distribution.

  • Value: Value type.

Member Variables

Name Description
future:Value? Future value. This is set for situations where delayed sampling is used, but when ultimately realized, a particular value (this one) should be assigned, and updates or downdates applied accordingly. It is typically used when replaying traces.
futureUpdate:Boolean When assigned, should the future value trigger an update? (Otherwise a downdate.)
delay:DelayValue<Value>? Associated node on delayed sampling -path.

Member Functions

Name Description
setFuture Set the future value to be produced from the distribution.
hasValue Does the distribution have a value?
value Get the value of the node, realizing it if necessary.
simulate Simulate a random variate.
observe Observe a random variate.
update Update the parameters of the distribution with a given value.
downdate Downdate the parameters of the distribution with a given value.
pmf Evaluate the probability mass function (if it exists) at a value.
pdf Evaluate the probability density function (if it exists) at a value.
cdf Evaluate the cumulative distribution function at a value.
lower Finite lower bound of the support of this node, if any.
upper Finite upper bound of the support of this node, if any.
graft Graft this onto the delayed sampling -path.
detach Detach this from the delayed sampling -path.

Member Function Details

cdf

function cdf(x:Value) -> Real

Evaluate the cumulative distribution function at a value.

  • x: The value.

Return: the cumulative probability

detach

function detach()

Detach this from the delayed sampling -path.

downdate

function downdate(x:Value)

Downdate the parameters of the distribution with a given value. This undoes the effects of an update().

  • x: The value.

graft

function graft()

Graft this onto the delayed sampling -path.

hasValue

function hasValue() -> Boolean

Does the distribution have a value?

lower

function lower() -> Value?

Finite lower bound of the support of this node, if any.

observe

function observe(x:Value) -> Real

Observe a random variate.

  • x: The observed value.

Return: The log likelihood.

pdf

function pdf(x:Value) -> Real

Evaluate the probability density function (if it exists) at a value.

  • x: The value.

Return: the probability density.

pmf

function pmf(x:Value) -> Real

Evaluate the probability mass function (if it exists) at a value.

  • x: The value.

Return: the probability mass.

setFuture

function setFuture(future:Value, futureUpdate:Boolean)

Set the future value to be produced from the distribution.

  • future: Future value.
  • futureUpdate: When realized, should the future value trigger an update? (Otherwise a downdate.)

simulate

function simulate() -> Value

Simulate a random variate.

Return: The simulated value.

update

function update(x:Value)

Update the parameters of the distribution with a given value.

Return: The value.

upper

function upper() -> Value?

Finite upper bound of the support of this node, if any.

value

function value() -> Value

Get the value of the node, realizing it if necessary.