Calculate rescaled variances, empirical variances, etc. For use with RUV model fits.
variance_adjust(fit, ctl.idx = NULL, ebayes = TRUE, pooled=TRUE, evar = TRUE,
rsvar = TRUE, bin = 10, rescaleconst = NULL)
A RUV model fit (a list), as returned by RUV2 / RUV4 / RUVinv / RUVrinv
An index vector to specify the negative controls for use with the rescaled variances method. If unspecified, by default fit$ctl
is used.
A logical variable. Should empirical bayes variance estimates be calculated?
A logical variable. Should pooled variance estimates be calculated?
A logical variable. Should empirical variance estimates be calculated?
A logical variable. Should rescaled variance estimates be calculated?
The bin size to use when calculating empirical variances.
Can be used to speed up execution. See get_empirical_variances
.
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:
Estimates of sigma^2 using the empirical bayes shrinkage method of Smyth (2004)
Estimate of degrees of freedom using the empirical bayes shrinkage method of Smyth (2004)
Estimate of sigma^2 pooled (averaged) over all genes
Degrees of freedom for pooled estimate
"Standard" estimate of the variance of betahat
"Rescaled Variances" estimate of the variance of betahat
"Empirical Variances" estimate of the variance of betahat
"Empirical Bayes" estimate of the variance of betahat
"Rescaled Empirical Bayes" estimate of the variance of betahat
"Pooled" estimate of the variance of betahat
"Rescaled pooled" estimate of the variance of betahat
Similar to the above, but all genes used to determine the rescaling, not just control genes
P-values, after applying the method of rescaled variances
P-values, after applying the method of empirical variances
P-values, after applying the empirical bayes method of Smyth (2004)
P-values, after pooling variances
P-values, after applying the empirical bayes method of Smyth (2004) and the method of rescaled variances
P-values, after pooling variances and the method of rescaled variances
Similar to the above, but all genes used to determine the rescaling, not just control genes
F test p-values, after applying the empirical bayes method of Smyth (2004)
F test p-values, after pooling variances
FDR-adjusted p-values
FDR-adjusted p-values (from F test)
FDR-adjusted p-values (from p.rsvar)
FDR-adjusted p-values (from p.evar)
FDR-adjusted p-values (from p.ebayes)
FDR-adjusted p-values (from p.rsvar.ebayes)
FDR-adjusted F test p-values (from Fpvals.ebayes)
FDR-adjusted p-values (from p.pooled)
FDR-adjusted p-values (from p.rsvar.pooled)
FDR-adjusted p-values (from p.evar.pooled)
FDR-adjusted F test p-values (from Fpvals.pooled)
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.
RUV2
, RUV4
, RUVinv
, RUVrinv
, get_empirical_variances
, sigmashrink
# NOT RUN {
## 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)
# }
Run the code above in your browser using DataLab