splitPUnif {SIMplyBee}R Documentation

Sample the split proportion - proportion of removed workers in a managed split

Description

Sample the split proportion - proportion of removed workers in a managed split - used when p = NULL - (see SimParamBee$splitP).

This is just an example. You can provide your own functions that satisfy your needs!

Usage

splitPUnif(colony, n = 1, min = 0.2, max = 0.4)

splitPColonyStrength(colony, n = 1, nWorkersFull = 100, scale = 1)

Arguments

colony

Colony-class

n

integer, number of samples

min

numeric, lower limit for splitPUnif

max

numeric, upper limit for splitPUnif

nWorkersFull

numeric, average number of workers in a full/strong colony for splitPColonyStrength (actual number can go beyond this value)

scale

numeric, scaling of numbers in splitPColonyStrength to avoid to narrow range when colonies have a large number of bees (in that case change nWorkersFull too!)

Details

splitPUnif samples from a uniform distribution between values 0.2 and 0.4 irrespective of colony strength.

splitPColonyStrength samples from a beta distribution with mean a / (a + b), where a = nWorkers + nWorkersFull and b = nWorkers. This beta sampling mimics larger splits for strong colonies and smaller splits for weak colonies - see examples. This is just an example - adapt to your needs!

The nWorkersFull default value used in this function is geared towards a situation where we simulate ~100 workers per colony (down-scaled simulation for efficiency). If you simulate more workers, you should change the default accordingly.

Value

numeric, split proportion

Functions

See Also

SimParamBee field splitP

Examples

splitPUnif()
splitPUnif()
p <- splitPUnif(n = 1000)
hist(p, breaks = seq(from = 0, to = 1, by = 0.01), xlim = c(0, 1))

# Example for splitPColonyStrength()
founderGenomes <- quickHaplo(nInd = 2, nChr = 1, segSites = 100)
SP <- SimParamBee$new(founderGenomes)
basePop <- createVirginQueens(founderGenomes)
drones <- createDrones(x = basePop[1], nInd = 15)
colony <- createColony(x = basePop[2])
colony <- cross(colony, drones = drones)
colony <- addWorkers(colony, nInd = 10)
nWorkers(colony) # weak colony
splitPColonyStrength(colony)
splitPColonyStrength(colony)
colony <- addWorkers(colony, nInd = 100)
nWorkers(colony) # strong colony
splitPColonyStrength(colony)
splitPColonyStrength(colony)

# Logic behind splitPColonyStrength()
nWorkersFull <- 100
nWorkers <- 0:200
splitP <- 1 - rbeta(
  n = length(nWorkers),
  shape1 = nWorkers + nWorkersFull,
  shape2 = nWorkers
)
plot(splitP ~ nWorkers, ylim = c(0, 1))
abline(v = nWorkersFull)
pKeep <- 1 - splitP
plot(pKeep ~ nWorkers, ylim = c(0, 1))
abline(v = nWorkersFull)

[Package SIMplyBee version 0.3.0 Index]