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] 15
nFathersPoisson()
#> [1] 13
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 
#>   2   4   7  20  34  71  75  85  84 105  84  99  74  79  47  51  24  22  14  11 
#>  25  26  29 
#>   4   3   1 

nFathersTruncPoisson()
#> [1] 12
nFathersTruncPoisson()
#> [1] 20
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 
#>   3   2   2   8  22  30  39  65  81  93 117  88 101  88  65  49  53  33  19  21 
#>  24  25  26  27  29  31 
#>  10   3   1   4   2   1