View source: R/pvalues_calculation.R
pval_ss_cal | R Documentation |
It featuring for options of adjusting for the stratification-score indicators followed with cmh test, for observation and permutation. If no stratification, this code did simple fisher exact test instead.
pval_ss_cal(dis_ob, g, strata = NA, nperm = 0, alter = "greater", exact = TRUE)
dis_ob |
0-1 vector shows the subjects has disease (1) or not (0) |
g |
matrix with each row demonstrate the genes and each colum demonstrates the subjects. ncol(g)=length(dis_ob) |
strata |
the output of function strat_score_cal, which are the n rows, k-1 colums matrix for samples stratification information. If ignored, only fisher exact test are applied. |
nperm |
the number of permutation we should perform. If nperm=0 (default), that means only calculate the observed/input situation. Otherwise, only calculated the permutated situation. |
alter |
only works if cmh_option is TRUE. The test for p-values calculation. options=c("greater","less","two.sided"): "greater"(default):apply one-side cmh test if mutation are enriched in cases."less":apply one-side cmh test if mutation are enriched in controls. "two.sided": apply two-side cmh test. |
exact |
only works if cmh_option is TRUE. A logical indicating whether the Mantel-Haenszel test(FALSE) or the exact conditional test(TRUE, default) is applied. |
a numeric vector of p-values
Epstein MP, Allen AS, Satten GA (2007) A simple and improved correction for population stratification in case-control studies. American Journal of Human Genetics 80: 921-930
mantelhaen.test
which this function wraps
cmh_cal
which this function wraps
pheno=rbinom(100,1,0.5) cur_pc=rbind(matrix(rnorm(500,0,1),ncol=10,nrow=50),matrix(rnorm(500,0.5,1),ncol=10,nrow=50)) strata=strat_score_cal_glm(pheno,cur_pc) geno=matrix(rbinom(2000,1,0.1),nrow=20,ncol=100) pval=pval_ss_cal(pheno,geno,strata,nperm=0, alter="greater",exact_option=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.