distribution: define a distribution over data

Description Usage Arguments Details Examples

View source: R/distribution.R

Description

distribution defines probability distributions over observed data, e.g. to set a model likelihood.

Usage

1
2
3

Arguments

greta_array

a data greta array. For the assignment method it must not already have a probability distribution assigned

value

a greta array with a distribution (see distributions())

Details

The extract method returns the greta array if it has a distribution, or NULL if it doesn't. It has no real use-case, but is included for completeness

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 

# define a model likelihood

# observed data and mean parameter to be estimated
# (explicitly coerce data to a greta array so we can refer to it later)
y <- as_data(rnorm(5, 0, 3))

mu <- uniform(-3, 3)

# define the distribution over y (the model likelihood)
distribution(y) <- normal(mu, 1)

# get the distribution over y
distribution(y)

## End(Not run)

goldingn/greta documentation built on May 24, 2021, 11 a.m.