Skip to contents

Get credible intervals for a, R, b

Usage

credible_prep(res, params = c("a", "R", "b"), labels = FALSE)

Arguments

res

output data frame from ebase

params

character vector indicating which parameters to plot, one to any of a, R, or b (default all)

labels

logical indicating of parameter labels are output as an expression for parsing in plot facets, default FALSE

Value

A data frame

Details

This function gets 95% credible intervals (2.5th to 97.5th percentiles, approximate posterior distributions) for a, R, and/or b using the output from ebase. The function is used in credible_plot, but is provided as a separate function for convenience.

Examples

# get credible intervals
credible_prep(exres)
#> # A tibble: 12 × 6
#> # Groups:   grp [4]
#>    Date         grp var      mean       lo      hi
#>    <date>     <dbl> <fct>   <dbl>    <dbl>   <dbl>
#>  1 2012-06-01     1 a       0.894   0.549    1.24 
#>  2 2012-06-01     1 R     141.     91.8    189.   
#>  3 2012-06-01     1 b       0.310   0.0954   0.488
#>  4 2012-06-02     2 a       0.929   0.705    1.18 
#>  5 2012-06-02     2 R     180.    133.     229.   
#>  6 2012-06-02     2 b       0.307   0.0927   0.484
#>  7 2012-06-03     3 a       0.618   0.413    0.833
#>  8 2012-06-03     3 R     130.     97.9    161.   
#>  9 2012-06-03     3 b       0.321   0.120    0.487
#> 10 2012-06-04     4 a       0.728   0.518    0.941
#> 11 2012-06-04     4 R     140.    108.     170.   
#> 12 2012-06-04     4 b       0.279   0.0741   0.468