getPosteriors {baySeq} | R Documentation

## An internal function in the baySeq package for calculating posterior likelihoods given likelihoods of the 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

    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)

### See Also

`getLikelihoods`

### Examples

    # Simulate some log-likeihoods of data given models (each model
    # describes one column of the 'ps' object).
    ps <- log(rbind(
                    cbind(runif(10000, 0, 0.1), runif(10000, 0.3, 0.9)),
                    cbind(runif(10000, 0.4, 0.9), runif(1000, 0, 0.2))))

    # get posterior log-likelihoods of model, estimating prior likelihoods
    # of each model from the data.

    pps <- getPosteriors(ps, prs <- c(0.5, 0.5), pET = "none", cl =
    NULL)

    pps$priors

    pps$posteriors[1:10,]

[Package baySeq version 2.26.0 Index]