Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and test [Python 3.10, 3.11]
name: Build and test [Python 3.10]

on: [push, pull_request]

Expand All @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
python-version: ["3.10"]

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
with:
activate-environment: iot-dev
environment-file: environment.yml
python-version: 3.11
python-version: "3.10"
auto-activate-base: false

- name: Build # Build Jupyter Book
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
activate-environment: iot-dev
environment-file: environment.yml
python-version: 3.11
python-version: "3.10"
auto-activate-base: false

- name: Build # Build Jupyter Book
Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: iot-dev
channels:
- conda-forge
dependencies:
- python
- "taxcalc>=4.0.0"
- python<3.11
- "taxcalc==4.4.0"
- pandas
- numpy
- scipy
Expand All @@ -15,7 +15,7 @@ dependencies:
- pylint
- coverage
- pip:
- jupyter-book>=0.9.1
- jupyter-book<2.0.0
- black
- plotly-express
- kaleido
Expand Down
20 changes: 6 additions & 14 deletions iot/inverse_optimal_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,7 @@ def mills_ratio(t):
# tails, which can zero out the fitted density and
# poison downstream calculations (theta_z, g_z) with
# infs/NaNs.
return np.sqrt(np.pi / 2) * scipy.special.erfcx(
t / np.sqrt(2)
)
return np.sqrt(np.pi / 2) * scipy.special.erfcx(t / np.sqrt(2))

def pln_pdf(y, mu, sigma, alpha):
x1 = alpha * sigma - (np.log(y) - mu) / sigma
Expand Down Expand Up @@ -336,11 +334,9 @@ def fit_pln(data, weights, initial_guess):

def pln_cdf(y, mu, sigma, alpha):
x1 = alpha * sigma - (np.log(y) - mu) / sigma
CDF = (
st.norm.cdf((np.log(y) - mu) / sigma)
- st.norm.pdf((np.log(y) - mu) / sigma)
* mills_ratio(x1)
)
CDF = st.norm.cdf((np.log(y) - mu) / sigma) - st.norm.pdf(
(np.log(y) - mu) / sigma
) * mills_ratio(x1)
return CDF

def pln_dpdf(y, mu, sigma, alpha):
Expand Down Expand Up @@ -480,14 +476,10 @@ def find_eti(iot, g_z=None, eti_0=0.25, boundary="z0"):
tail_integral = np.append(rev_cumsum, 0.0)

eti_beliefs = (
((1 - iot.mtr) / iot.mtr)
* (1 / (iot.z * iot.f))
* tail_integral
((1 - iot.mtr) / iot.mtr) * (1 / (iot.z * iot.f)) * tail_integral
)
else:
raise ValueError(
f"boundary must be 'z0' or 'inf', got '{boundary}'"
)
raise ValueError(f"boundary must be 'z0' or 'inf', got '{boundary}'")

return eti_beliefs

Expand Down
Loading