R/simulate_alcohol_mup.R

Defines functions simulate_alcohol_mup

Documented in simulate_alcohol_mup

#' Simulate a Change in a minimum unit price (MUP) for alcohol.
#'
#' This function estimates the change in final demand which will occur for a given change in the duty
#' on alcohol
#'
#' @param mup minimum unit price.
#' @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_mup <- function(mup = 0,
                                 cons.data = NULL) {

  #### On-Trade

  # vector of price changes - increasing either by the MUP - current price, or by zero if the MUP doesn't bite.
  price.change <- pmax(rep(mup,5) - cons.data[1:5,"price"],0)
  # vector of proportionate price changes - proportionate change in tax times the share of tax in price per unit
  prop.price.change <- price.change/cons.data[1:5,"price"]
  # 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 price changes - increasing either by the MUP - current price, or by zero if the MUP doesn't bite.
  price.change <- pmax(rep(mup,5) - cons.data[6:10,"price"],0)
  # vector of proportionate price changes - proportionate change in tax times the share of tax in price per unit
  prop.price.change <- price.change/cons.data[6:10,"price"]
  # 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)
}
djmorris1989/iomodeltobalc documentation built on June 11, 2020, 12:16 a.m.