#' Simulate an Exogenous Demand Shock to Alcohol.
#'
#' This function estimates the change in final demand which will occur when there is an exogenous
#' change in the demand for alcohol products i.e. policies or shocks which do not operate through the
#' price mechanism.
#'
#' @param on.trade vector of exogenous proportionate falls in demand by product in the on-trade.
#' In order; beer, cider, wine, spirit, RTDs.
#' @param off.trade vector of exogenous proportionate falls in demand by product in the off-trade.
#' In order; beer, cider, wine, spirit, RTDs.
#' @param cons.data data frame of price, consumption, elasticity, and tax data.
#'
#' @return a table of output effects (in levels and percentages) and associated Type I and II multipliers.
#'
#' @export
simulate_alcohol_demandshock <- function(on.trade = NULL,
off.trade = NULL,
cons.data = NULL) {
#### On-Trade
consumption.change <- on.trade*cons.data[1:5,"consumption"]
cons_change_alc_on_trade <- sum(consumption.change)
#### Off-Trade
consumption.change <- off.trade*cons.data[6:10,"consumption"]
cons_change_alc_off_trade <- sum(consumption.change)
# combine consumption changes into one vector and return
change <- matrix(c(cons_change_alc_on_trade,cons_change_alc_off_trade),nrow=1,
dimnames = list(c(""),c("On-Trade","Off-Trade")))
return(change)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.