binom_param {exams.forge} | R Documentation |
Binomial Parameters
Description
Generates a data frame with potential values for size
and prob
,
and is subjected to specific conditions:
If
length(mean) == 1
and it's an integer, it signifies the desired number of digits for the mean.If
mean
is set toNA
(the default), all means are permissible.When
length(mean) > 1
, the productsize * prob
must be one of the valid means.The same rules applies to
sd
.
The parameters norm
and pois
can take on values of NA
, TRUE
, FALSE
,
or be defined as a function in the format: function(size, prob)
.
These values determine which (size, prob)
combinations are eligible:
For
NA
, all combinations of(size, prob)
are acceptable.If specified as a function, only those combinations for which the function returns
TRUE
are considered valid.If set to
TRUE
, combinations are accepted only if they satisfy either the conditionsize * prob * (1 - prob) > 9
(fornorm
, indicating a normal distribution approximation), or the conditionsprob < 0.05
andn > 10
(forpois
, implying a Poisson distribution approximation).If set to
FALSE
, the approximations should not hold for any combination.
Please be aware that there is no guarantee that the resulting data frame will include a valid solution.
Usage
binom_param(n, p, mean = NA, sd = NA, norm = NA, pois = NA, tol = 1e-06)
Arguments
n |
integer: vector number of observations |
p |
numeric: vector of probabilities |
mean |
integer or numeric: number of digits the mean should have |
sd |
integer or numeric: number of digits the standard deviation should have |
norm |
logical or function: normal approximation possible |
pois |
logical or function: poisson approximation possible |
tol |
numeric: the tolerance for numerical comparison (default: '1e-6) |
Value
a data frame with possible choices of n
, p
, mean
and sd
Examples
binom_param(1000:50000, (5:25)/100, 0, 0)