Utilities for costing and evaluating Australian tax policy, including high-performance tax and transfer calculators, a fast method of projecting tax collections from ATO sample files, and an interface to common indices from the Australian Bureau of Statistics. Written to support Grattan Institute's Australian Perspectives program.
library(knitr) opts_chunk$set(dev = 'svg', fig.path = "man/figures/README_")
install.packages("grattan")
library(grattan)
income_tax
Calculates the income tax for a given taxable income and financial year:
income_tax(50e3, "2015-16")
income_tax
is designed to work well with the ATO's sample files. You can obtain the sample files from my repo:
# install.packages("taxstats", repos = "https://hughparsonage.github.io/tax-drat") library(taxstats) library(hutils) library(data.table) library(magrittr) library(ggplot2)
Simply pass the sample file to .dots.ATO
and the complexities of things like Medicare levy and the Seniors and Pensioners Tax Offset are handled for you. For example:
s1314 <- as.data.table(sample_file_1314) s1314 %>% .[, tax := income_tax(Taxable_Income, "2013-14", .dots.ATO = s1314)] %>% .[, .(Taxable_Income, tax)]
model_income_tax
: modelling changes to personal income taxWhile income_tax
is designed to inflexibly return the tax payable as legislated,
model_income_tax
is designed to calculate income tax when changes are made. For example,
s1314 %>% # reduce top threshold from 180,000 to 150,000 model_income_tax(ordinary_tax_thresholds = c(0, 18200, 37000, 80000, 150e3), baseline_fy = "2013-14") %>% .[, .(Taxable_Income, baseline_tax, new_tax)]
project
Given a sample file, we can project forward a number of years
s1617 <- project(s1314, h = 3L)
or to a particular financial year
s1718 <- project_to(s1314, "2017-18")
Together with model_income_tax
, this allows us to make point-predictions of future years. The function revenue_foregone
prettily prints the resultant revenue:
sample_file_1314 %>% project_to("2018-19") %>% model_income_tax(baseline_fy = "2017-18", ordinary_tax_thresholds = c(0, 18200, 37000, 87000, 150e3)) %>% revenue_foregone
compare_avg_tax_rates
:Create comparison of average tax rates:
lapply(list("30k" = 30e3, "36k" = 36e3, "42k" = 42e3), function(T2) { model_income_tax(s1718, baseline_fy = "2017-18", ordinary_tax_thresholds = c(0, 18200, T2, 87000, 180e3)) }) %>% rbindlist(idcol = "id", use.names = TRUE, fill = TRUE) %>% compare_avg_tax_rates(baseDT = .[id %ein% "36k"]) %>% ggplot(aes(x = Taxable_Income_percentile, y = delta_avgTaxRate, color = id, group = id)) + geom_hline(yintercept = 0) + geom_line()
cat(readLines("NEWS.md"), sep = "\n")
cat(readLines("cran-comments.md"), sep = "\n")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.