knitr::opts_chunk$set(echo = TRUE)
This vegnette provides an introduction to the 'CKLRT' package. To load the package, users need to install package from CRAN and CKLRT from github. The package can be loaded with the following command:
#install.packages("devtools") library(devtools) #install_github("andrewhaoyu/CKLRT") library(CKLRT)
In this vegnette, we will decomstrate the methods with a simple example. 1. X present other covariates we want to adjust. 2. E represents the environment variable. 3. G is is the genotype matrix with two SNPs inside 4. y is the simulated outcomes.
library(mgcv); library(MASS); library(nlme); library(compiler);library(Rcpp);library(RcppEigen) library(CKLRT) set.seed(6) n = 200 # the number of observations X = rnorm(n) # the other covariates p = 2 # two snp in a gene will be simulated G = runif(n*p)< 0.5 G = G + runif(n*p) < 0.5 G = matrix(G, n,p) #genetic matrix E = (runif(n) < 0.5)^2 #enviroment effect y = rnorm(n) + G[,1] * 0.3 #observations #apply the likelihood ratio test omniLRT_fast(y, X = cbind(X, E),K1 = G %*% t(G),K2 = (G*E) %*% t(G * E)) #apply the restricted likelihood ratio test omniRLRT_fast(y, X = cbind(X, E),K1 = G %*% t(G),K2 = (G*E) %*% t(G * E))
The results of the function contain three elements: 1. p.dir is the p-value of likelihood ratio test based on emprical distrition. 2. p.aud is the p-value by approximating the null distribution as a mixture of a point mass at zero with probability b and weighted chi square distribution with d degrees of freedom with probality of 1-b. 3. LR is the likelihood ratio test statistics.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.