Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kreg bw option #34

Merged
merged 3 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading