Learn R Programming

greta (version 0.1.3)

greta-likelihood: Define a Likelihood over Data

Description

The likelihood function is used to link observed data with random variables. This can be used to define the likelhood term for a model.

Usage

likelihood(data) <- value

Arguments

data
either a data greta array (defined using as_data()), or some data that can be coereced to a data greta array
value
a stochastic greta array, created using a distribution

Examples

Run this code
# observed data
y = rnorm(100, 0, 3)

# mean and variance parameters (with no priors)
mu = free()
sigma = exp(free())

# define the likelihood
likelihood(y) = normal(mu, sigma)

Run the code above in your browser using DataLab