Skip to contents

$$A_{jk} = N^{-1} \sum_i (x_{ij}-2p_i)(x_{ik}-2p_i)/(2p_i(1-p_i))$$ Each locus is standardized by its own Hardy-Weinberg variance. The original paper gives the diagonal as \(1 + N^{-1}\sum_i [x_{ij}^2 - (1+2p_i)x_{ij} + 2p_i^2]/(2p_i(1-p_i))\); GCTA later made the diagonal match the off-diagonal, which is the default here.

Usage

Yangr(marker_matrix, freq = NULL, yang_diagonal = FALSE)

Arguments

marker_matrix

Lines by markers, coded 0, 1, 2.

freq

Optional allele frequencies.

yang_diagonal

Use the Yang et al. (2010) diagonal.

Value

Named list with estimate, A, freq, n_lines, n_markers, yang_diagonal, method.

References

Yang et al. (2010) Nat Genet 42:565-569; GCTA.

Examples

Yangr(matrix(c(1, 0, 0, 1, 2, 1), nrow = 2))
#> $estimate
#> [1] 0.6666667
#> 
#> $A
#>            [,1]       [,2]
#> [1,]  0.6666667 -0.6666667
#> [2,] -0.6666667  0.6666667
#> 
#> $freq
#> [1] 0.25 0.25 0.75
#> 
#> $n_lines
#> [1] 2
#> 
#> $n_markers
#> [1] 3
#> 
#> $yang_diagonal
#> [1] FALSE
#> 
#> $method
#> [1] "Yang et al. (2010) realized relationship matrix"
#>