binomial_prob: Calculates the posterior probability that the probability...

Description Usage Arguments Value Author(s) Examples

Description

Calculates the posterior probability that the probability parameter underlying a binomially distributed outcome is in a specified interval.

Usage

1
2
binomial_prob(n_successes, n_trials, prob_lower = 0, prob_upper = 1,
  prior_shape1 = 1, prior_shape2 = 1)

Arguments

n_successes

The number of successes.

n_trials

The total number of trials.

prob_lower

The lower end point of the interval.

prob_upper

The upper end point of the interval.

prior_shape1

The shape1 parameter of the Beta distribution defining the prior. The default values shape1=1 and shape2=1 define a flat prior assigning equal probability density to all possible parameter values.

prior_shape2

The shape2 parameter of the Beta distribution defining the prior. The default values shape1=1 and shape2=1 define a flat prior assigning equal probability density to all possible parameter values.

Value

The posterior probability that the parameter value lies in the specified interval.

Author(s)

Titus von der Malsburg <malsburg@uni-potsdam.de>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Probability of parameter being larger than 0.5 after seeing 6/9
# successes with flat prior:
binomial_prob(6, 9, 0.5)

# Probability of parameter being smaller than 0.5 after seeing 6/9
# successes with prior assuming one earlier success and one
# failure:
binomial_prob(6, 9, prob_upper=0.5, prior_shape1=2, prior_shape2=2)

# Probability of parameter being larger than 0.5 and smaller than
# 0.75 after seeing 6/9 successes with flat prior:
binomial_prob(6, 9, 0.5, 0.75)

tmalsburg/binomialCRIs documentation built on May 29, 2019, 5:41 a.m.