Skip to content
Josh Fogg edited this page Jul 31, 2024 · 4 revisions
makeA(pedigree)

Constructs Wright's Numerator Relationship Matrix (WNRM) from a given pedigree structure. This is a symmetric positive-definite matrix which represents the relationships between candidates in the cohort.

Parameters

  • pedigree : dict
    Pedigree structure in an {int: [int, int]} dictionary format, such as that returned from load_ped.

Returns

  • ndarray
    A dense NumPy array which is equal to Wright's Numerator Relationship Matrix.

Examples

Consider an example cohort with four candidates, which when loaded into Python produces the following dictionary representing the pedigree structure

>>> pedigree = robustocs.load_ped("example.ped")
>>> pedigree
{1: [0, 0], 2: [1, 0], 3: [1, 2], 4: [1, 3]}

We can then use this in makeA to form the WNRM ($A$) as

>>> robustocs.makeA(pedigree)
array([[1.   , 0.5  , 0.75 , 0.875],
       [0.5  , 1.   , 0.75 , 0.625],
       [0.75 , 0.75 , 1.25 , 1.   ],
       [0.875, 0.625, 1.   , 1.375]])

It does this by applying an algorithm, set out in papers such as Henderson [1]. For the $t^\text{th}$ candidate with parent indices $p$ and $q$,

  1. If both parents are known, i.e. $p > 0$ and $q > 0$,
    1. $a_{ij} = a_{ji} = \frac{1}{2}(a_{jp}, + a_{jq})$ for $j = 1, 2, \ldots, i-1$,
    2. $a_{ii} = 1 + \frac{1}{2}a_{pq}$.
  2. If only one parent is known, i.e. $p > 0$ and $q = 0$,
    1. $a_{ij} = a_{ji} = \frac{1}{2}a_{jp}$ for $j = 1, \ldots, i-1$,
    2. $a_{ii} = 1$.
  3. If neither parent is known, i.e. $p = 0$ and $q = 0$,
    1. $a_{ij} = a_{ji} = 0$ for $j = 1, \ldots, i-1$,
    2. $a_{ii} = 1$.

We can apply this to the above example, populating the matrix $A$ from the top left entry outwards. Since candidate 1 has unknown parentage, $(p, q) = (0, 0)$, we simply have $a_{11} = 1$. Candidate 2 has half-known parentage, $(p, q) = (1, 0)$. Thus we have

$$ \begin{align} a_{21} &= a_{12} = \frac{1}{2}a_{11} = \frac{1}{2} = 0.5, \\ a_{22} &= 1. \end{align} $$

Candidate 3 has known parentage, $(p, q) = (1, 2)$. Thus we have

$$ \begin{align} a_{31} &= a_{13} = \frac{1}{2}(a_{11} + a_{12}) = \frac{1}{2}\left(1 + \frac{1}{2}\right) = \frac{3}{4} = 0.75, \\ a_{32} &= a_{23} = \frac{1}{2}(a_{21} + a_{22}) = \frac{1}{2}\left(\frac{1}{2} + 1\right) = \frac{3}{4} = 0.75, \\ a_{33} &= 1 + \frac{1}{2}a_{12} = 1 + \frac{1}{2}\cdot\frac{1}{2} = \frac{5}{4} = 1.25. \end{align} $$

Candidate 4 also has known parentage, $(p, q) = (1, 3)$. Thus we have

$$ \begin{align} a_{41} &= a_{14} = \frac{1}{2}(a_{11} + a_{13}) = \frac{1}{2}\left(1 + \frac{3}{4}\right) = \frac{7}{8} = 0.875, \\ a_{42} &= a_{24} = \frac{1}{2}(a_{21} + a_{23}) = \frac{1}{2}\left(\frac{1}{2} + \frac{3}{4}\right) = \frac{5}{8} = 0.625, \\ a_{42} &= a_{34} = \frac{1}{2}(a_{31} + a_{33}) = \frac{1}{2}\left(\frac{3}{2} + \frac{5}{4}\right) = 1, \\ a_{44} &= 1 + \frac{1}{2}a_{13} = 1 + \frac{1}{2}\cdot\frac{3}{4} = \frac{11}{8} = 1.375. \end{align} $$

Thus our final matrix is

$$A = \begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ a_{21} & a_{22} & a_{23} & a_{24} \\ a_{31} & a_{32} & a_{33} & a_{34} \\ a_{41} & a_{42} & a_{43} & a_{44} \end{bmatrix} = \begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ a_{12} & a_{22} & a_{23} & a_{24} \\ a_{13} & a_{23} & a_{33} & a_{34} \\ a_{14} & a_{24} & a_{34} & a_{44} \end{bmatrix} = \begin{bmatrix} 1.000 & 0.500 & 0.750 & 0.875 \\ 0.500 & 1.000 & 0.750 & 0.625 \\ 0.750 & 0.750 & 1.250 & 1.000 \\ 0.875 & 0.625 & 1.000 & 1.375 \end{bmatrix}.$$

We see that this is the same as what makeA formed. This matrix $A$ can then be used as $\Sigma$ in optimal contribution selection problems.

References

  • [1] Henderson (1976), A Simple Method for Computing the Inverse of a Numerator Relationship Matrix Used in Prediction of Breeding Values, Biometrics 32:1, pg. 69-83.