This function computes eigenvectors and eigenvalues of the covariance matrix, which are needed for running map_qtl and map_qtl_for_each when modeling a random effect. kinship must be set to the default if a subject-specific random effect will be modeled. kinship must be specified if a polygenic (kinship) random effect will be modeled. This is the same as the get_tu_lambda function from the classifygxt package.

get_eigen(anno, kinship = NULL)

Arguments

anno

A data frame containing sample IDs (character strings or integers), subject IDs (character strings or integers), and treatment conditions (0 or 1). The columns must be named as "sample", "subject", and "condition".

kinship

A matrix containing pairwise genetic relatedness between subjects. The row and column names must match the set of unique elements of the "subject" column in "anno" in the corresponding order (i.e., unique(anno$subject)). This is set to NULL by default, in which case the identity matrix is used.

Value

A list object containing:

  • tU - A matrix containing the transposed eigenvectors of the covariance matrix.

  • lambda - A vector containing the eigenvalues of the covariance matrix.

Examples

anno <- data.frame(
    sample = paste0("s", 1:20),
    subject = rep(paste0("d", 1:10), each = 2),
    condition = rep(c(0, 1), 10)
)
eig <- get_eigen(anno = anno)