variance_adjust: Adjust Estimated Variances

Description Usage Arguments Value Author(s) References See Also Examples

Description

Calculate rescaled variances, empirical variances, etc. For use with RUV model fits.

Usage

1
2
variance_adjust(fit, ctl.idx = NULL, ebayes = TRUE, pooled=TRUE, evar = TRUE,
                rsvar = TRUE, bin = 10, rescaleconst = NULL)

Arguments

fit

A RUV model fit (a list), as returned by RUV2 / RUV4 / RUVinv / RUVrinv

ctl.idx

An index vector to specify the negative controls for use with the rescaled variances method. If unspecified, by default fit$ctl is used.

ebayes

A logical variable. Should empirical bayes variance estimates be calculated?

pooled

A logical variable. Should pooled variance estimates be calculated?

evar

A logical variable. Should empirical variance estimates be calculated?

rsvar

A logical variable. Should rescaled variance estimates be calculated?

bin

The bin size to use when calculating empirical variances.

rescaleconst

Can be used to speed up execution. See get_empirical_variances.

Value

An RUV model fit (a list). In addition to the elements of the list returned by RUV2 / RUV4 / RUVinv / RUVrinv, the list will now contain:

sigma2.ebayes

Estimates of sigma^2 using the empirical bayes shrinkage method of Smyth (2004)

df.ebayes

Estimate of degrees of freedom using the empirical bayes shrinkage method of Smyth (2004)

sigma2.pooled

Estimate of sigma^2 pooled (averaged) over all genes

df.pooled

Degrees of freedom for pooled estimate

varbetahat

"Standard" estimate of the variance of betahat

varbetahat.rsvar

"Rescaled Variances" estimate of the variance of betahat

varbetahat.evar

"Empirical Variances" estimate of the variance of betahat

varbetahat.ebayes

"Empirical Bayes" estimate of the variance of betahat

varbetahat.rsvar.ebayes

"Rescaled Empirical Bayes" estimate of the variance of betahat

varbetahat.pooled

"Pooled" estimate of the variance of betahat

varbetahat.rsvar.pooled

"Rescaled pooled" estimate of the variance of betahat

varbetahat.evar.pooled

Similar to the above, but all genes used to determine the rescaling, not just control genes

p.rsvar

P-values, after applying the method of rescaled variances

p.evar

P-values, after applying the method of empirical variances

p.ebayes

P-values, after applying the empirical bayes method of Smyth (2004)

p.pooled

P-values, after pooling variances

p.rsvar.ebayes

P-values, after applying the empirical bayes method of Smyth (2004) and the method of rescaled variances

p.rsvar.pooled

P-values, after pooling variances and the method of rescaled variances

p.evar.pooled

Similar to the above, but all genes used to determine the rescaling, not just control genes

Fpvals.ebayes

F test p-values, after applying the empirical bayes method of Smyth (2004)

Fpvals.pooled

F test p-values, after pooling variances

p.BH

FDR-adjusted p-values

Fpvals.BH

FDR-adjusted p-values (from F test)

p.rsvar.BH

FDR-adjusted p-values (from p.rsvar)

p.evar.BH

FDR-adjusted p-values (from p.evar)

p.ebayes.BH

FDR-adjusted p-values (from p.ebayes)

p.rsvar.ebayes.BH

FDR-adjusted p-values (from p.rsvar.ebayes)

Fpvals.ebayes.BH

FDR-adjusted F test p-values (from Fpvals.ebayes)

p.pooled.BH

FDR-adjusted p-values (from p.pooled)

p.rsvar.pooled.BH

FDR-adjusted p-values (from p.rsvar.pooled)

p.evar.pooled.BH

FDR-adjusted p-values (from p.evar.pooled)

Fpvals.pooled.BH

FDR-adjusted F test p-values (from Fpvals.pooled)

Author(s)

Johann Gagnon-Bartsch

References

Using control genes to correct for unwanted variation in microarray data. Gagnon-Bartsch and Speed, 2012. Available at: http://biostatistics.oxfordjournals.org/content/13/3/539.full.

Removing Unwanted Variation from High Dimensional Data with Negative Controls. Gagnon-Bartsch, Jacob, and Speed, 2013. Available at: http://statistics.berkeley.edu/tech-reports/820.

Linear models and empirical bayes methods for assessing differential expression in microarray experiments. Smyth, 2004.

See Also

RUV2, RUV4, RUVinv, RUVrinv, get_empirical_variances, sigmashrink

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Create some simulated data
m = 50
n = 10000
nc = 1000
p = 1
k = 20
ctl = rep(FALSE, n)
ctl[1:nc] = TRUE
X = matrix(c(rep(0,floor(m/2)), rep(1,ceiling(m/2))), m, p)
beta = matrix(rnorm(p*n), p, n)
beta[,ctl] = 0
W = matrix(rnorm(m*k),m,k)
alpha = matrix(rnorm(k*n),k,n)
epsilon = matrix(rnorm(m*n),m,n)
Y = X%*%beta + W%*%alpha + epsilon

## Run RUV-inv
fit = RUVinv(Y, X, ctl)

## Get adjusted variances and p-values
fit = variance_adjust(fit)

ruv documentation built on Aug. 31, 2019, 1:04 a.m.