Prior.create_likelihood_variable#

Prior.create_likelihood_variable(name, mu, observed)[source]#

Create a likelihood variable from the prior.

Will require that the distribution has a mu parameter and that it has not been set in the parameters.

Parameters:
namestr

The name of the variable.

mupt.TensorLike

The mu parameter for the likelihood.

observedpt.TensorLike

The observed data.

Returns:
pt.TensorVariable

The PyMC variable.

Examples

Create a likelihood variable in a larger PyMC model.

import pymc as pm

dist = Prior("Normal", sigma=Prior("HalfNormal"))

with pm.Model():
    # Create the likelihood variable
    mu = pm.Normal("mu", mu=0, sigma=1)
    dist.create_likelihood_variable("y", mu=mu, observed=observed)