define: Define

Description Usage Arguments Value Examples

Description

Define a likelihood

Usage

1
define(x, likelihood)

Arguments

x

A data.frame.

likelihood

A formula where the right hand side is a variable in x and the left hand side is a the name of a function.

Value

A data.frame with the likelihood as an attribute.

Examples

1
2
3
4
5
6
7
8
9
  my_lik <- function(data, theta) {dnorm(data, mean = 3.07333 , sd = theta)}
  my_prior <- function(theta) {dgamma(theta, shape = 1)}

  posterior <- define(iris, Sepal.Width ~ my_lik) %>%
    assume(prior = ~ my_prior) %>%
    draw(initial = .43, nbatch = 1e5, blen = 1, scale = .01) %>%
    diagnose() %>%
    clean(burnin = 0, subsample = 40) %>%
    diagnose()

nicksolomon/binfer documentation built on May 21, 2019, 9:21 a.m.