Learn R Programming

limorhyde2 (version 0.1.1)

getPosteriorSamples: Draw samples from posterior distributions of fitted models

Description

This is an optional step in an analysis using limorhyde2, and is useful for quantifying uncertainty in posterior estimates of fitted curves and rhythmic statistics. The function calls mashr::mash_compute_posterior_matrices().

Usage

getPosteriorSamples(fit, nPosteriorSamples = 200L, overwrite = FALSE)

Value

A limorhyde2 object containing everything in fit with added or updated element:

  • mashPosteriorSamples: a three-dimensional array of coefficients, with dim 1 corresponding to features, dim 2 to model terms, and dim 3 to posterior samples.

Arguments

fit

A `limorhyde2' object containing posterior fits.

nPosteriorSamples

Number of samples to draw from each posterior distribution.

overwrite

Logical indicating whether to recompute posterior samples if they already exist.

See Also

getPosteriorFit(), getRhythmStats(), getExpectedMeas(), getStatsIntervals()

Examples

Run this code
library('data.table')

y = GSE54650$y
metadata = GSE54650$metadata

fit = getModelFit(y, metadata)
fit = getPosteriorFit(fit)
fit = getPosteriorSamples(fit, nPosteriorSamples = 10L)

rhyStatsSamps = getRhythmStats(
  fit, features = c('13170', '13869'), fitType = 'posterior_samples')
rhyStatsInts = getStatsIntervals(rhyStatsSamps)

Run the code above in your browser using DataLab