hyper_param {exams.forge} | R Documentation |
Parameters for Hypergeometric Distributions
Description
Generates a data frame with potential values for m
, n
and k
. If hyper2
is FALSE
then the
parametrization of stats::dhyper()
is used, otherwise n+m
, m
and k
is used and transformed to m
, n
and k
.
In accordance with specific conditions it holds that:
if
length(mean)==1
and it's an integer, it signifies the desired number of digits for the meanif
mean
is set toNA
(the default), all means are permissiblewhen
length(mean) > 1
, the productk*m/(n+m)
must be one of the valid meansthe same rules apply to
sd
The parameters norm
, pois
and binom
can take on the values NA
, TRUE
, FALSE
,
or be defined as a function of the format: function(m, n, k)
.
These values determine which (m, n, k)
combinations are eligible:
for
NA
, all combinations of(m, n, k)
are acceptableif specified as a function, only those combinations for which the function evaluates to
TRUE
are considered validif set to
TRUE
, combinations are accepted only if they satisfy either the conditionk*m/(m+n)*(1-m/(m+n))>=9
(fornorm
, indicating a normal distribution approximation), the conditionsk/(n+m) < 0.05
,m/(n+m) < 0.05
andk>10
(forpois
, implying a Poisson distribution approximation) and the conditionk/(n+m) < 0.05
(forbinom
, implying a binomial 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
hyper_param(
m,
n,
k,
mean = NA,
sd = NA,
norm = NA,
pois = NA,
binom = NA,
tol = 1e-06,
hyper2 = FALSE
)
Arguments
m |
numeric: the number of white balls in the urn |
n |
numeric: the number of black balls in the urn |
k |
numeric: the number of balls drawn from the urn, hence must be in |
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 |
binom |
logical or function: binomial approximation possible |
tol |
numeric: the tolerance for numerical comparison (default: '1e-6) |
hyper2 |
logical: should the standard R parametrization |
Value
A data frame with possible the choices of n
, p
, mean
and sd
.
Examples
hyper_param(7:14, 1:13, 3:10, norm=FALSE, pois=FALSE, binom=FALSE, hyper2=TRUE)