#' Simulate a Change in Alcohol Duty
#'
#' This function estimates the change in final demand which will occur for a given change in the duty
#' on alcohol
#'
#' @param by.product if TRUE, will apply a separate tax increase to the 5 different alcohol products.
#' @param cons.data data frame of price, consumption, elasticity, and tax data.
#' @param tax.change the change in tax to be applied to all alcohol products.
#' @param beer.change change in tax to be applied to beer.
#' @param cider.change change in tax to be applied to cider.
#' @param wine.change change in tax to be applied to wine.
#' @param spirit.change change in tax to be applied to spirits.
#' @param RTD.change change in tax to be applied to RTDs
#'
#' @return a table of output effects (in levels and percentages) and associated Type I and II multipliers.
#'
#' @export
simulate_alcohol_tax <- function(by.product=FALSE,
cons.data = NULL,
tax.change=0,
beer.change=0,
cider.change=0,
wine.change=0,
spirit.change=0,
RTD.change=0) {
if (by.product==FALSE) {
tax.vector <- rep(tax.change,5)
} else if (by.product==TRUE) {
tax.vector <- c(beer.change,cider.change,wine.change,spirit.change,RTD.change)
}
#### On-Trade
# vector of tax changes
# vector of proportionate tax changes
prop.tax.change <- tax.vector/cons.data[1:5,"tax"]
# vector of proportionate price changes - proportionate change in tax times the share of tax in price per unit
prop.price.change <- prop.tax.change*cons.data[1:5,"taxProp"]
# vector of proportionate consumption changes - proportionate price change times the elasticity of demand
prop.cons.change <- prop.price.change*cons.data[1:5,"elasticity"]
# vector of consumption changes in units - proportionate change in consumption multiplied by consumption
unit.cons.change <- prop.cons.change*cons.data[1:5,"consumption"]
# vector of consumption expenditure changes - consumption change multiplied by price
consumption.change <- unit.cons.change*cons.data[1:5,"price"]
cons_change_alc_on_trade <- sum(consumption.change)
#### Off-Trade
# vector of proportionate tax changes
prop.tax.change <- tax.vector/cons.data[6:10,"tax"]
# vector of proportionate price changes - proportionate change in tax times the share of tax in price per unit
prop.price.change <- prop.tax.change*cons.data[6:10,"taxProp"]
# vector of proportionate consumption changes - proportionate price change times the elasticity of demand
prop.cons.change <- prop.price.change*cons.data[6:10,"elasticity"]
# vector of consumption changes in units - proportionate change in consumption multiplied by consumption
unit.cons.change <- prop.cons.change*cons.data[6:10,"consumption"]
# vector of consumption expenditure changes - consumption change multiplied by price
consumption.change <- unit.cons.change*cons.data[6:10,"price"]
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.