squeezeVar {limma} | R Documentation

## Smooth Sample Variances

### Description

Smooth a set of sample variances by computing empirical Bayes posterior means.

### Usage

    squeezeVar(var, df)

### Arguments

`var` | numeric vector of independent sample variances
`df` | numeric vector of degrees of freedom for the sample variances

### Details

The sample variances `var` are assumed to follow scaled chi-squared distributions. An inverse chi-squared prior is assumed for the true variances. The scale and degrees of freedom for the prior distribution are estimated from the data.

The effect of this function is to smooth or shrink the variances towards a common value. The smoothed variances have a smaller expected mean square error to the true variances than do the sample variances themselves.

This function is called by `eBayes`, but beware a possible confusion with the output from that function. The values `var.prior` and var.post output by `squeezeVar` correspond to the quantities `s2.prior` and `s2.post` output by `eBayes`, whereas `var.prior` output by `eBayes` relates to a different parameter.

### Value

A list with components

`var.post` | numeric vector of posterior variances
`var.prior` | location of prior distribution
`df.prior` | degrees of freedom of prior distribution

### Author(s)

Gordon Smyth

### References

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.bepress.com/sagmb/vol3/iss1/art3

### Examples

    s2 <- rchisq(20,df=5)/5
    squeezeVar(s2, df=5)

[Package limma version 2.18.3 Index]