This function is directly modified from the orginal num.sv() in the sva package. This function has the tolerance level in the fast.svd() function set back to its orginal default instead of 0.
num.sv2(dat, mod, method = c("be", "leek"), vfilter = NULL,
B = 20, sv.sig = 0.1, seed = NULL)
A m genes by n arrays matrix of expression data.
A n by k model matrix corresponding to the primary model fit (see model.matrix).
The method to use for estimating surrogate variables, for now there is only one option (based ib Buja and Eyuboglu 1992).
The number of most variable genes to use when building SVs, must be between 100 and m.
The number of null iterations to perform. Only used when method="be".
The significance cutoff for eigengenes. Only used when method="be".
A numeric seed for reproducible results. Optional, only used when method="be".
The number of significant surrogate variables
See http://www.bioconductor.org/packages/release/bioc/manuals/sva/man/sva.pdf
Original sva: Leek JT and Storey JD. (2008) A general framework for multiple testing dependence.Proceedings of the National Academy of Sciences, 105: 18718-18723.
Leek JT and Storey JD. (2007) Capturing heterogeneity in gene expression studies by surrogate variable analysis. PLoS Genetics, 3: e161.