People#

class People(pars, n=None, **kwargs)[source]#

Bases: BasePeople

Class for all the people in the simulation.

Attributes

ceil_age

Rounds age up to the next highest integer

inds

Alias to self._inds to prevent accidental overwrite & increase speed

int_age

Return ages as an integer

int_age_clip

Return ages as integers, clipped to maximum allowable age for pregnancy

is_female

Boolean array of everyone female

is_male

Boolean array of everyone male

len_inds

Alias to len(self)

len_people

Full length of People array, ignoring filtering

n

Number of people alive

Methods

update_method()[source]#

Uses a switching matrix from DHS data to decide based on a person’s original method their probability of changing to a new method and assigns them the new method. Currently allows switching on whole calendar years to enter function. Matrix serves as an initiation, discontinuation, continuation, and switching matrix. Transition probabilities are for 1 year and only for women who have not given birth within the last 6 months.

update_method_pp()[source]#

Utilizes data from birth to allow agent to initiate a method postpartum coming from birth by 3 months postpartum and then initiate, continue, or discontinue a method by 6 months postpartum. Next opportunity to switch methods will be on whole calendar years, whenever that falls.

update_methods()[source]#

If eligible (age 15-49 and not pregnant), choose new method or stay with current one

check_mortality()[source]#

Decide if person dies at a timestep

check_partnership()[source]#

Decide if an agent has reached their age at first partnership. Age-based data from DHS.

check_sexually_active()[source]#

Decide if agent is sexually active based either on month postpartum or age if not postpartum. Postpartum and general age-based data from DHS.

check_conception()[source]#

Decide if person (female) becomes pregnant at a timestep.

make_pregnant()[source]#

Update the selected agents to be pregnant

check_lam()[source]#

Check to see if postpartum agent meets criteria for LAM in this time step

update_breastfeeding()[source]#

Track breastfeeding, and update time of breastfeeding for individual pregnancy. Agents are randomly assigned a duration value based on a gumbel distribution drawn from the 2018 DHS variable for breastfeeding months. The mean (mu) and the std dev (beta) are both drawn from that distribution in the DHS data.

update_postpartum()[source]#

Track duration of extended postpartum period (0-24 months after birth). Only enter this function if agent is postpartum

update_pregnancy()[source]#

Advance pregnancy in time and check for miscarriage

reset_breastfeeding()[source]#

Stop breastfeeding, calculate total lifetime duration so far, and reset lactation episode to zero

check_maternal_mortality()[source]#

Check for probability of maternal mortality

check_infant_mortality()[source]#

Check for probability of infant mortality (death < 1 year of age)

check_delivery()[source]#

Decide if pregnant woman gives birth and explore maternal mortality and child mortality

update_age()[source]#

Advance age in the simulation

update_education()[source]#

Step up through all the steps of education dynamics

advance_education()[source]#

Advance education attainment in the simulation, determine if agents have completed their educationm,

start_education()[source]#

Begin education

interrupt_education()[source]#

Interrupt education due to pregnancy. This method hinders education progression if a woman is pregnant and towards the end of the first trimester

resume_education()[source]#

# Basic mechanism to resume education post-pregnancy: # If education was interrupted due to pregnancy, resume after 9 months pospartum () #TODO: check if there’s any evidence supporting this assumption

update_age_bin_totals()[source]#

Count how many total live women in each 5-year age bin 10-50, for tabulating ASFR

track_mcpr()[source]#

Track for purposes of calculating mCPR at the end of the timestep after all people are updated Not including LAM users in mCPR as this model counts all women passively using LAM but DHS data records only women who self-report LAM which is much lower. Follows the DHS definition of mCPR

track_cpr()[source]#

Track for purposes of calculating newer ways to conceptualize contraceptive prevalence at the end of the timestep after all people are updated Includes women using any method of contraception, including LAM Denominator of possible users includes all women aged 15-49

track_acpr()[source]#

Track for purposes of calculating newer ways to conceptualize contraceptive prevalence at the end of the timestep after all people are updated Denominator of possible users excludes pregnant women and those not sexually active in the last 4 weeks Used to compare new metrics of contraceptive prevalence and eventually unmet need to traditional mCPR definitions

update()[source]#

Update the person’s state for the given timestep. t is the time in the simulation in years (ie, 0-60), y is years of simulation (ie, 1960-2010)