ligera | R Documentation |
This function performs the genetic association tests on every locus of a genotype matrix against a quantitative trait, given a precomputed kinship matrix. The function returns a tibble containing association statistics and several intermediates. This version calculates p-values using a Wald test.
ligera( X, trait, kinship, kinship_inv = NULL, inbr = popkin::inbr(kinship), covar = NULL, loci_on_cols = FALSE, mem_factor = 0.7, mem_lim = NA, m_chunk_max = 1000, tol = 1e-15, maxIter = 1e+06 )
X |
The |
trait |
The length- |
kinship |
The |
kinship_inv |
The optional matrix inverse of the kinship matrix. Setting this parameter is not recommended, as internally a conjugate gradient method ( |
inbr |
An optional length- |
covar |
An optional |
loci_on_cols |
If |
mem_factor |
Proportion of available memory to use loading and processing genotypes.
Ignored if |
mem_lim |
Memory limit in GB, used to break up genotype data into chunks for very large datasets.
Note memory usage is somewhat underestimated and is not controlled strictly.
Default in Linux and Windows is |
m_chunk_max |
Sets the maximum number of loci to process at the time. Actual number of loci loaded may be lower if memory is limiting. |
tol |
Tolerance value passed to |
maxIter |
Maximum number of iterations passed to |
Suppose there are n
individuals and m
loci.
A tibble containing the following association statistics
pval
: The p-value of the association test
beta
: The estimated effect size coefficient for the trait vector at this locus
beta_std_dev
: The estimated coefficient variance of this locus (varies due to dependence on minor allele frequency)
p_q
: The allele variance estimate (estimate of p*(1-p)
). The number of heterozygotes, weighted by inbreeding coefficient, and with pseudocounts included, is used in this estimate (in other words, it does not equal MAF * ( 1 - MAF ), where MAF is the marginal allele frequency.
t_stat
: The test statistic, equal to beta / beta_std_dev
.
The popkin
and cPCG
packages.
# Construct toy data # genotype matrix X <- matrix( c(0, 1, 2, 1, 0, 1, 1, 0, 2), nrow = 3, byrow = TRUE ) trait <- 1 : 3 kinship <- diag( 3 ) / 2 # unstructured case tib <- ligera( X, trait, kinship ) tib
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.