Learn R Programming

gaston (version 1.2)

association.test: Association Test

Description

Association tests between phenotype and SNPs.

Usage

association.test(x, Y = x@ped$pheno, X = matrix(1, nrow(x)), 
    eigenK, beg = 1, end = ncol(x), p = 0, test = c("wald", "lrt"),
    tol = .Machine$double.eps^0.25, multithreaded = FALSE)

Arguments

Value

A named list of vectors, giving for each considered SNP:h2Estimated value of $\tau \over {\tau + \sigma^2}$beta(only whith test = "wald") Estimated value of $\beta$sd(only whith test = "wald") Estimated standard deviation of the $\beta$ estimationLRT(only whith test = "lrt") Value of the Likelihood Ratio TestpThe corresponding p-value

Details

Tests the association between the phenotype and requested SNPs in x. For each SNP, the following model in considered $$Y = (X|PC)\alpha + G\beta + \omega + \varepsilon$$ with $\omega \sim N(0,\tau K)$ and $\varepsilon \sim N(0,\sigma^2 I_n)$. $G$ is the genotype vector of the SNP, $K$ is the Genetic Relationship Matrix (GRM) computed on the whole genome (specified via the parameter eigenK), $X$ the covariable matrix, and $PC$ the matrix of the first $p$ principal components. All parameters are estimated with the same procedure as in lmm.diago.

Note: in the present implementation, using several threads is likely to be slower than using only one, hence the multithreaded parameter. This might change in the near future.

See Also

lmm.diago, optimize

Examples

Run this code
# Load data
data(AGT)
x <- as.bed.matrix(AGT.gen, AGT.fam, AGT.bim)
x <- set.stats(x)
standardize(x) <- 'mu'

# generate a random positive matrix (to play the role of the GRM)
set.seed(1)
R <- random.pm(nrow(x))

# simulate phenotype with effect of SNP #351 and a polygenic component 
y <- x %*% c(rep(0,350),0.25,rep(0,ncol(x)-351)) + lmm.simu(0.3,1,eigenK=R$eigen)$y

# association test
t <- association.test(x, y, eigenK = R$eigen)

# (mini) Manhattan plot
plot(-log10(t$p), xlab="SNP index", ylab = "-log(p)")

# link between p-values and LD with SNP #351
lds <- LD(x, 351, c(1,ncol(x)))
plot(lds, -log10(t$p), xlab="r^2", ylab="-log(p)")

Run the code above in your browser using DataLab