## Without genetic groups ##
makeAinv(Mrode2)
## With genetic groups ##
## Type A
typeAped <- Q1988[-c(3:7), c("id", "damGG", "sireGG")]
AstarA <- makeAinv(typeAped, ggroups = 2, gOnTop = FALSE)$Ainv
## Type D
typeDped <- Q1988[-c(1:7), c("id", "damGG", "sireGG")]
AstarD <- makeAinv(typeDped, ggroups = c("g1", "g2"), gOnTop = FALSE)$Ainv
stopifnot(identical(AstarA, AstarD))
# Show that the augmented A-inverse with genetic groups
# contains the normal A-inverse (i.e., without genetic groups)
## Augmented A-inverse with genetic groups
ggAinv <- makeAinv(Mrode3[-c(1,2), c("calf", "damGG", "sireGG")],
ggroups = c("g1", "g2"), gOnTop = FALSE)$Ainv
noggAinv <- makeAinv(Mrode3[-c(1,2), c("calf", "dam", "sire")],
ggroups = NULL)$Ainv
# First 8 rows & columns of ggAinv are same as the A-inverse without genetic groups
ggAinv[1:8, 1:8]
noggAinv
stopifnot(identical(ggAinv[1:8, 1:8], noggAinv))Run the code above in your browser using DataLab