nDronesPoisson {SIMplyBee} | R Documentation |
Sample a number of drones
Description
Sample a number of drones - used when nDrones = NULL
(see SimParamBee$nDrones
).
This is just an example. You can provide your own functions that satisfy your needs!
Usage
nDronesPoisson(x, n = 1, average = 100)
nDronesTruncPoisson(x, n = 1, average = 100, lowerLimit = 0)
nDronesColonyPhenotype(
x,
queenTrait = 1,
workersTrait = NULL,
checkProduction = FALSE,
lowerLimit = 0,
...
)
Arguments
x |
|
n |
integer, number of samples |
average |
numeric, average number of drones |
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
nDronesPoisson
samples from a Poisson distribution with a
given average, which can return a value 0.
nDronesTruncPoisson
samples from a zero truncated Poisson
distribution.
nDronesColonyPhenotype
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).
When x
is Pop-class
, only workersTrait
is not
used, that is, only queenTrait
is used.
Value
numeric, number of drones
Functions
-
nDronesTruncPoisson()
: Sample a non-zero number of drones -
nDronesColonyPhenotype()
: Sample a non-zero number of drones based on colony phenotype, say queen's fecundity
See Also
SimParamBee
field nDrones
and
vignette(topic = "QuantitativeGenetics", package = "SIMplyBee")
Examples
nDronesPoisson()
nDronesPoisson()
n <- nDronesPoisson(n = 1000)
hist(n, breaks = seq(from = min(n), to = max(n)), xlim = c(0, 200))
table(n)
nDronesTruncPoisson()
nDronesTruncPoisson()
n <- nDronesTruncPoisson(n = 1000)
hist(n, breaks = seq(from = min(n), to = max(n)), xlim = c(0, 200))
table(n)
# Example for nDronesColonyPhenotype()
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
createDrones(colony1, nInd = nDronesColonyPhenotype)
createDrones(colony2, nInd = nDronesColonyPhenotype)