Simple functions we seem to use all the time
Jump to navigation
Jump to search
Genomic control is a standard correction in genome-wide association studies for population stratification. It was first described (afaik) by Bernie Devlin and Kathryn Roeder in Biometrics. The correction is pretty simple, it basically takes the chi square of the median pvalue (which we expect to be .5 under the assumption of no stratification) and divides it by a chi square of .5. This is easy to do in R:
gc.value<-function(pvals) {
qchisq(median(pvals,na.rm=T),df=1,lower.tail=F)/qchisq(.5,df=1,lower.tail=F);
}
You can then correct all pvalues by this genomic control:
gc.correct<-function(pvals, gcv=gc.value(pvals)) {
pchisq(qchisq(pvals,df=1,lower.tail=F)/gcv,df=1,lower.tail=F);
}