get_eigentraits: Calculate eigentraits

View source: R/get_eigentraits.R

get_eigentraitsR Documentation

Calculate eigentraits

Description

This function uses singular value decomposition (SVD) to calculate eigentraits from the phenotype matrix in the cape data object. It adds the eigentrait matrix to the data object along with the singular values and the right singular vectors.

Usage

get_eigentraits(data_obj, scale_pheno = TRUE, normalize_pheno = TRUE)

Arguments

data_obj

a Cape object

scale_pheno

A logical value indicating whether to mean-center and standardize the traits.

normalize_pheno

A logical value indicating whether to rankZ normalize the phenotypes.

Details

If scale_pheno is TRUE, the phenotypes are mean-centered and standardized before running the svd.

Because we use SVD in this step, there can be no missing values in the phenotype matrix. Any individuals with missing values are removed with a message.

Value

Returns the data object with the eigentraits, singular values, and right singular vectors added.


cape documentation built on May 29, 2024, 5:11 a.m.