Randomly draw error fractions based on a prior plus the outcome of a continuous binomial experiment
Source:R/ssoestimate.R
rbinom_continuous_get_p.Rd
The number of error fractions drawn is given by MC.
Arguments
- fun_prior
The a priori chance function of the error fraction. fun_prior should be a one argument function of [0, 1] to [0, infinity). The function should be defined for the arguments
(1-0.5)/S
,(2-0.5)/S
, ...(S-0.5)/S
. In other words, the function should be defined for the members of the vectorpartition_0_1(S)
. Default isunity()
, a function that returns 1 for all values in [0, 1], so a flat prior.- k
The sum of partial and full errors found in the binomial sample.
k
is a non negative real number.k <= n
.- n
The number of transactions in the binomial sample.
n
is a positive real number. Note that we follow the convention to use a lower case n for the number of transactions in the sample- S
The evenly spread number of possible error fractions over the range [0, 1] we consider for this computation.
- MC
The number of times we draw an error fraction, and so also the number of error fractions returned.
Details
We talk here about "error fractions" in the context of binomial random experiments, say coin flips, which can have each one of two outcomes: "heads" or "tails". Without any moral value judgement we design one of the two outcomes as "in error". E.g. the tails are the error outcomes. In further stretch of the imagination we use here the term continuous binomial experiment, meaning that the number of throws and the number of heads or tails outcomes need not be a whole integer number, but can be any non negative number.
The difference between this function and for example rbinom() is that rbinom() is a function that has as input the bias of a coin; from this bias rbinom() randomly produces possible outcomes of throwing this coin. The function, rbinom_continuous_get_p(), has as input the outcome of random throws of a coin, and returns as output random chance densities of the bias of that coin.