diff --git a/taxcalc/calculate.py b/taxcalc/calculate.py index d97b07050..e28a31547 100644 --- a/taxcalc/calculate.py +++ b/taxcalc/calculate.py @@ -47,7 +47,11 @@ def __init__(self, params=None, records=None, sync_years=True, **kwargs): if self._records.current_year == 2009: self.records.extrapolate_2009_puf() + inflation = self.params.default_inflation_rates() while self._records.current_year < self._params.current_year: + self._records.factor_target(self.params._factor_target, + inflation, + self.records.current_year + 1) self._records.increment_year() print("Your data have been extrapolated to " + @@ -131,6 +135,11 @@ def calc_all_test(self): return totaldf def increment_year(self): + self.records.factor_adjustment(self.params.factor_adjustment, + self.records.current_year + 1) + self.records.factor_target(self.params._factor_target, + self.params.default_inflation_rates(), + self.records.current_year + 1) self.records.increment_year() self.params.set_year(self.params.current_year + 1) diff --git a/taxcalc/params.json b/taxcalc/params.json index fa2dd178b..e5c28cb54 100644 --- a/taxcalc/params.json +++ b/taxcalc/params.json @@ -1265,5 +1265,29 @@ "value": [ [400000, 450000, 225000, 425000, 450000, 225000], [406750, 457600, 228800, 432200, 457600, 228800], [413200, 464850, 223425, 439000, 464850, 223425]] + }, + "_factor_adjustment":{ + "long_name": "", + "description": "", + "irs_ref": "", + "start_year": 2013, + "col_var": "", + "row_var": "", + "row_label": ["2013"], + "cpi_inflated": false, + "col_label": "", + "value": [[0.0]] + }, + "_factor_target":{ + "long_name": "", + "description": "", + "irs_ref": "", + "start_year": 2013, + "col_var": "", + "row_var": "", + "row_label": ["2013"], + "cpi_inflated": false, + "col_label": "", + "value": [[0.0]] } } diff --git a/taxcalc/records.py b/taxcalc/records.py index afefbb22b..a6c8b32f9 100644 --- a/taxcalc/records.py +++ b/taxcalc/records.py @@ -296,6 +296,52 @@ def __init__(self, def current_year(self): return self._current_year + def factor_adjustment(self, percentage, year): + self.BF.AGDPN[year] += percentage * abs(self.BF.AGDPN[year] - 1) + self.BF.ATXPY[year] += percentage * abs(self.BF.ATXPY[year] - 1) + self.BF.AWAGE[year] += percentage * abs(self.BF.AWAGE[year] - 1) + self.BF.ASCHCI[year] += percentage * abs(self.BF.ASCHCI[year] - 1) + self.BF.ASCHCL[year] += percentage * abs(self.BF.ASCHCL[year] - 1) + self.BF.ASCHF[year] += percentage * abs(self.BF.ASCHF[year] - 1) + self.BF.AINTS[year] += percentage * abs(self.BF.AINTS[year] - 1) + self.BF.ADIVS[year] += percentage * abs(self.BF.ADIVS[year] - 1) + self.BF.ACGNS[year] += percentage * abs(self.BF.ACGNS[year] - 1) + self.BF.ASCHEI[year] += percentage * abs(self.BF.ASCHEI[year] - 1) + self.BF.ASCHEL[year] += percentage * abs(self.BF.ASCHEL[year] - 1) + self.BF.ABOOK[year] += percentage * abs(self.BF.ABOOK[year] - 1) + self.BF.ACPIU[year] += percentage * abs(self.BF.ACPIU[year] - 1) + self.BF.ACPIM[year] += percentage * abs(self.BF.ACPIM[year] - 1) + self.BF.ASOCSEC[year] += percentage * abs(self.BF.ASOCSEC[year] - 1) + self.BF.AUCOMP[year] += percentage * abs(self.BF.AUCOMP[year] - 1) + self.BF.AIPD[year] += percentage * abs(self.BF.AIPD[year] - 1) + + def factor_target(self, target, inflation, year): + # 2013 is the start year of all parameter arrays. Hard coded for now. + # Need to be fixed later + if year >= 2013 and target[year - 2013] != 0: + # user inputs theoretically should be based on GDP + g = abs(self.BF.AGDPN[year] - 1) + ratio = (target[year - 2013] + inflation[year]) / g + + # apply this ratio to all the dollar amount factors + self.BF.AGDPN[year] = ratio * abs(self.BF.AGDPN[year] - 1) + 1 + self.BF.ATXPY[year] = ratio * abs(self.BF.ATXPY[year] - 1) + 1 + self.BF.AWAGE[year] = ratio * abs(self.BF.AWAGE[year] - 1) + 1 + self.BF.ASCHCI[year] = ratio * abs(self.BF.ASCHCI[year] - 1) + 1 + self.BF.ASCHCL[year] = ratio * abs(self.BF.ASCHCL[year] - 1) + 1 + self.BF.ASCHF[year] = ratio * abs(self.BF.ASCHF[year] - 1) + 1 + self.BF.AINTS[year] = ratio * abs(self.BF.AINTS[year] - 1) + 1 + self.BF.ADIVS[year] = ratio * abs(self.BF.ADIVS[year] - 1) + 1 + self.BF.ACGNS[year] = ratio * abs(self.BF.ACGNS[year] - 1) + 1 + self.BF.ASCHEI[year] = ratio * abs(self.BF.ASCHEI[year] - 1) + 1 + self.BF.ASCHEL[year] = ratio * abs(self.BF.ASCHEL[year] - 1) + 1 + self.BF.ABOOK[year] = ratio * abs(self.BF.ABOOK[year] - 1) + 1 + self.BF.ACPIU[year] = ratio * abs(self.BF.ACPIU[year] - 1) + 1 + self.BF.ACPIM[year] = ratio * abs(self.BF.ACPIM[year] - 1) + 1 + self.BF.ASOCSEC[year] = ratio * abs(self.BF.ASOCSEC[year] - 1) + 1 + self.BF.AUCOMP[year] = ratio * abs(self.BF.AUCOMP[year] - 1) + 1 + self.BF.AIPD[year] = ratio * abs(self.BF.AIPD[year] - 1) + 1 + def increment_year(self): self._current_year += 1 self.FLPDYR += 1