There are three different ways that the ggmix function can take the population structure information:
1) kinship: A $$n \times n$$ kinship matrix
2) K: A $$n \times k$$ matrix of SNPs used to determine the relatedness between subjects
3) U: the eigenvectors of the kinship matrix or the left singular vectors of K, and D: the eigenvalues of the kinship matrix or the square of the singular values of K

We provide this flexibility to allow for a low rank estimation procedure (not yet implemented), and in case the user has already calculated this information elsewhere.

The kinship argument

We have already seen how to use the kinship argument:

library(ggmix)

# supply p.fac to the penalty.factor argument
res <- ggmix(x = admixed$xtrain, y = admixed$ytrain, kinship = admixed$kin_train) plot(res) coef(res, s = 0.059, type = "nonzero") #> 1 #> (Intercept) 0.067659655 #> X23 0.002882831 #> X168 -0.155377239 #> X266 0.013755332 #> X271 -0.037133864 #> X302 -0.191356768 #> X315 -0.038304320 #> X503 -0.276164007 #> X524 1.566660433 #> X538 -0.891195354 #> eta 0.990000000 #> sigma2 1.242738145 The U and D arguments Alternatively we can directly supply the eigenvectors and eigenvalues of the kinship matrix: eigKinship <- eigen(admixed$kin_train)

resUD <- ggmix(x = admixed$xtrain, y = admixed$ytrain,
U = eigKinship$vectors[,which(eigKinship$values>0)],
D = eigKinship$values[which(eigKinship$values>0)])
plot(resUD) coef(resUD, s = 0.059, type = "nonzero")
#>                        1
#> (Intercept)  0.047681320
#> X23          0.126542703
#> X36         -0.047001272
#> X38          0.093898444
#> X53          0.029435618
#> X74         -0.055636448
#> X114        -0.028035684
#> X139         0.060368266
#> X168        -0.128772908
#> X266         0.037493209
#> X271        -0.147801316
#> X300        -0.102856335
#> X302        -0.106338885
#> X315        -0.122440007
#> X336         0.176090696
#> X352        -0.077292020
#> X403         0.025026928
#> X431         0.027551187
#> X503        -0.508237394
#> X512        -0.005497255
#> X516         0.192053842
#> X407        -0.144545442
#> X524         1.786112263
#> X538        -1.031819918
#> X243        -0.285539321
#> eta          0.200213302
#> sigma2       0.700635042

We can also run a singular value decomposition (SVD) on the matrix of SNPs used to construct the kinship matrix. This approach is computationally less expensive since it bypasses explicit computation of the kinship matrix.

svdXkinship <- svd(admixed$Xkinship) resUDsvd <- ggmix(x = admixed$xtrain, y = admixed$ytrain, U = svdXkinship$u,
D = svdXkinship\$d ^ 2)
plot(resUDsvd)