eBayes.mod {mi4p} | R Documentation |
MI-aware Modifed eBayes Function
Description
Modified eBayes function to be used instead of the one in the limma package
Usage
eBayes.mod(
fit,
VarRubin,
proportion = 0.01,
stdev.coef.lim = c(0.1, 4),
trend = FALSE,
robust = FALSE,
winsor.tail.p = c(0.05, 0.1)
)
Arguments
fit |
an MArrayLM fitted model object produced by lmFit or contrasts.fit. For ebayes only, fit can alternatively be an unclassed list produced by lm.series, gls.series or mrlm containing components coefficients, stdev.unscaled, sigma and df.residual. |
VarRubin |
a variance-covariance matrix. |
proportion |
numeric value between 0 and 1, assumed proportion of genes which are differentially expressed |
stdev.coef.lim |
numeric vector of length 2, assumed lower and upper limits for the standard deviation of log2-fold-changes for differentially expressed genes |
trend |
logical, should an intensity-trend be allowed for the prior variance? Default is that the prior variance is constant. |
robust |
logical, should the estimation of df.prior and var.prior be robustified against outlier sample variances? |
winsor.tail.p |
numeric vector of length 1 or 2, giving left and right tail proportions of x to Winsorize. Used only when robust=TRUE. |
Value
eBayes produces an object of class MArrayLM (see MArrayLM-class) containing everything found in fit
plus the following added components:
- t
numeric matrix of moderated t-statistics.
- p.value
numeric matrix of two-sided p-values corresponding to the t-statistics.
- lods
numeric matrix giving the log-odds of differential expression (on the natural log scale).
- s2.prior
estimated prior value for sigma^2. A row-wise vector if covariate is non-NULL, otherwise a single value.
- df.prior
degrees of freedom associated with s2.prior. A row-wise vector if robust=TRUE, otherwise a single value.
- df.total
row-wise numeric vector giving the total degrees of freedom associated with the t-statistics for each gene. Equal to df.prior+df.residual or sum(df.residual), whichever is smaller.
- s2.post
row-wise numeric vector giving the posterior values for sigma^2.
- var.prior
column-wise numeric vector giving estimated prior values for the variance of the log2-fold-changes for differentially expressed gene for each constrast. Used for evaluating lods.
- F
row-wise numeric vector of moderated F-statistics for testing all contrasts defined by the columns of fit simultaneously equal to zero.
- F.p.value
row-wise numeric vector giving p-values corresponding to F.
The matrices t, p.value and lods have the same dimensions as the input object fit, with rows corresponding to genes and columns to coefficients or contrasts. The vectors s2.prior, df.prior, df.total, F and F.p.value correspond to rows, with length equal to the number of genes. The vector var.prior corresponds to columns, with length equal to the number of contrasts. If s2.prior or df.prior have length 1, then the same value applies to all genes.
s2.prior, df.prior and var.prior contain empirical Bayes hyperparameters used to obtain df.total, s2.post and lods.
Author(s)
Modified by M. Chion and F. Bertrand. Original by Gordon Smyth and Davis McCarthy
Examples
library(mi4p)
data(datasim)
datasim_imp <- multi.impute(data = datasim[,-1], conditions =
attr(datasim,"metadata")$Condition, method = "MLE")
VarRubin.matrix <- rubin2.all(datasim_imp[1:5,,],
attr(datasim,"metadata")$Condition)
set.seed(2016)
sigma2 <- 0.05 / rchisq(100, df=10) * 10
y <- datasim_imp[,,1]
design <- cbind(Intercept=1,Group=as.numeric(
attr(datasim,"metadata")$Condition)-1)
fit.model <- limma::lmFit(y,design)
eBayes.mod(fit=fit.model,VarRubin.matrix[[1]])