Censored#

class pymc_marketing.prior.Censored(*args, **kwargs)[source]#

Create censored random variable.

Examples

Create a censored Normal distribution:

from pymc_marketing.prior import Prior, Censored

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

Create hierarchical censored Normal distribution:

from pymc_marketing.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)

Methods

Censored.__init__(*args, **kwargs)

Censored.create_likelihood_variable(name, ...)

Create observed censored variable.

Censored.create_variable(name)

Create censored random variable.

Censored.from_dict(data)

Create a censored distribution from a dictionary.

Censored.sample_prior([coords, name])

Sample the prior distribution for the variable.

Censored.to_dict()

Convert the censored distribution to a dictionary.

Censored.to_graph()

Generate a graph of the variables.

Attributes

dims

The dims from the distribution to censor.

lower

upper

distribution