| nWorkersPoisson {SIMplyBee} | R Documentation |
Sample a number of workers
Description
Sample a number of workers - used when nInd = NULL
(see SimParamBee$nWorkers).
This is just an example. You can provide your own functions that satisfy your needs!
Usage
nWorkersPoisson(colony, n = 1, average = 100)
nWorkersTruncPoisson(colony, n = 1, average = 100, lowerLimit = 0)
nWorkersColonyPhenotype(
colony,
queenTrait = 1,
workersTrait = NULL,
checkProduction = FALSE,
lowerLimit = 0,
...
)
Arguments
colony |
|
n |
integer, number of samples |
average |
numeric, average number of workers |
lowerLimit |
numeric, returned numbers will be above this value |
queenTrait |
numeric (column position) or character (column name), trait
that represents queen's effect on the colony phenotype (defined in
|
workersTrait |
numeric (column position) or character (column name), trait
that represents workers's effect on the colony phenotype (defined in
|
checkProduction |
logical, does the phenotype depend on the production
status of colony; if yes and production is not |
... |
other arguments of |
Details
nWorkersPoisson samples from a Poisson distribution with a
given average, which can return a value 0. nDronesTruncPoisson
samples from a zero truncated Poisson distribution.
nWorkersColonyPhenotype returns a number (above lowerLimit)
as a function of colony phenotype, say queen's fecundity. Colony phenotype
is provided by mapCasteToColonyPheno. You need to set up
traits influencing the colony phenotype and their parameters (mean and
variances) via SimParamBee (see examples).
Value
numeric, number of workers
Functions
-
nWorkersTruncPoisson(): Sample a non-zero number of workers -
nWorkersColonyPhenotype(): Sample a non-zero number of workers based on colony phenotype, say queen's fecundity
See Also
SimParamBee field nWorkers and
vignette(topic = "QuantitativeGenetics", package = "SIMplyBee")
Examples
nWorkersPoisson()
nWorkersPoisson()
n <- nWorkersPoisson(n = 1000)
hist(n, breaks = seq(from = min(n), to = max(n)), xlim = c(0, 200))
table(n)
nWorkersTruncPoisson()
nWorkersTruncPoisson()
n <- nWorkersTruncPoisson(n = 1000)
hist(n, breaks = seq(from = min(n), to = max(n)), xlim = c(0, 200))
table(n)
# Example for nWorkersColonyPhenotype()
founderGenomes <- quickHaplo(nInd = 3, nChr = 1, segSites = 100)
SP <- SimParamBee$new(founderGenomes)
average <- 100
h2 <- 0.1
SP$addTraitA(nQtlPerChr = 100, mean = average, var = average * h2)
SP$setVarE(varE = average * (1 - h2))
basePop <- createVirginQueens(founderGenomes)
drones <- createDrones(x = basePop[1], nInd = 50)
droneGroups <- pullDroneGroupsFromDCA(drones, n = 2, nDrones = 15)
colony1 <- createColony(x = basePop[2])
colony2 <- createColony(x = basePop[3])
colony1 <- cross(colony1, drones = droneGroups[[1]])
colony2 <- cross(colony2, drones = droneGroups[[2]])
colony1@queen@pheno
colony2@queen@pheno
createWorkers(colony1, nInd = nWorkersColonyPhenotype)
createWorkers(colony2, nInd = nWorkersColonyPhenotype)