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

## Description

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

## Usage

 `1` ```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

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26``` ```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) ```

### Example output

```Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl.init' failed, running with 'rgl.useNULL = TRUE'.
Pedigree loops were detected. We recommend to correct them manually before
using prePed(). The parents of the following individuals are set to unknown
to remove the loops.
Sire             Dam
276000802875148 276000803622423 276000890878480
276000811476506 276000810087663 276000811476506

The sex of the following animals was not compatible with the pedigree, so
it was modified:
Sire             Dam
276000810087663 276000802940621 276000802925028

The population is evaluated at time 2008

Mean values of the parameters are:   Value
for trait   'BV' in Hinterwaelder:   0.7062
for kinship 'fA' in Hinterwaelder:   0.0164

Available objective functions and constraints:
for trait   'BV' in Hinterwaelder: min.BV, max.BV, lb.BV, eq.BV, ub.BV
for kinship 'fA' in Hinterwaelder: min.fA, ub.fA

ub  lb uniform

Using solver 'cccp2' with parameters:
Value
trace        0
abstol   1e-05
feastol  1e-05
maxiters   100
reltol   1e-06
beta       0.5

valid solver  status
TRUE  cccp2 optimal

Variable                         Value      Bound    OK?
---------------------------------------------------------
BV                 Hinterwaelder 0.8336 max        :
---------------------------------------------------------
lower bounds                     all x  >=  lb     : TRUE
upper bounds                     all x  <=  ub     : TRUE
breed contribution Hinterwaelder 1      ==  1      : TRUE
sex contrib. diff. Hinterwaelder 0      ==  0      : TRUE
BV                 Hinterwaelder 0.8336            :
fA                 Hinterwaelder 0.0175 <=  0.0175 : TRUE
---------------------------------------------------------

[1] 250
[1] 250
[1]  0.27 -0.73  0.27 -0.73 -0.73  0.00  0.27  0.27 -0.73  0.00 -0.73 -0.73
[13]  0.27 -0.73  0.00 -0.73  0.27  0.27 -0.73  0.27  0.27  0.27  0.27 -0.73
[25]  0.27 -0.73  0.27 -0.73  0.27  0.27  0.27  0.27 -0.73  0.27  0.27 -0.73
[37]  0.27  0.27  0.27  0.27  0.00  0.27  0.00  0.27  0.27  0.27  0.27  0.27
[49] -0.73  0.00  0.00  0.24  0.00  0.00  0.24  0.24  0.24  0.24  0.24  0.24
[61]  0.24  0.24  0.24 -0.76  0.24 -0.76 -0.76  0.24  0.24  0.24  0.24  0.24
[73]  0.24 -0.76  0.24 -0.76  0.24  0.24  0.24  0.24 -0.76  0.24 -0.76  0.24
[85]  0.24  0.24  0.24 -0.76 -0.76 -0.76  0.00  0.24 -0.76  0.24 -0.76 -0.76
[97]  0.24  0.24 -0.76 -0.76  0.00  0.32  0.32 -0.68  0.32  0.32  0.32 -0.68
[109]  0.00 -0.68  0.00  0.32  0.32  0.32  0.32  0.32  0.32 -0.68 -0.68  0.32
[121]  0.32  0.32  0.32 -0.68  0.32 -0.68  0.32  0.32  0.32 -0.68 -0.68 -0.68
[133]  0.32  0.32  0.32  0.32  0.00 -0.68  0.32 -0.68  0.32  0.32  0.32  0.32
[145]  0.00 -0.68  0.32  0.32 -0.68  0.32  0.00  0.49 -0.51  0.49 -0.51  0.49
[157] -0.51 -0.51  0.49 -0.51  0.49  0.49 -0.51  0.49  0.49  0.49  0.49  0.49
[169] -0.51  0.49 -0.51  0.49 -0.51  0.49 -0.51  0.49  0.00  0.00  0.49  0.49
[181]  0.49 -0.51  0.49  0.49  0.00 -0.51  0.49  0.49 -0.51  0.49  0.00  0.49
[193]  0.49  0.49 -0.51  0.49  0.00  0.00 -0.51 -0.51  0.51 -0.49 -0.49  0.00
[205] -0.49  0.51  0.51 -0.49  0.00 -0.49 -0.49  0.51 -0.49  0.51 -0.49  0.51
[217] -0.49 -0.49  0.51 -0.49  0.51  0.51 -0.49  0.51 -0.49  0.51 -0.49  0.51
[229] -0.49 -0.49  0.51 -0.49  0.51  0.00 -0.49  0.51  0.51 -0.49  0.51  0.51
[241] -0.49 -0.49 -0.49  0.51 -0.49 -0.49  0.51  0.51 -0.49  0.00 -0.44 -0.44
[253] -0.44  0.56 -0.44  0.56 -0.44  0.56 -0.44 -0.44 -0.44  0.56 -0.44 -0.44
[265]  0.56 -0.44 -0.44 -0.44 -0.44 -0.44 -0.44  0.00 -0.44  0.56 -0.44  0.00
[277] -0.44 -0.44 -0.44 -0.44  0.56 -0.44 -0.44  0.56  0.56 -0.44 -0.44 -0.44
[289] -0.44  0.56  0.56  0.00  0.56  0.00 -0.44 -0.44  0.56  0.56  0.56  0.00
[301]  0.80  0.80 -0.20 -0.20 -0.20  0.80  0.80  0.80  0.80  0.00 -0.20 -0.20
[313] -0.20  0.80 -0.20  0.80  0.80  0.80  0.00  0.80 -0.20  0.80  0.00  0.00
[325] -0.20 -0.20  0.80 -0.20 -0.20  0.80  0.80 -0.20 -0.20  0.80  0.80 -0.20
[337] -0.20 -0.20 -0.20 -0.20 -0.20  0.80 -0.20 -0.20 -0.20  0.00 -0.20 -0.20
[349]  0.80 -0.20 -0.10  0.90  0.90  0.90 -0.10 -0.10 -0.10 -0.10 -0.10  0.00
[361] -0.10 -0.10 -0.10 -0.10 -0.10 -0.10 -0.10 -0.10 -0.10 -0.10 -0.10  0.90
[373] -0.10 -0.10 -0.10 -0.10 -0.10 -0.10 -0.10 -0.10  0.90  0.00 -0.10 -0.10
[385] -0.10 -0.10 -0.10 -0.10  0.90 -0.10 -0.10 -0.10 -0.10  0.90  0.00 -0.10
[397] -0.10  0.90 -0.10  0.90  0.02  0.02  0.02  0.00  0.02 -0.98  0.02  0.02
[409]  0.02  0.02  0.02  0.02  0.02  0.02  0.02  0.02  0.02  0.02  0.02  0.02
[421]  0.02  0.02  0.02  0.02  0.02  0.02  0.02  0.02  0.02  0.02  0.02  0.02
[433] -0.98  0.00  0.02  0.02  0.02  0.02  0.00  0.02  0.02  0.02  0.02  0.02
[445]  0.00  0.02  0.02  0.00  0.02  0.02 -0.55 -0.55  0.00 -0.55 -0.55 -0.55
[457]  0.45  0.45 -0.55  0.00  0.00  0.00  0.45 -0.55  0.45  0.45 -0.55  0.45
[469]  0.45 -0.55 -0.55 -0.55  0.45  0.00 -0.55  0.00  0.00  0.45 -0.55  0.45
[481]  0.00 -0.55 -0.55  0.00  0.45 -0.55  0.00 -0.46 -0.55 -0.55 -0.55  0.45
[493]  0.45  0.45  0.19 -0.55 -0.55  0.45 -0.55 -0.55  0.00  0.03  0.22  0.03
[505]  0.00  0.00  0.00  0.03  0.03  0.00  0.03  0.03  0.03  0.00  0.00  0.03
[517]  0.03  0.03  0.00  0.03  0.03  0.03  0.03  0.03  0.00  0.03  0.03  0.03
[529]  0.03  0.03  0.03  0.03  0.00  0.03  0.03  0.03  0.00  0.03  0.03  0.03
[541]  0.03  0.00  0.03 -0.97  0.03  0.03  0.00  0.03  0.03  0.03
```

optiSel documentation built on Jan. 16, 2021, 5:30 p.m.