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)
data("admixed")

# supply p.fac to the penalty.factor argument
res <- ggmix(x = admixed$x, y = admixed$y, kinship = admixed$kin)
plot(res)

coef(res, s = 0.059, type = "nonzero")
#>                       1
#> (Intercept) -0.27688132
#> X336        -0.67055838
#> X7638        0.41900927
#> X1536        0.93185713
#> X1943        0.55207729
#> X2849       -0.56913485
#> X56         -0.06840743
#> X4106       -0.35323444
#> eta          0.27072729
#> sigma2       0.99695746

The U and D arguments

Alternatively we can directly supply the eigenvectors and eigenvalues of the kinship matrix:

eigKinship <- eigen(admixed$kin)

resUD <- ggmix(x = admixed$x, y = admixed$y, U = eigKinship$vectors,
               D = eigKinship$values)
plot(resUD)

coef(resUD, s = 0.059, type = "nonzero")
#>                       1
#> (Intercept) -0.27688132
#> X336        -0.67055838
#> X7638        0.41900927
#> X1536        0.93185713
#> X1943        0.55207729
#> X2849       -0.56913485
#> X56         -0.06840743
#> X4106       -0.35323444
#> eta          0.27072729
#> sigma2       0.99695746

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$x, y = admixed$y, U = svdXkinship$u,
                  D = svdXkinship$d ^ 2)
plot(resUDsvd)

coef(resUDsvd, s = 0.059, type = "nonzero")
#>                         1
#> (Intercept) -0.2307411492
#> X1373       -0.0004698756
#> X3164       -0.0183808061
#> X5779        0.0019388390
#> X336        -0.6479732431
#> X7638        0.4146906763
#> X1536        0.9199240839
#> X1943        0.5805857984
#> X2849       -0.5556844168
#> X56         -0.0358186272
#> X4106       -0.3361341709
#> eta          0.2363329091
#> sigma2       0.0014041989

The results differ from the one using the kinship matrix above because this simulated data comes from an admixed population, and therefore, using a matrix of SNPs in this case may not be appropriate. The kinship matrix in the admixed data was calculated using the popkin function from the popkin package.

The K argument

We can directly supply the matrix of SNPs used to calculated the kinship matrix also to the K argument:

resK <- ggmix(x = admixed$x, y = admixed$y, K = admixed$Xkinship)
plot(resK)

coef(resK, s = 0.059, type = "nonzero")
#>                         1
#> (Intercept) -0.2307411492
#> X1373       -0.0004698756
#> X3164       -0.0183808061
#> X5779        0.0019388390
#> X336        -0.6479732431
#> X7638        0.4146906763
#> X1536        0.9199240839
#> X1943        0.5805857984
#> X2849       -0.5556844168
#> X56         -0.0358186272
#> X4106       -0.3361341709
#> eta          0.2363329091
#> sigma2       0.0014041989