Skip to content

Commit

Permalink
synth data
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamstark committed Aug 27, 2024
1 parent 08af1b2 commit f20bcab
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions test/ubi_tests.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
using Test
using ScottishTaxBenefitModel
using Observables
using .HealthRegressions
using .ModelHousehold: count,Household, le_age, ge_age
using .GeneralTaxComponents: RateBands, WEEKS_PER_YEAR, WEEKS_PER_MONTH

using .Results: aggregate!, init_household_result
using ScottishTaxBenefitModel.Runner: do_one_run
using .Intermediate: MTIntermediate, make_intermediate
using .UBI: calc_UBI!,make_ubi_post_adjustments!
using .STBParameters
using .STBIncomes
using .ExampleHelpers
using .Monitor: Progress
using .RunSettings
sys = get_system( year=2019, scotland=true )
sys.ubi.abolished = false

Expand Down Expand Up @@ -172,21 +172,22 @@ end
"""
"""
#=
recreate base numbers for Conjoint paper revisions
=#
@testset "Conjoint Base Case " begin
settings = get_all_uk_settings_2023()
settings.do_marginal_rates = false
settings.requested_threads = 4
settings.means_tested_routing = uc_full
settings.do_health_esimates = true
# settings.ineq_income_measure = bhc_net_income # FIXME TEMP

"""
load 23/4
"""
year = 2023
scotland = false
sys1 = STBParameters.get_default_system_for_fin_year( year, scotland=scotland )
sys1 = STBParameters.get_default_system_for_fin_year( 2023, scotland=false )
sys2 = deepcopy( sys1)
# end function map_features!( tb :: TaxBenefitSystem, facs :: Factors )
sys2.ubi.abolished = false
Expand All @@ -201,7 +202,20 @@ end
sys2.it.non_savings_rates = [0.2, 0.4, 0.45 ]
sys2.ubi.entitlement = ub_ent_all
sys2.ubi.income_limit = -1.0

sys = [sys1,sys2]
make_ubi_pre_adjustments!( sys2 )
summary,results,settings = do_basic_run( settings, sys; reset=true )
health = do_health_regressions!( results, settings )
#=
Base.acquire(HEALTH_SEMAPHORE) do
health = do_health_regressions!( results, settings )
end
=#
∇mental_health = (health[2].depressed-health[1].depressed)/health[1].depressed
∇poverty = summary.poverty[2].headcount - summary.poverty[1].headcount
∇inequality = summary.inequality[2].gini - summary.inequality[1].gini
# println( summary )
∇cost_bn = (summary.income_summary[1][:,:net_cost][2] - summary.income_summary[1][:,:net_cost][1])/1_000_000_000
∇child_poverty_pct = (summary.child_poverty[2].prop - summary.child_poverty[1].prop)*100

end

0 comments on commit f20bcab

Please sign in to comment.