# getPosteriors: An internal function in the baySeq package for calculating... In baySeq: Empirical Bayesian analysis of patterns of differential expression in count data

## Description

For likelihoods of the data given a set of models, this function calculates the posterior likelihoods of the models given the data. An internal function of baySeq, which should not in general be called by the user.

## Usage

 1 2 getPosteriors(ps, prs, pET = "none", marginalise = FALSE, groups, priorSubset = NULL, maxit = 100, accuracy = 1e-5, eqOverRep = NULL, cl = cl)

## Arguments

 ps A matrix containing likelihoods of the data for each count (rows) under each model (columns). prs (Initial) prior probabilities for each of the models. pET What type of prior re-estimation should be attempted? Defaults to "none"; "BIC" and "iteratively" are also available. marginalise Should an attempt be made to numerically marginalise over a prior distribution iteratively estimated from the posterior distribution? Defaults to FALSE, as in general offers little performance gain and increases computational cost considerably. groups Group structure from which likelihoods in 'ps' were defined. priorSubset If 'estimatePriors = TRUE', what subset of the data should be used to re-estimate the priors? Defaults to NULL, implying all data will be used. maxit What is the maximum number of iterations that should be tried if we are bootstrapping prior probabilities from the data? accuracy How small should the difference in estimated priors be before we stop bootstrapping. eqOverRep A boolean describing which prior values are equally marginally distributed over replicates. cl Parallelisation cluster object.

## Details

An internal function, that will not in general be called by the user. It takes the log-likelihoods of the data given the models being tested and returns the posterior likelihoods of the models.

The function may attempt to estimate the prior likelihoods either by using the Bayesian Information Criterion ('pET = "BIC"') 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.

## Value

A list containing posteriors: estimated posterior likelihoods of the model for each count (log-scale) priors: estimated (or given) prior probabilities of the model

## Author(s)

Thomas J. Hardcastle

## References

Hardcastle T.J., and Kelly, K. baySeq: Empirical Bayesian Methods For Identifying Differential Expression In Sequence Count Data. BMC Bioinformatics (2010)