Learn R Programming

EpiNow2 (version 1.7.1)

calc_CrIs: Calculate Credible Intervals

Description

[Stable] Adds symmetric credible intervals based on quantiles.

Usage

calc_CrIs(samples, summarise_by = NULL, CrIs = c(0.2, 0.5, 0.9))

Value

A data.table containing the summarise_by variables and the specified lower and upper credible intervals.

Arguments

samples

A data.table containing at least a value variable

summarise_by

A character vector of variables to group by.

CrIs

Numeric vector of credible intervals to calculate.

Examples

Run this code
samples <- data.frame(value = 1:10, type = "car")
# add credible intervals
calc_CrIs(samples)
# add 90% credible interval grouped by type
calc_CrIs(samples, summarise_by = "type")

Run the code above in your browser using DataLab