pp_contrast: Posterior predictive contrast

Description Usage Arguments Value Examples

Description

Posterior predictive contrast

Usage

1
pp_contrast(stanreg, cdata, ccoef, width = 0.95, yfun = median, ...)

Arguments

stanreg

stanreg object from rstanarm.

cdata

a list of data sets to use to find posterior predictions of each.

ccoef

contrast coefficients corresponding to the order of the data sets in cdata.

width

confidence interval width. Sent to the prob argument from posterior_interval.

yfun

the stat function to use to collapse the predictions into a scalar value. Corresponds to the average of the predicted responses for each data set in cdata. Default is median.

...

additional parameters passed to the function posterior_predict posterior_interval.

Value

list containing the confidence interval and posterior predictive contrast difference

Examples

1
2
3
4
5
6
7
8
stanreg <- example_stanreg()
cdata <- list(
c1 = contrast_data(stanreg, TRUE, margin_ignore = 'floor', subset_expression = .~ log_uranium < -0.5),
c2 = contrast_data(stanreg, TRUE, margin_ignore = 'floor', subset_expression = .~ log_uranium >= -0.5 & log_uranium <= 0.5),
c3 = contrast_data(stanreg, TRUE, margin_ignore = 'floor', subset_expression = .~ log_uranium > 0.5))

my_contrast <- pp_contrast(stanreg, cdata, c(-1, 0.5, 0.5))
my_contrast$ci

iamamutt/rbaes documentation built on May 18, 2019, 1:27 a.m.