ShrinkBayesWrap | R Documentation |
This function enables applying ShrinkBayes using a one-line command. It includes the ShrinkSeq()
(counts) or ShrinkGauss()
(Gaussian data) functions,
the FitAllShrink()
function, the MixtureUpdatePrior()
function, the MixtureUpdatePosterior()
function and the
SummaryTable()
function.
ShrinkBayesWrap(data, form, paramtotest = NULL, allcontrasts = FALSE, multvscontrol = FALSE, fams = NULL, notfit = NULL, ncpus2use = 8, priorsimple = FALSE, approx0 = TRUE, diffthr = 0, direction = "two-sided", saveposteriors = TRUE, fileposteriors = "Posteriors.Rdata", sparse=FALSE, designlist=NULL, ...)
data |
Matrix, data frame or list containing the data. Rows are features, columns are samples. For lists: each component represents a feature. |
form |
Formula starting with |
paramtotest |
Character. Name of variable to test. If |
allcontrasts |
Boolean. If |
multvscontrol |
Boolean. If |
fams |
Character string. Only relevant for count data. Either equal to |
notfit |
Numeric vector of integers. Indices of data rows for which fitting is NOT required. |
ncpus2use |
Integer. Number of cpus to use for calculations. |
priorsimple |
Boolean. If |
approx0 |
Boolean. If |
diffthr |
Numeric. Threshold for the null-probability to compute. It demarcates the null-domain from the alternative domain. |
direction |
Character string. Use |
saveposteriors |
Boolean. If |
fileposteriors |
Character. Name of file containing the posterior distributions. |
sparse |
Boolean. If |
designlist |
List. Components are data frames containting the variables in |
... |
Further arguments passed on to |
About notfit
: note that this is not the same as removing the corresponding rows from the data. For correct fitting of the priors
it is essential to use all data. For final fitting, however, computing time can be considerably reduced if a quick screen was used, e.g. by
ScreenData
. For saveposteriors
: please note that he object containing the posterior distributions
can be large. Note that direction
is automatically set to equal
when multi-parameter inference is performed.
Specification of further arguments is particularly useful for shrinking other parameters of the model than paramtotest
and the
dispersion-related parameters (which are shrunken by default). In addition, the ntag
and maxiter
arguments (see
ShrinkSeq
or ShrinkGauss
) can be used to reduce computing time when testing. About sparse
:
in case one expects few very large effects, shrinkage to a simple Gaussian should be avoided, because this may over-shirnk those large effects. Hence, setting
sparse=TRUE
shrinks to a point mass plus Laplace prior.
List containing:
FDRs |
Matrix of (B)FDRs, lfdrs, and effect size estimates |
nsigsFDR01 |
Numeric containing the number of significant results for each comparison at (B)FDR<=0.1 |
shrink |
Output of |
prior |
Output of |
Mark A. van de Wiel
Van de Wiel MA, Neerincx M, Buffart TE, Sie D, Verheul HMW (2014). ShrinkBayes: a versatile R-package for analysis of count-based sequencing data in complex study designs. BMC Bioinformatics. 15(1):116.
Van de Wiel MA, Leday GGR, Pardo L, Rue H, Van der Vaart AW, Van Wieringen WN (2012). Bayesian analysis of RNA sequencing data by estimating multiple shrinkage priors. Biostatistics. 14, 113-128.
ShrinkSeq
, ShrinkGauss
, MixtureUpdatePrior
,
ScreenData
, BFUpdatePosterior
, SummaryTable
,
plotPoster
## Not run: #To empty current R memory and enlarge memory.limit (Windows) consider, before applying 'ShrinkBayes', using #rm(list=ls());gc(); #memory.limit(size = 4000) #FIRST EXAMPLE library(ShrinkBayes) data(CAGEdata10000) CAGEdata <- CAGEdata10000 #FOR FIRST TRY: USE 500 DATA ROWS ONLY CAGEdata <- CAGEdata[1:500,] #loads design of the brain study; includes data(design_brain) #retrieves covariates from the design matrix pers <- design_brain$pers #persons batch<-design_brain$batch #batch groupfac <- design_brain$groupfac #group (= brain region) #Formula as used by INLA form = ~ 1 + groupfac + batch + f(pers,model="iid") #'batch' and 'group' as fixed effect, 'pers' as random effect #defaults to K-sample testing SBcage <- ShrinkBayesWrap(CAGEdata,form) #Multiple Comparisons: SBcagemc <- ShrinkBayesWrap(CAGEdata,form, allcontrasts = TRUE) #2ND EXAMPLE library(ShrinkBayes) data(mirseqnorm) data(designmirseq) #Then, retrieve the covariates: PM <- designmirseq$PM indiv <- designmirseq$indiv timepos <- designmirseq$timepos chemo <- designmirseq$chemo organ <- designmirseq$organ #FORMULA; indiv IS A RANDOM EFFECT form = ~ 1 + PM + timepos + chemo + organ + f(indiv) #TRY IT FOR FIRST 200 DATA ROWS. USE ADDITIONAL SHRINKAGE; #LIMIT ntag AND maxiter to save computing time; USE DEFAULTS FOR FINAL RUN SBmir <- ShrinkBayesWrap(mirseqnorm[1:200,],form,shrinkaddfixed=c("organ","chemo","timepos"),ntag=c(50,100),maxiter=5,priorsimple=TRUE) #2-sample testing for PM, with additional shrinkage for other fixed effects ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.