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] 18
nFathersPoisson()
#> [1] 15
n <- nFathersPoisson(n = 1000)
hist(n, breaks = seq(from = min(n), to = max(n)), xlim = c(0, 40))

table(n)
#> n
#>   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24 
#>   1   3  15  18  35  44  66  73 101  97  95  98  98  64  59  42  33  28  12   8 
#>  25  26  27  28  32 
#>   3   2   3   1   1 

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

table(n)
#> n
#>   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24 
#>   1   3   9  27  31  38  72  89 101 122 107  92  84  57  57  25  28  24  10  10 
#>  25  26  27  28  30 
#>   7   2   2   1   1