Compute probability of observations given a vector of probability of heads

dcoin_from_probability(
  pheads,
  nheads,
  nflips,
  log = FALSE,
  possibilities = get_possibilities(nheads, nflips),
  diff_value = NULL
)

Arguments

pheads

Vector with the probability of a heads on flip 1, 2, etc.

nheads

Number of heads

nflips

Total number of flips (heads and tails)

log

If TRUE return log transformed probabilities.

possibilities

All possible sequences of flips that lead to the observed number of heads

diff_value

If not NULL, the final likelihood will be abs(likelihood - diff_value) for minimizing a function

Value

The likelihood of the data (or log likelihood if log=TRUE)