Created
April 19, 2016 06:30
-
-
Save HughParsonage/54201d64d71bd9881bc69646a819a121 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(taxstats) | |
library(grattan) | |
library(data.table) | |
library(dplyr) | |
library(magrittr) | |
n_affected_by_div293 <- function(div293.threshold = 300e3, cap = 30000, cap2 = 35000, age_based_cap = TRUE, div293 = TRUE, super.guarantee.rate = 0.095, use.sample.file = "2013-14", h = 0L){ | |
sample_file_extended <- | |
# sample_files_all[fy.year == use.sample.file] %>% | |
sample_file_1314 %>% | |
project(h = h) %>% | |
# 50 year olds and over get a cap of 35e3 | |
mutate(prev_cap = ifelse(age_range <= 4, 35e3, 30e3)) %>% | |
mutate( | |
# Throughout we assume that the minimum amount of super guarantee contributions are made. | |
super_income_in_excess_of_cap = pmax(0, Rptbl_Empr_spr_cont_amt + Non_emp_spr_amt + super.guarantee.rate * Sw_amt - prev_cap), | |
# the minimum of the cap applicable or the contributions actually made | |
prv_concess_contr_amt = pmin(prev_cap, Rptbl_Empr_spr_cont_amt + Non_emp_spr_amt + super.guarantee.rate * Sw_amt), | |
new_concess_contr_amt = pmin(ifelse(age_range <= 4, | |
ifelse(age_based_cap, cap2, cap), | |
cap), | |
# | |
Rptbl_Empr_spr_cont_amt + Non_emp_spr_amt + super.guarantee.rate * Sw_amt), | |
new_super_income_in_excess_of_cap = pmax(0, Rptbl_Empr_spr_cont_amt + Non_emp_spr_amt + super.guarantee.rate * Sw_amt - ifelse(age_range <= 4, if(age_based_cap) cap2 else cap, cap)), | |
new_Taxable_Income = Taxable_Income - super_income_in_excess_of_cap + new_super_income_in_excess_of_cap, | |
# | |
revenue_due_to_Taxable_Income = income_tax(new_Taxable_Income, | |
fy.year = use.sample.file) - income_tax(Taxable_Income, | |
fy.year = use.sample.file) | |
) %>% | |
# div293 | |
mutate( | |
prv_tax_payable_on_concess_contr = 0.15 * prv_concess_contr_amt, | |
new_tax_payable_on_concess_contr = 0.15 * new_concess_contr_amt, | |
# https://www.ato.gov.au/uploadedFiles/Content/TPALS/downloads/Division-293-scenario-table-v2.pdf | |
# Technically the surchargeable income includes amounts on which family trust distribution tax has been paid. This has | |
# been omitted, meaning that some individuals' div 293 tax burden is underestimated. | |
prv_surchargeable_income293 = Taxable_Income + Net_fincl_invstmt_lss_amt - pmin(Net_rent_amt, 0) + Rep_frng_ben_amt, | |
# We assume that low tax contributions cannot be negative. Since prv concess is capped, | |
# we don't have to subtract off excess contributions | |
prv_low_tax_contributions293 = pmax(0, prv_concess_contr_amt), | |
prv_div293_income = prv_surchargeable_income293 + prv_low_tax_contributions293, | |
prv_div293_tax = ifelse(prv_div293_income > 300e3, | |
0.15 * pmin(prv_low_tax_contributions293, | |
pmax(prv_div293_income - 300e3, 0)), | |
0), | |
new_surchargeable_income293 = new_Taxable_Income + Net_fincl_invstmt_lss_amt - pmin(Net_rent_amt, 0) + Rep_frng_ben_amt, | |
new_low_tax_contributions293 = pmax(0, new_concess_contr_amt), | |
new_div293_income = new_surchargeable_income293 + new_low_tax_contributions293, | |
new_div293_tax = ifelse(new_div293_income > div293.threshold, | |
0.15 * pmin(new_low_tax_contributions293, | |
pmax(new_div293_income - div293.threshold, 0)), | |
0) | |
) | |
n_affected <- | |
sample_file_extended %$% | |
sum((new_div293_tax > prv_div293_tax) * WEIGHT) | |
n_affected | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment