## ----setup, include=FALSE----------------------------------------------------- library(bayesDP) knitr::opts_chunk$set(fig.width = 7, fig.height = 4.5, out.width = "100%", fig.align = "center", dpi = 150) ## ----discount-functions, fig.cap="Historical weight with alpha_max = 1. The scale 0.8 panel illustrates the normalization; it is not a recommended calibration.", fig.alt="Historical weight with alpha_max = 1. The scale 0.8 panel illustrates the normalization; it is not a recommended calibration."---- curves <- expand.grid( p = seq(0, 1, length.out = 201), function_name = c("identity", "weibull", "scaledweibull"), scale = c(0.135, 0.8) ) curves$alpha <- mapply(function(p, function_name, scale) { alpha_discount(p, discount_function = function_name, alpha_max = 1, weibull_shape = 3, weibull_scale = scale) }, curves$p, as.character(curves$function_name), curves$scale) ggplot(curves, aes(p, alpha, colour = function_name, linetype = function_name)) + geom_line(linewidth = 0.9) + facet_wrap(~scale, labeller = label_both) + theme_bw() + labs(x = "Current-historical comparison, p", y = "Historical weight, alpha", colour = "Discount function", linetype = "Discount function")