Go back to WAMWIKI!

Here we show how to simulate simple data for quantitative genetic analysis. Computer simulations can be very useful to test the properties of statistical analysis prior to applying them to real data, or for theoretical resarch.

One can also re-use simulated data, such as the gryphon data contained in the package pedantics (which we will also use for phenotypic simulations later on).

library(pedantics)
data(gryphons)

head(gryphons)
##    id dam sire sex cohort fatherErrorProb fatherSampledProb
## 1 204  NA   NA   1   1147               1               0.5
## 2 205  NA   NA   1   1147               1               0.5
## 3 206  NA   NA   0   1147               1               0.5
## 4 207  NA   NA   0   1147               1               0.5
## 5 208  NA   NA   1   1147               1               0.5
## 6 209  NA   NA   1   1147               1               0.5
##   firstReproCohort lastReproCohort
## 1             1148            1156
## 2             1148            1159
## 3             1148            1157
## 4             1148            1157
## 5             1148            1156
## 6             1148            1156

The first three columns contain the pedigree itself: id is the focal individual identifier, dam is the mother, sire is the the father.

Below we extract these three columns, make sure the rows are ordered in a consistent way with the function fixPedigree, and draw the pedigree (each line represents a parent-offspring link, starting with the founder individuals at the top of the graph).

pedigree<-fixPedigree(gryphons[,1:3])
drawPedigree(Ped = pedigree)