binom_param | R Documentation |
Creates a data frame of possible combinations of n
(number of trials)
and p
(probabilities) that satisfy specified constraints on the mean, standard deviation,
and approximation conditions for normal or Poisson distributions.
The function applies the following rules:
If length(mean) == 1
and it is an integer, it specifies the number of digits
to which the mean should be rounded.
If mean = NA
(default), all mean values are allowed.
If length(mean) > 1
, only combinations where n * p
equals one of the specified means are retained.
The same logic applies to sd
for the standard deviation.
The norm
and pois
arguments can be logical, NA
, or a custom function of the form function(n, p)
.
They control which (n, p)
pairs are considered valid:
NA
allows all combinations.
A function returns TRUE
for valid combinations and FALSE
for invalid ones.
TRUE
enforces standard approximation rules:
norm
: n * p * (1 - p) > 9
(normal approximation condition)
pois
: n > 10 & p < 0.05
(Poisson approximation condition)
FALSE
excludes combinations that meet the approximation condition.
Note: The resulting data frame may be empty if no combinations meet all criteria.
binom_param(n, p, mean = NA, sd = NA, norm = NA, pois = NA, tol = 1e-06)
n |
integer vector of trial counts |
p |
numeric vector of probabilities |
mean |
numeric or integer specifying required mean digits or specific mean values |
sd |
numeric or integer specifying required standard deviation digits or specific sd values |
norm |
logical, |
pois |
logical, |
tol |
numeric: tolerance for numerical comparisons (default: |
A data frame with columns n
, p
, mean
, and sd
representing valid parameter combinations.
binom_param(1000:50000, (5:25)/100, mean = 0, sd = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.