Skip to contents

L(Q,P) = sum_ij [ g_ij log(sum_k q_ik p_kj) + (2-g_ij) log(sum_k q_ik (1-p_kj)) ], maximised by the EM updates on allele responsibilities a_ijk and b_ijk.

Usage

Admixq(G, K = 2, steps = 50, Q0 = NULL, P0 = NULL)

Arguments

G

Genotype counts in {0,1,2}, I x J.

K

Number of ancestral populations.

steps

Fixed EM iteration count.

Q0, P0

Starting values; NULL uses the deterministic defaults q_ik proportional to 1 + ((i+k) mod K) and p_kj = (2 + ((k J + j) mod 7))/10 with zero-based i, j, k.

Value

List with Q, P, loglik, loglik0, I, J, K, steps.

References

Alexander, Novembre and Lange (2009), Genome Research 19(9), 1655-1664, Equation (2), read from the open-access PMC rendering. ADMIXTURE maximises that likelihood by block relaxation; this routine uses the EM algorithm for the same likelihood (FRAPPE, Tang et al. 2005).

Examples

set.seed(1)
G <- matrix(rbinom(50, 2, 0.3), 10, 5)
Admixq(G, K = 2, steps = 20)
#> $Q
#>              [,1]         [,2]
#>  [1,] 0.999874162 0.0001258377
#>  [2,] 0.990713533 0.0092864670
#>  [3,] 0.550311695 0.4496883055
#>  [4,] 0.656629519 0.3433704811
#>  [5,] 0.635646121 0.3643538794
#>  [6,] 0.414182770 0.5858172303
#>  [7,] 0.004524483 0.9954755171
#>  [8,] 0.027104259 0.9728957410
#>  [9,] 0.735820470 0.2641795297
#> [10,] 0.661371454 0.3386285456
#> 
#> $P
#>              [,1]         [,2]         [,3]      [,4]        [,5]
#> [1,] 9.218317e-05 0.0005426019 3.641853e-01 0.2763645 0.655205606
#> [2,] 7.982509e-01 0.7851736118 2.677899e-05 0.3309573 0.008025661
#> 
#> $loglik
#> [1] -51.60308
#> 
#> $loglik0
#> [1] -66.58831
#> 
#> $I
#> [1] 10
#> 
#> $J
#> [1] 5
#> 
#> $K
#> [1] 2
#> 
#> $steps
#> [1] 20
#> 
#> $method
#> [1] "EM for the ADMIXTURE likelihood (Alexander et al. 2009 eq. 2)"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"