Censored#

class pymc_extras.prior.Censored(distribution: InstanceOf[Prior], lower: float | InstanceOf[pt.TensorVariable] = -inf, upper: float | InstanceOf[pt.TensorVariable] = inf)[source]#

Create censored random variable.

Examples

Create a censored Normal distribution:

from pymc_extras.prior import Prior, Censored

normal = Prior("Normal")
censored_normal = Censored(normal, lower=0)

Create hierarchical censored Normal distribution:

from pymc_extras.prior import Prior, Censored

normal = Prior(
    "Normal",
    mu=Prior("Normal"),
    sigma=Prior("HalfNormal"),
    dims="channel",
)
censored_normal = Censored(normal, lower=0)

coords = {"channel": range(3)}
samples = censored_normal.sample_prior(coords=coords)
__init__(*args: Any, **kwargs: Any) None#

Methods

__init__(*args, **kwargs)

create_likelihood_variable(name, mu, observed)

Create observed censored variable.

create_variable(name[, xdist])

Create censored random variable.

from_dict(data)

Create a censored distribution from a dictionary.

sample_prior([coords, name, xdist])

Sample the prior distribution for the variable.

to_dict()

Convert the censored distribution to a dictionary.

to_graph()

Generate a graph of the variables.

Attributes

dims

The dims from the distribution to censor.

lower

upper

distribution