Description Usage Arguments Value References See Also Examples
Construct an object of class "pedigree"
, more
conveniently than by new("pedigree", ....)
.
1 | pedigree(sire, dam, label)
|
sire |
numeric vector (with some |
dam |
similarly as |
label |
a vector coercable to |
an object of formal class "pedigree"
.
2010. A.I. Vazquez, D.M. Bates, G.J.M. Rosa, D. Gianola and K.A. Weigel. Technical Note: An R package for fitting generalized linear mixed models in animal breeding. Journal of Animal Science, 88:497-504.
the pedigree
class.
1 2 3 4 5 6 7 |
Loading required package: lme4
Loading required package: Matrix
pdgr-c> ## Rather use, pedigree()! The following is "raw code":
pdgr-c> ## Example from chapter 2 of Mrode (2005)
pdgr-c> p1 <- new("pedigree",
pdgr-c+ sire = as.integer(c(NA,NA,1, 1,4,5)),
pdgr-c+ dam = as.integer(c(NA,NA,2,NA,3,2)),
pdgr-c+ label = as.character(1:6))
pdgr-c> p1
sire dam
1 <NA> <NA>
2 <NA> <NA>
3 1 2
4 1 <NA>
5 4 3
6 5 2
pdgr-c> (dtc <- as(p1, "sparseMatrix")) # T-inverse in Mrode's notation
6 x 6 sparse Matrix of class "dtCMatrix" (unitriangular)
1 I . . . . .
2 . I . . . .
3 -0.5 -0.5 I . . .
4 -0.5 . . I . .
5 . . -0.5 -0.5 I .
6 . -0.5 . . -0.5 I
pdgr-c> solve(dtc)
6 x 6 sparse Matrix of class "dtCMatrix"
[1,] 1.00 . . . . .
[2,] . 1.000 . . . .
[3,] 0.50 0.500 1.00 . . .
[4,] 0.50 . . 1.00 . .
[5,] 0.50 0.250 0.50 0.50 1.0 .
[6,] 0.25 0.625 0.25 0.25 0.5 1
pdgr-c> inbreeding(p1)
[1] 0.000 0.000 0.000 0.000 0.125 0.125
sire dam
1 <NA> <NA>
2 <NA> <NA>
3 1 2
4 1 <NA>
5 4 3
6 5 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.