# noffspring: Calculates Optimum Numbers of Offspring In optiSel: Optimum Contribution Selection and Population Genetics

 noffspring R Documentation

## Calculates Optimum Numbers of Offspring

### Description

Calculates the optimum numbers of offspring from optimum contributions of selection candidates.

### Usage

``noffspring(cand, N, random=TRUE)``

### Arguments

 `cand` Data frame with optimum contributions (column `oc`), sexes (column `Sex`), and IDs (column `Indiv`) of the selection candidates. `N` Desired number of individuals in the offspring population. `random` Logical. If `2*N*oc[i]` is not an integer value (say `2*N*oc[i]=11.4`) then individual `i` will have either 11 or 12 offspring. The actual number is either determined randomly or not.

### Details

The function calculates the optimum numbers of offspring of the selection candidates from the optimum contributions `cand\$oc` and the size `N` of the offspring population.

### Value

Data frame with column `Indiv` containing the individual IDs and column `nOff` containing the optimum numbers of offspring.

Column `nOff` is approximately `2*N*cand\$oc` with `sum(noff[cand\$Sex=="male"])=N` and `sum(noff[cand\$Sex=="female"])=N`.

Robin Wellmann

### Examples

``````set.seed(1)
data(PedigWithErrors)

Pedig      <- prePed(PedigWithErrors, thisBreed="Hinterwaelder")
use        <- Pedig\$Born %in% (1998:2008) & Pedig\$Breed=="Hinterwaelder"
Population <- sampleIndiv(Pedig[use, ], each=50)
pKin       <- pedIBD(Pedig, keep.only=Population)
Phen       <- Pedig[Population, ]
Phen\$isCandidate <- Phen\$Born %in% (2003:2008)

cont       <- agecont(Pedig, Population)
cand       <- candes(phen=Phen, fA=pedIBD(Pedig, keep.only=Phen\$Indiv), cont=cont)
con        <- list(ub.fA=0.0175, uniform="female")
Offspring  <- opticont("max.BV", cand, con, trace = FALSE)

N <- 250
Candidate <- Offspring\$parent
Candidate\$nOff <- noffspring(Candidate, N)\$nOff

sum(Candidate\$nOff[Candidate\$Sex=="male"])
#[1] 250

sum(Candidate\$nOff[Candidate\$Sex=="female"])
#[1] 250

round(2*N*Candidate\$oc-Candidate\$nOff, 2)
``````

optiSel documentation built on May 31, 2023, 6:50 p.m.