There are many factors that influence women’s decisions about contraceptive use. FPsim 2.0 brings enhancements that incorporate these factors. It also provides users with new flexibility for defining their own logic for how women make contraceptive decisions. We will illustrate some of this functionality in this tutorial.
First, some terminology. All of the logic for how women make contraception decisions is kept within a ContraceptiveChoice module. The default ContraceptiveChoice module within FPsim is StandardChoice. There is also a more detailed EmpoweredChoice module in an analysis repository.
Standard contraceptive choice
This is the default option for how contraceptive decisions are made in FPsim. Under this option, a woman’s decision about whether to use contraception depends on her age, whether or not she has ever used contraception before, her level of education, her wealth quintile, her parity, and her geographical setting (urban/rural). Data on these variables is available from the Demographic and Health Survey (DHS).
The snippet below illustrates how to set up and run a simulation using the StandardChoice module.
# Import FPsim and define the baseline parametersimport fpsim as fplocation ='kenya'pars =dict(location=location, n_agents=500, start_year=1980, end_year=2020, seed=1)# Define the contraceptive choice module and the education module.choice = fp.StandardChoice(location=location)edu = fp.Education(location=location)# Make and run sims = fp.Sim(pars, contraception_module=choice, education_module=edu)s.run()
In the SimpleChoice module, a woman’s decision about whether to use contraception only depends on her age and whether or not she has ever used contraception before. Compared to the StandardChoice module, the SimpleChoice module disregards the influence of women’s education, wealth, parity, and urban/rural status on her contraceptive decisions.
The RandomChoice module is included only for testing purposes. In this module, women choose contraception at random. This module can be useful for sanity checking that the more realistic modules behave as expected.
It is recommended that use of the SimpleChoice and RandomChoice modules is reserved for testing purposes, as the StandardChoice captures more of the factors relevant for contraceptive decision making. Nevertheless, the example below shows how to use the SimpleChoice module. This example can also be considered as a template for anyone wishing to define their own contraceptive choice module.
method_choice = fp.SimpleChoice(location=location)sim = fp.Sim(pars=pars, contraception_module=method_choice, analyzers=fp.lifeof_recorder())sim.run()_ = sim.plot(to_plot='cpr');_ = sim.analyzers[0].plot(index=1);# plot the life events of one woman
NOTE: FPsim 2.0 was specifically designed to support the analyses in the related analysis repository, which address two evolutions in the current family planning research landscape: centering women’s intentions and preferences; and considering the broader impact of family planning on women’s empowerment. This repository also contains more details on how to define a custom contraceptive choice module.
In the next tutorial, you wil learn how to define and run an intervention.