When analyzing large amounts of genetic and genomic data, the first line of analysis is usually some sort of univariate test. That is, conduct a statistical test for each SNP or CpG site or Gene and then correct for multiple testing. The limma package on Bioconductor is a popular method for computing moderated t-statistics using a combination of the limma::lmFit and limma::eBayes functions. In this post, I show how to calculate the ordinary t-statistics from limma output.

First we load the required packages

Next, we extract some sample data and create a covariate of interest

Then we calculate the moderated and ordinary t-statistics and compare them:

We can calculate the corresponding p-values from the ordinary t-statistics. This is given by

We can also use the CpGassoc package to calculate ordinary t-statistics and compare the result to our manual calculations: