relationshipAdditive: Additive relationship matrix and its inverse

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/relationshipAdditive.R

Description

relationshipAdditive creates additive relationship matrix, while inverseAdditive creates its inverse directly from a pedigree. kinship is another definition of relationship and is equal to half of additive relationship.

Usage

1
2
3

Arguments

x

Pedigree

sort

logical, for the computation the pedigree needs to be sorted, but results are sorted back to original sorting (sort=TRUE) or not (sort=FALSE)

names

logical, should returned matrix have row/colnames; this can be used to get leaner matrix

...

arguments for other methods

Details

Additive or numerator relationship matrix is symetric and contains 1 + F_i on diagonal, where F_i is an inbreeding coefficients (see inbreeding) for subject i. Off-diagonal elements represent numerator or relationship coefficient bewteen subjects i and j as defined by Wright (1922). Henderson (1976) showed a way to setup inverse of relationship matrix directly. Mrode (2005) has a very nice introduction to these concepts.

Take care with sort=FALSE, names=FALSE. It is your own responsibility to assure proper handling in this case.

Value

A matrix of n * n dimension, where n is number of subjects in x

Author(s)

Gregor Gorjanc and Dave A. Henderson

References

Henderson, C. R. (1976) A simple method for computing the inverse of a numerator relationship matrix used in prediction of breeding values. Biometrics 32(1):69-83

Mrode, R. A. (2005) Linear models for the prediction of animal breeding values. 2nd edition. CAB International. ISBN 0-85199-000-2 http://www.amazon.com/gp/product/0851990002

Wright, S. (1922) Coefficients of inbreeding and relationship. American Naturalist 56:330-338

See Also

Pedigree, inbreeding and geneFlowT

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
  data(Mrode2.1)
  Mrode2.1$dtB <- as.Date(Mrode2.1$dtB)
  x2.1 <- Pedigree(x=Mrode2.1, subject="sub", ascendant=c("fat", "mot"),
                   ascendantSex=c("M", "F"), family="fam", sex="sex",
                   generation="gen", dtBirth="dtB")

  (A <- relationshipAdditive(x2.1))
  fractions(A)
  solve(A)
  inverseAdditive(x2.1)
  relationshipAdditive(x2.1[3:6, ])

  ## Compare the speed
  ped <- generatePedigree(nId=10, nGeneration=3, nFather=1, nMother=2)
  system.time(solve(relationshipAdditive(ped)))
  system.time(inverseAdditive(ped))

Example output

Loading required package: MASS

Attaching package: 'GeneticsPed'

The following object is masked from 'package:stats':

    family

     S1    S2     S3     S4     S5     S6
S1 1.00 0.000 0.5000 0.5000 0.5000 0.2500
S2 0.00 1.000 0.5000 0.0000 0.2500 0.6250
S3 0.50 0.500 1.0000 0.2500 0.6250 0.5625
S4 0.50 0.000 0.2500 1.0000 0.6250 0.3125
S5 0.50 0.250 0.6250 0.6250 1.1250 0.6875
S6 0.25 0.625 0.5625 0.3125 0.6875 1.1250
   S1    S2    S3    S4    S5    S6   
S1     1     0   1/2   1/2   1/2   1/4
S2     0     1   1/2     0   1/4   5/8
S3   1/2   1/2     1   1/4   5/8  9/16
S4   1/2     0   1/4     1   5/8  5/16
S5   1/2   1/4   5/8   5/8   9/8 11/16
S6   1/4   5/8  9/16  5/16 11/16   9/8
           S1         S2   S3         S4         S5        S6
S1  1.8333333  0.5000000 -1.0 -0.6666667  0.0000000  0.000000
S2  0.5000000  2.0333333 -1.0  0.0000000  0.5333333 -1.066667
S3 -1.0000000 -1.0000000  2.5  0.5000000 -1.0000000  0.000000
S4 -0.6666667  0.0000000  0.5  1.8333333 -1.0000000  0.000000
S5  0.0000000  0.5333333 -1.0 -1.0000000  2.5333333 -1.066667
S6  0.0000000 -1.0666667  0.0  0.0000000 -1.0666667  2.133333
           S1         S2   S3         S4         S5        S6
S1  1.8333333  0.5000000 -1.0 -0.6666667  0.0000000  0.000000
S2  0.5000000  2.0333333 -1.0  0.0000000  0.5333333 -1.066667
S3 -1.0000000 -1.0000000  2.5  0.5000000 -1.0000000  0.000000
S4 -0.6666667  0.0000000  0.5  1.8333333 -1.0000000  0.000000
S5  0.0000000  0.5333333 -1.0 -1.0000000  2.5333333 -1.066667
S6  0.0000000 -1.0666667  0.0  0.0000000 -1.0666667  2.133333
       S3     S4     S5     S6
S3 1.0000 0.2500 0.6250 0.5625
S4 0.2500 1.0000 0.6250 0.3125
S5 0.6250 0.6250 1.1250 0.6875
S6 0.5625 0.3125 0.6875 1.1250
   user  system elapsed 
  0.001   0.000   0.001 
   user  system elapsed 
  0.016   0.000   0.017 

GeneticsPed documentation built on Nov. 8, 2020, 5:54 p.m.