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

Pop-class or Colony-class

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 SimParamBee - see examples); if 0 then this effect is 0

workersTrait

numeric (column position) or character (column name), trait that represents workers's effect on the colony phenotype (defined in SimParamBee - see examples); if 0 then this effect is 0

checkProduction

logical, does the phenotype depend on the production status of colony; if yes and production is not TRUE, the result is above lowerLimit

...

other arguments of mapCasteToColonyPheno

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

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)

[Package SIMplyBee version 0.3.0 Index]