To determine the effects of bracket creep on a proposed tax policy, a common task is calculate the change in the average tax rates for each percentile. This function accepts a sample file and a baseline sample file, and returns a 100-row table giving the mean change in average tax rates for each percentile, compared to the baseline.

compare_avg_tax_rates(DT, baseDT, by = "id", ids = NULL)

Arguments

DT

A single data.table containing columns new_tax, Taxable_Income, baseline_tax.

baseDT

A data.table of a single cross-section of taxpayers from which baseline percentiles can be produced.

by

How to separate DT

ids

Subset DT by by.