
Last chance! 50% off unlimited learning
Sale ends in
getLikelihoods.NB(cD, prs, pET = "BIC", marginalise = FALSE, subset = NULL,
priorSubset = NULL, bootStraps = 1, conv = 1e-4, nullData = FALSE,
returnAll = FALSE, returnPD = FALSE, verbose = TRUE, discardSampling =
FALSE, cl, ...)
getLikelihoods.BB(cD, prs, pET = "BIC", marginalise = FALSE, subset =
NULL, priorSubset = NULL, bootStraps = 1, conv = 1e-04, nullData = FALSE,
returnAll = FALSE, returnPD = FALSE, verbose = TRUE, discardSampling =
FALSE, cl, ...)
getLikelihoods(cD, prs, pET = "BIC", marginalise = FALSE, subset = NULL,
priorSubset = NULL, bootStraps = 1, bsNullOnly = TRUE, conv = 1e-4, nullData = FALSE, weightByLocLikelihoods = TRUE, modelPriorSets = list(),
modelPriorValues = list(), returnAll = FALSE, returnPD = FALSE, verbose
= TRUE, discardSampling = FALSE, modelLikes = TRUE, cl = NULL, tempFile
= NULL, largeness = 1e+08)
countData
, or descending
from this class.'getLikelihoods'
function by the now deprecated functions.countData
or pairedData
object.
@group
slot of the input
object. The posterior likelihoods are stored on the natural log scale
in the @posteriors
slot of the countData
or
pairedData
object generated by this function. This is
because the posterior likelihoods are calculated in this form, and
ordering of the counts is better done on these log-likelihoods than on
the likelihoods.
If 'pET = "none"'
then no attempt is made to re-estimate the
prior likelihoods given in the 'prs'
variable. However, if
'pET = "BIC"'
, then the function will attempt to estimate the
prior likelihoods by using the Bayesian Information Criterion to
identify the proportion of the data best explained by each
model and taking these proportions as prior. Alternatively, an
iterative re-estimation of priors is possible ('pET = "iteratively"'
),
in which an inital estimate for the prior likelihoods of the models is
used to calculated the posteriors and then the priors are updated by
taking the mean of the posterior likelihoods for each model across all
data. This often works well, particularly if the 'BIC' method is used
(see Hardcastle & Kelly 2010 for details). However, if the data are
sufficiently non-independent, this approach may substantially
mis-estimate the true priors. If it is possible to select a
representative subset of the data by setting the variable
'subsetPriors'
that is sufficiently independent, then better
estimates may be acquired. In certain circumstances, it may be expected that certain subsets of the data are likely to behave differently to others; for example, if a set of genes are expected in advance to be differentially expressed, while the majority of the data are not. In this case, it may be advantageous (in terms of improving false discovery rates) to specify these different subsets in the modelPriorSets variable. However, care should be taken downstream to avoid confirmation bias.
Filtering the data may be extremely advantageous in reducing run time. This can be done by passing a numeric vector to 'subset' defining a subset of the data for which posterior likelihoods are required.
See Hardcastle & Kelly (2010) for a definition of the negative binomial methods.
A 'cluster' object is strongly recommended in order to parallelise
the estimation of posterior likelihoods, particularly for the
negative binomial method. However, passing NULL to the cl
variable will allow the functions to run in non-parallel mode.
The `getLikelihoods.NB' and `getLikelihoods.BB' functions are now deprecated and will soon be removed.
countData
, getPriors
,
topCounts
, getTPs
# See vignette for more examples.
# If we do not wish to parallelise the functions we set the cluster
# object to NULL.
cl <- NULL
# Alternatively, if we have the 'snow' package installed we
# can parallelise the functions. This will usually (not always) offer
# significant performance gain.
## Not run: try(library(snow))
## Not run: try(cl <- makeCluster(4, "SOCK"))
# load test data
data(simData)
# Create a {countData} object from test data.
replicates <- c("simA", "simA", "simA", "simA", "simA", "simB", "simB", "simB", "simB", "simB")
groups <- list(NDE = c(1,1,1,1,1,1,1,1,1,1), DE = c(1,1,1,1,1,2,2,2,2,2))
CD <- new("countData", data = simData, replicates = replicates, groups = groups)
# set negative binomial density function
densityFunction(CD) <- nbinomDensity
#estimate library sizes for countData object
libsizes(CD) <- getLibsizes(CD)
# Get priors for negative binomial method
## Not run: CDPriors <- getPriors(CD, samplesize = 10^5, estimation = "QL", cl = cl)
# To speed up the processing of this example, we have already created
# the `CDPriors' object.
data(CDPriors)
# Get likelihoods for data with negative binomial method.
CDPost <- getLikelihoods(CDPriors, pET = "BIC", cl = cl)
try(stopCluster(cl))
Run the code above in your browser using DataLab