Sample a number of fathers - use when nFathers = NULL (see SimParamBee$nFathers).

This is just an example. You can provide your own functions that satisfy your needs!

nFathersPoisson(n = 1, average = 15)

nFathersTruncPoisson(n = 1, average = 15, lowerLimit = 0)

Arguments

n

integer, number of samples

average

numeric, average number of fathers

lowerLimit

numeric, returned numbers will be above this value

Value

numeric, number of fathers

Details

nFathersPoisson samples from a Poisson distribution, which can return a value 0 (that would mean a failed queen mating).

nFathersTruncPoisson samples from a truncated Poisson distribution (truncated at zero) to avoid failed matings.

Functions

  • nFathersTruncPoisson(): Sample a non-zero number of fathers

See also

SimParamBee field nFathers

Examples

nFathersPoisson()
#> [1] 14
nFathersPoisson()
#> [1] 16
n <- nFathersPoisson(n = 1000)
hist(n, breaks = seq(from = min(n), to = max(n)), xlim = c(0, 40))

table(n)
#> n
#>   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22 
#>   1   1   1   2   7  17  25  54  59  72 109  97 111  86  88  63  59  53  35  17 
#>  23  24  25  26  27  29  33 
#>  18  10   5   5   3   1   1 

nFathersTruncPoisson()
#> [1] 18
nFathersTruncPoisson()
#> [1] 17
n <- nFathersTruncPoisson(n = 1000)
hist(n, breaks = seq(from = min(n), to = max(n)), xlim = c(0, 40))

table(n)
#> n
#>   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23 
#>   1   2   5   7  25  34  43  69  95  97  89  88 106  89  67  55  34  33  30  11 
#>  24  25  26  28  31 
#>  10   1   5   3   1