Skip to content

Commit

Permalink
Merge pull request #34 from john-p-ryan/main
Browse files Browse the repository at this point in the history
Add kreg bw option
  • Loading branch information
jdebacker authored Feb 9, 2025
2 parents 305c52f + bd68572 commit 57f417f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions iot/inverse_optimal_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __init__(
kde_bw=None,
mtr_smoother="kreg",
mtr_smooth_param=1000,
kreg_bw=[120_000],
):
# keep the original data intact
self.data_original = data.copy()
Expand Down Expand Up @@ -75,7 +76,7 @@ def __init__(
self.eti = eti_spl(self.z)
# compute marginal tax rate schedule
self.mtr, self.mtr_prime = self.compute_mtr_dist(
data, weight_var, income_measure, mtr_smoother, mtr_smooth_param
data, weight_var, income_measure, mtr_smoother, mtr_smooth_param, kreg_bw
)
# compute theta_z, the elasticity of the tax base
self.theta_z = 1 + ((self.z * self.f_prime) / self.f)
Expand Down Expand Up @@ -108,7 +109,7 @@ def df(self):
return df

def compute_mtr_dist(
self, data, weight_var, income_measure, mtr_smoother, mtr_smooth_param
self, data, weight_var, income_measure, mtr_smoother, mtr_smooth_param, kreg_bw
):
"""
Compute marginal tax rates over the income distribution and
Expand Down Expand Up @@ -150,7 +151,7 @@ def compute_mtr_dist(
binned_data[income_measure].dropna(),
var_type="c",
reg_type="ll",
bw=[mtr_smooth_param * 40_000],
bw=kreg_bw,
)
mtr, _ = mtr_function.fit(self.z)
mtr_prime = np.gradient(mtr, self.z, edge_order=2)
Expand Down
4 changes: 3 additions & 1 deletion iot/iot_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def __init__(
dist_type="log_normal",
kde_bw=None,
mtr_smoother="kreg",
mtr_smooth_param=4,
mtr_smooth_param=1000,
kreg_bw=[120_000]
):
self.income_measure = income_measure
self.weight_var = weight_var
Expand Down Expand Up @@ -111,6 +112,7 @@ def __init__(
kde_bw=kde_bw,
mtr_smoother=mtr_smoother,
mtr_smooth_param=mtr_smooth_param,
kreg_bw=kreg_bw,
)
)

Expand Down

0 comments on commit 57f417f

Please sign in to comment.