squeezeVar(var, df, covariate=NULL, robust=FALSE, winsor.tail.p=c(0.05,0.1))
NULL
, var.prior
will depend on this numeric covariate. Otherwise, var.prior
is constant.df.prior
and var.prior
be robustified against outlier sample variances?x
to Winsorize. Used only when robust=TRUE
.covariate
is non-NULL
, otherwise a scalar.robust=TRUE
, otherwise a scalar.A conjugate Bayesian hierarchical model is assumed for a set of sample variances. The hyperparameters are estimated by fitting a scaled F-distribution to the sample variances. The function returns the posterior variances and the estimated hyperparameters.
Specifically, the sample variances var
are assumed to follow scaled chi-squared distributions, conditional on the true variances,
and an scaled inverse chi-squared prior is assumed for the true variances.
The scale and degrees of freedom of this prior distribution are estimated from the values of var
.
The effect of this function is to squeeze the variances towards a common value, or to a global trend if a covariate
is provided.
The squeezed variances have a smaller expected mean square error to the true variances than do the sample variances themselves.
If covariate
is non-null, then the scale parameter of the prior distribution is assumed to depend on the covariate.
If the covariate is average log-expression, then the effect is an intensity-dependent trend similar to that in Sartor et al (2006).
robust=TRUE
implements the robust empirical Bayes procedure of Phipson et al (2016) which allows some of the var
values to be outliers.
Sartor MA, Tomlinson CR, Wesselkamper SC, Sivaganesan S, Leikauf GD, Medvedovic M (2006). Intensity-based hierarchical Bayes method improves testing for differentially expressed genes in microarray experiments. BMC bioinformatics 7, 538.
Smyth, G. K. (2004). Linear models and empirical Bayes methods for assessing differential expression in microarray experiments. Statistical Applications in Genetics and Molecular Biology, 3, No. 1, Article 3. http://www.statsci.org/smyth/pubs/ebayes.pdf
ebayes
.This function calls fitFDist
.
An overview of linear model functions in limma is given by 06.LinearModels.
s2 <- rchisq(20,df=5)/5
squeezeVar(s2, df=5)
Run the code above in your browser using DataLab