The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Coverage status

grattan

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.

Overview

install.packages("grattan")
library(grattan)

income_tax

Calculates the income tax for a given taxable income and financial year:

income_tax(50e3, "2015-16")
## [1] 8547

With sample files

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)]
##         Taxable_Income       tax
##      1:           4800     0.000
##      2:         126122 36503.970
##      3:          39742  4655.410
##      4:         108123 29574.355
##      5:          85957 21040.445
##     ---                         
## 258770:          24462  1111.710
## 258771:          37055  3701.525
## 258772:          45024  6530.520
## 258773:           5134     0.000
## 258774:          46368  7007.640

model_income_tax: modelling changes to personal income tax

While 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)]
##         Taxable_Income baseline_tax   new_tax
##      1:           4800        0.000     0.000
##      2:         126122    36503.970 36503.970
##      3:          39742     4655.410  4655.410
##      4:         108123    29574.355 29574.355
##      5:          85957    21040.445 21040.445
##     ---                                      
## 258770:          24462     1111.710  1111.710
## 258771:          37055     3701.525  3701.525
## 258772:          45024     6530.520  6530.520
## 258773:           5134        0.000     0.000
## 258774:          46368     7007.640  7007.640

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
## [1] "$1.7 billion"

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()
## Warning: Removed 6 row(s) containing missing values (geom_path).

NEWS

2023.0

2.0.0.0

Breaking changes

API changes

Other changes

1.9.0.10

Breaking changes anticipated in 2.0.0.0

1.9.0.8

1.9.0.0

New features

Data

Internal:

1.8.0.1

Bug fixes

Data

1.7.1.4

1.7.1.3

1.7.1.1

1.7.1.0

Bug fixes

New functions:

Enhancements:

Internal

1.7.0.0

Bug fixes

New features

Enhancements

set.seed(19952010)
from_fys <- sample(yr2fy(1995:2010), size = 1e6, replace = TRUE)
microbenchmark(cpi_inflator(from_fy = from_fys, to_fy = "2015-16"))
# Old
Unit: seconds
                                                expr      min      lq     mean   median       uq
 cpi_inflator(from_fy = from_fys, to_fy = "2015-16") 1.519483 1.54438 1.550628 1.549735 1.554507
      max neval
 1.661502   100
 
# New
Unit: milliseconds
                                                expr      min       lq     mean   median       uq
 cpi_inflator(from_fy = from_fys, to_fy = "2015-16") 40.71753 41.94061 47.93162 42.93946 48.08461
      max neval
 191.3497   100

Potentially breaking changes

  #> Last change: NAMESPACE at 2018-08-19 14:47:14 (4 mins ago).
  #> Unit: milliseconds
  #>       expr min  lq mean median  uq max neval cld
  #>   yr2fy(z)  75  88   98     90 101 161   100  a 
  #>  .yr2fy(z) 274 286  298    297 302 359   100   b

Use yr2fy(x, assume1901_2100 = FALSE) if you need the old behaviour.

Misc/Internal

1.6.0.0

2018-05-08

1.5.3.6

2018-02-21

1.5.3.1

2018-01-22

New features:

Other user-visible changes

Data:

Other changes

1.5.2.5

2017-11-16

2017-10-27

1.5.2.3

2017-10-21

1.5.2.0

2017-10-19

1.5.1.2

2017-10-15

2017-08-30

2017-08-16

2017-07-02

CRAN Notes

This is a package update

Test results

0 ERRORS | 0 WARNINGS | 1-2 NOTEs

NOTES:

Notes for taxstats are routine

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.