methods

methods

Contraceptive methods

Idea

A method selector should be a generic class (an intervention?). We want the existing matrix-based method and the new duration-based method to both be instances of this.

Classes

Name Description
RandomChoice Randomly choose a method of contraception
SimpleChoice Simple choice model where method choice depends on age and previous method.
StandardChoice Default contraceptive choice module.

RandomChoice

methods.RandomChoice(pars=None, **kwargs)

Randomly choose a method of contraception

SimpleChoice

methods.SimpleChoice(
    pars=None,
    location=None,
    data=None,
    contra_mod='simple',
    **kwargs,
)

Simple choice model where method choice depends on age and previous method. Uses location-specific data to set parameters, and needs to be initialized with either a location string or a data dictionary.

Attributes

Name Description
method_idx Return list of method indices from the method choice pars

Methods

Name Description
get_prob_use Return an array of probabilities that each woman will use contraception.
set_dur_method Time on method depends on age and method
get_prob_use
methods.SimpleChoice.get_prob_use(uids, event=None)

Return an array of probabilities that each woman will use contraception.

set_dur_method
methods.SimpleChoice.set_dur_method(uids, method_used=None)

Time on method depends on age and method

StandardChoice

methods.StandardChoice(
    pars=None,
    location=None,
    data=None,
    contra_mod='mid',
    **kwargs,
)

Default contraceptive choice module. Contraceptive choice is based on age, education, wealth, parity, and prior use.

Methods

Name Description
get_prob_use Return an array of probabilities that each woman will use contraception.
update_intent_to_use Update intent to use contraception based on regression coefficients
get_prob_use
methods.StandardChoice.get_prob_use(uids, event=None)

Return an array of probabilities that each woman will use contraception.

update_intent_to_use
methods.StandardChoice.update_intent_to_use(uids)

Update intent to use contraception based on regression coefficients

Functions

Name Description
make_contra_pars Shortcut for making a new instance of ContraPars
make_method_list Create methods from a DataFrame.
make_methods Shortcut for making methods

make_contra_pars

methods.make_contra_pars()

Shortcut for making a new instance of ContraPars

make_method_list

methods.make_method_list(methods_df)

Create methods from a DataFrame. Args: methods_df: DataFrame with columns: name, label, csv_name, efficacy, modern, Returns: method_list: List of Method objects

make_methods

methods.make_methods(method_list=None, method_df=None)

Shortcut for making methods