Income API
- class minos.modules.income.Income[source]
- calculate_income(pop)[source]
Calculate income transition distribution based on provided people/indices
- Parameters:
pop (PopulationView) – Population from MINOS to calculate next income for.
- Returns:
nextWaveIncome – Vector of new household incomes from OLS prediction.
- Return type:
pd.Series
- calculate_income_rateofchange(pop)[source]
Calculate income transition with rate of change (diff) models
- Parameters:
pop (PopulationView) – Population from MINOS to calculate next income for.
- Returns:
nextWaveIncome – Dataframe of new predicted hh_income value and difference from previous year.
- Return type:
pd.Dataframe
- on_initialize_simulants(pop_data)[source]
Initiate columns for hh_income when new simulants are added. Only column needed is the diff column for rate of change model predictions.
- Parameters:
pop_data (vivarium.framework.population.SimulantData)
frame. (Custom vivarium class for interacting with the population data)
creation_time (It is essentially a pandas DataFrame with a few extra attributes such as the)
:param : :param creation_window: :param and current simulation state (setup/running/etc.).:
- on_time_step(event)[source]
Predicts the hh_income for the next timestep.
- Parameters:
event (vivarium.population.PopulationEvent) – The event time_step that called this function.
- plot(pop, config)[source]
Default plot method for modules. Does nothing.
Modules can specify another plot object that saves distributions of state.
- Parameters:
pop_data (population data from vivarium. Whatever columns needs plotting.)
config (vivarium.configTree) – Config yaml for any needed plot parameters.
- Return type:
None
- setup(builder)[source]
Initialise the module during simulation.setup().
Notes
Load in data from pre_setup
Register any value producers/modifiers for income
Add required columns to population data frame
Update other required items such as randomness stream.
- Parameters:
builder (vivarium.engine.Builder) – Vivarium’s control object. Stores all simulation metadata and allows modules to use it.