Given a pedigree, the matrix of additive by dominance (AD) genetic relatedness, dominance by dominance (DD) genetic relatedness, or both are returned.

1 | ```
makeDomEpi(pedigree, output = c("AD", "DD", "both"), Dinverse=FALSE)
``` |

`pedigree ` |
A pedigree where the columns are ordered ID, Dam, Sire |

`output ` |
Character(s) denoting which matrix and its inverse is to be constructed. |

`Dinverse ` |
A logical indicating whether or not to invert the D matrix |

Missing parents (e.g., base population) should be denoted by either 'NA' or '0'.

Because of the computational demands of constructing the D matrix (see `makeD`

), this function allows for the inverses that are derived from the D matrix (i.e., D-inverse, AD-inverse, and DD-inverse)to be constructed at the same time. This way, the D matrix will only have to be constructed once for use in the three seperate genetic relatedness inverse matrices that depend upon it. However, using the `output`

and `Dinverse`

options in different combinations will ensure that only the desired matrix inverses are constructed.

Both the AD and DD matrix are computed from the Hadamard product of the respective matrices (see also, `makeAA`

).

All of the following will be returned. However, the values of the `output`

and `Dinverse`

options passed to the function will determine which of the following are not NULL objects within the list:

`D ` |
the D matrix in sparse matrix form |

`logDetD ` |
the log determinant of the D matrix |

`AD ` |
the AD matrix in sparse matrix form |

`logDetAD ` |
the log determinant of the AD matrix |

`DD ` |
the DD matrix in sparse matrix form |

`logDetDD ` |
the log determinant of the DD matrix |

`Dinv ` |
the inverse of the D matrix in sparse matrix form |

`ADinv ` |
the inverse of the AD matrix in sparse matrix form |

`DDinv ` |
the inverse of the DD matrix in sparse matrix form |

`listDinv ` |
the three column form of the non-zero elements for the inverse of the D matrix |

`listADinv ` |
the three column form of the non-zero elements for the inverse of the AD matrix |

`listDDinv ` |
the three column form of the non-zero elements for the inverse of the DD matrix |

1 2 3 4 5 | ```
Boutput <- makeDomEpi(Mrode9, output = "b", Dinverse = FALSE)
str(Boutput)
DADoutput <- makeDomEpi(Mrode9, output = "AD", Dinverse = TRUE)
str(DADoutput)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.