Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(dplyr)
- library(dtplyr)
- library(magrittr)
- library(data.table)
- library(taxstats)
- library(grattan)
- MYEFO <-
- data.table(fy_year = yr2fy(2017:2020),
- r = c(0.023, 0.025, 0.033, 0.035))
- Pessimistic <-
- data.table(fy_year = yr2fy(2017:2020),
- r = c(0.021, 0.021, 0.031, 0.031))
- tax_by_scenario <- function(FY, assumption = c("MYEFO", "Pessimistic")){
- h <- as.integer(fy2yr(FY) - 2013L)
- assumption <- match.arg(assumption)
- if (assumption == "MYEFO"){
- sample_file_MYEFO <-
- sample_file_1213 %>%
- copy %>%
- project(fy.year.of.sample.file = "2012-13", h = h, wage.series = MYEFO)
- tax_collected <-
- sample_file_MYEFO %$%
- sum(income_tax(Taxable_Income,
- fy.year = "2016-17",
- .dots.ATO = copy(sample_file_MYEFO)) * WEIGHT) / 1e9
- } else {
- sample_file_Pessimistic <-
- sample_file_1213 %>%
- copy %>%
- project(fy.year.of.sample.file = "2012-13", h = h, wage.series = Pessimistic)
- tax_collected <-
- sample_file_Pessimistic %$%
- sum(income_tax(Taxable_Income,
- fy.year = "2016-17",
- .dots.ATO = copy(sample_file_Pessimistic)) * WEIGHT) / 1e9
- }
- return(tax_collected)
- }
- Answer <-
- CJ(FY = yr2fy(2017:2020), Assumption = c("MYEFO", "Pessimistic")) %>%
- as.data.frame %>%
- rowwise %>%
- mutate(tax = tax_by_scenario(FY, Assumption))
- Answer %>%
- fwrite("~/outbox/Tax-collected-billions-by-fy-year-and-assumptions.csv")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement