# Compute credible intervals for expected measurements

Source:`R/get_expected.R`

`getExpectedMeasIntervals.Rd`

This functions uses posterior samples to quantify uncertainty in the expected measurements from fitted models.

## Usage

`getExpectedMeasIntervals(expectedMeas, mass = 0.9, method = c("eti", "hdi"))`

## Arguments

- expectedMeas
A

`data.table`

of expected measurements for posterior samples, as returned by`getExpectedMeas()`

.- mass
Number between 0 and 1 indicating the probability mass for which to calculate the intervals.

- method
String indicating the type of interval: 'eti' for equal-tailed using

`stats::quantile()`

, or 'hdi' for highest density using`HDInterval::hdi()`

.

## Value

A `data.table`

containing lower and upper bounds of the expected
measurement for each combination of feature, time, and possibly condition
and covariate.

## Examples

```
library('data.table')
y = GSE34018$y
metadata = GSE34018$metadata
fit = getModelFit(y, metadata)
fit = getPosteriorFit(fit)
fit = getPosteriorSamples(fit, nPosteriorSamples = 10L)
measFitSamps = getExpectedMeas(
fit, times = seq(0, 24, 0.5), fitType = 'posterior_samples',
features = c('13170', '12686'))
measFitInts = getExpectedMeasIntervals(measFitSamps)
```