src

Submodules

src.CalSim

class src.CalSim.CalSim(path_dict=None, policy_dict=None, params_dict=None, cal_levers_dict=None, policy_levers_dict=None, system_sheet=None, general_dict=None)[source]

Bases: object

cleanup()[source]

function that resets certain variables after each year

grow_reg_pop(year)[source]

inflates the population for the simulated year self.pop0 describes population for all ages and self.pop1 for population of < 65

grow_statewide_pop(year)[source]
policy_on_curr_firm(wide_data, firm_id, cols_2_keep=None)[source]
premium_loop(xc_prem, worker_table, fam_table, prev_offer, individual_mandate)[source]

loop that calculates premium for ESI plans

propagate_fpl_changes(hieu_df, fam_df, worker_df, esi_df, affordability_type)[source]
simulate_year(year, worker_table, fam_table, which_exp_to_use)[source]

simulation for the given year passing a copy of Worker, and Family down stream

start_simulation()[source]

high level method hook to start simulation

wage_total(worker_table, firm_id, full_time)[source]

parameters: firm_id: current firm; full_time: True/False calculating full time wages effect: none output: total wages for either full time or part time workers

src.FamilyTable

class src.FamilyTable.Family(*args, **kwargs)[source]

Bases: pandas.core.frame.DataFrame

update_income()[source]

function updates income according to changes in wage or hrs/week

src.FirmChoice

class src.FirmChoice.FirmChoice(family_table, worker_table, curr_choice, curr_esi, c_offer, rtio, prem_df)[source]

Bases: object

FirmChoice: Contains firm specific data. Implements OOP patterns.

get_c_offer()[source]
get_curr_choice()[source]
get_curr_esi()[source]
get_family_table()[source]
get_prem_df()[source]
get_rtio()[source]
get_worker_table()[source]
set_c_offer(new_data)[source]
set_curr_choice(new_data)[source]
set_curr_esi(new_data)[source]
set_family_table(new_data)[source]
set_prem_df(new_data)[source]
set_rtio(new_data)[source]
set_worker_table(new_data)[source]

src.FirmTable

class src.FirmTable.Firm(*args, **kwargs)[source]

Bases: pandas.core.frame.DataFrame

firm_cost()[source]

output: total cost of choice

src.HieuTable

class src.HieuTable.Hieu(hieu_table, ind_parms=None)[source]

Bases: object

build_long_calib_table(expnd_choices, pop_df, firm_df, calib_flag, debug)[source]
in:

expnd_choices - wide data with individual choices or utility parameters calib_flag - 1 is default choice and 2 should be all choices!

effect:

updates self.long_calib_table with unique utility parameters per unique choice and individual

static choose_choice(x)[source]
classmethod esi_expand(choice_hieu, wrk_df, pop_df, temp_firm, Curr_esi)[source]

choice_types are choice_types = [‘adult_1’, ‘adult_2’, ‘child_1’, ‘child_2’,’adult_child_1’, ‘adult_child_2’,’adult_child_3’, ‘adult_child_4’] corresponding to indices 0 1 2 3 4 5 6 7

Curr_esi.columns.values=[‘index’ ‘av_value’ ‘ch’ ‘choice’ ‘contr_p_ch’ ‘contr_p_fam’ ‘contr_p_self’

‘contr_p_sp’ ‘firm_id’ ‘oop_ch’ ‘oop_ch_actual’ ‘oop_fam’ ‘oop_fam_actual’ ‘oop_self’ ‘oop_self_actual’ ‘oop_sp’ ‘oop_sp_actual’ ‘plan_id’ ‘premium_ch’ ‘premium_ch_actual’ ‘premium_fam’ ‘premium_fam_actual’ ‘premium_self’ ‘premium_self_actual’ ‘premium_sp’ ‘premium_sp_actual’ ‘pt’ ‘sp’]

the goal is to link plan_id with each policy holder, when the person is eligible for the plan

esi_premium(choices, esi, esi0, family_table, firm_table, worker_table)[source]
get_choices()[source]
get_hieu_table()[source]
get_long_calib_table()[source]
get_pop_hieu()[source]
income_adjuster(premium, income, income_adjuster)[source]
individual_behavior(Curr_esi, Esi_0, xc_prem, individual_mandate, family_table, worker_table, firm_table, income_adjuster)[source]
make_pop_df(firm, Curr_esi, family_table, worker_table)[source]
Input:
  1. firm id

  2. current esi

  3. family table

Output:
  1. worker table

  2. pop_df: a small version of hieu_table with family income and family_size

choice_types = [‘adult_1’, ‘adult_2’, ‘child_1’, ‘child_2’, ‘adult_child_1’, ‘adult_child_2’, ‘adult_child_3’, ‘adult_child_4’]

static plan_details(final_choice_df, firm, Curr_esi, choice_types, ab_choice)[source]
input: choice_table after utility

current firm of interest

return:
  1. number of people by plan_id and by plan_type (self, sp, ch and fam)

  2. number of policy holders by plan_id and by plan_type (self, sp, ch and fam)

  3. total expenditure by plan_id and by plan_type (self, sp, ch and fam)

  4. AV value of the plans

set_choices(new_data)[source]
set_hieu_table(new_data)[source]
set_long_calib_table(new_data)[source]
set_pop_hieu(new_data)[source]
set_utility(ind_parms)[source]

src.WorkerTable

class src.WorkerTable.Worker(*args, **kwargs)[source]

Bases: pandas.core.frame.DataFrame

adjust_hours(x, y, match)[source]

takes matched worker (x) and (y) and returns adjusted hours; (x) workers are between either 30 and 32.5 or 32.5 and 35; (x) workers will either receive or donate enough hours to get out of 35, weighted allowing

match_adjust(x, y)[source]

x is the index for the workers working from either 30 to 32.5 or 32.5 to 35 y is the index for the workers working under 30 hours or above 35 df is a shallow copy (pointer) of the WorkerTable instance

match_wage(a, b, thresh=0.1)[source]

take two pandas series of wages and determine the matching index of series b within a given threshold

reduce_wkr_hours(firm)[source]

reallocates hours to minimize the number of workers that work between 30 and 35 hrs/wk

Module contents