Skip to content

Commit

Permalink
remove unneeded files
Browse files Browse the repository at this point in the history
  • Loading branch information
vahid-ahmadi committed Oct 15, 2024
1 parent bda40f6 commit 9661d65
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
7 changes: 3 additions & 4 deletions docs/streamlit/pages/Capital_Gains_Tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
/ "imputations"
/ "capital_gains_distribution_advani_summers.csv.gz"
)
capital_gains["maximum_total_income"] = (
capital_gains.minimum_total_income.shift(-1).fillna(np.inf)
)
capital_gains[
"maximum_total_income"
] = capital_gains.minimum_total_income.shift(-1).fillna(np.inf)
# Fit a spline to each income band's percentiles
from scipy.interpolate import UnivariateSpline

Expand Down Expand Up @@ -119,7 +119,6 @@ def impute_capital_gains(total_income: float) -> float:
)

with st.expander("Capital gains imputation test runner"):

income = st.slider("Total income", 0, 500000, 50000, 1000)

with st.spinner("Imputing capital gains..."):
Expand Down
1 change: 0 additions & 1 deletion policyengine-core
Submodule policyengine-core deleted from 3fc430
27 changes: 17 additions & 10 deletions policyengine_uk/utils/solve_private_school_attendance_factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,30 @@

# Initialize variables to track the best private_school_factor and its result
best_factor = None
smallest_difference = float('inf')
smallest_difference = float("inf")

# Loop over values of private_school_factor from 0.7 to 0.8 in steps of 0.01
for factor in [round(x * 0.01, 2) for x in range(70, 81)]:
# Define the reform with the current private_school_factor value
reform = Reform.from_dict({
"gov.contrib.labour.private_school_vat": {
"2024-01-01.2100-12-31": 0.2
reform = Reform.from_dict(
{
"gov.contrib.labour.private_school_vat": {
"2024-01-01.2100-12-31": 0.2
},
"gov.simulation.private_school_vat.private_school_factor": {
"2024-01-01.2100-12-31": factor
},
},
"gov.simulation.private_school_vat.private_school_factor": {
"2024-01-01.2100-12-31": factor
}
}, country_id="uk")
country_id="uk",
)

# Run the reformed microsimulation
reformed = Microsimulation(reform=reform)

# Calculate the number of students attending private school in thousands
private_school_attendance = reformed.calculate("attends_private_school", period=2025).sum() / 1e3
private_school_attendance = (
reformed.calculate("attends_private_school", period=2025).sum() / 1e3
)

# Compare the result with 550 and track the best value
difference = abs(private_school_attendance - 550)
Expand All @@ -30,5 +35,7 @@
best_factor = factor

# Report the best private_school_factor
print(f"The best private_school_factor is {best_factor} with a difference of {smallest_difference}")
print(
f"The best private_school_factor is {best_factor} with a difference of {smallest_difference}"
)
# The best private_school_factor is 0.77 with a difference of 1.3427231160653719
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ def formula(person, period, parameters):
ps_vat_params.private_school_attendance_rate
)

population_adjustment_factor = (
ps_vat_params.private_school_factor
)
population_adjustment_factor = ps_vat_params.private_school_factor

person = household.members

Expand Down
Empty file removed private_school_VAT.ipynb
Empty file.

0 comments on commit 9661d65

Please sign in to comment.