From c13ca8ad3a91aa17878fc3f5af4d59c4e52fe1ec Mon Sep 17 00:00:00 2001 From: John Ryan <johnryan6465@gmail.com> Date: Sat, 25 Jan 2025 11:33:18 -0500 Subject: [PATCH] Fix error in gradient --- iot/inverse_optimal_tax.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iot/inverse_optimal_tax.py b/iot/inverse_optimal_tax.py index 9ce432a..ed47ea0 100644 --- a/iot/inverse_optimal_tax.py +++ b/iot/inverse_optimal_tax.py @@ -44,7 +44,7 @@ def __init__( dist_type="log_normal", kde_bw=None, mtr_smoother="kreg", - mtr_smooth_param=3, + mtr_smooth_param=1000, ): # keep the original data intact self.data_original = data.copy() @@ -129,7 +129,7 @@ def compute_mtr_dist( """ if mtr_smoother == "kreg": - bins = 1000 # number of equal-width bins + bins = mtr_smooth_param # number of equal-width bins data.loc[:, ["z_bin"]] = pd.cut( data[income_measure], bins, include_lowest=True ) @@ -151,7 +151,7 @@ def compute_mtr_dist( reg_type="ll", ) mtr, _ = mtr_function.fit(self.z) - mtr_prime = np.gradient(mtr, edge_order=2) + mtr_prime = np.gradient(mtr, self.z, edge_order=2) elif mtr_smoother == "HSV": # estimate the HSV function on mtrs via weighted least squares X = np.log(data[income_measure].values)