/India-SequentiaLogit

Bayesian semiparametric modelling of contraceptive behaviour in India via sequential logistic regressions

Primary LanguageRMIT LicenseMIT

Bayesian semiparametric modelling of contraceptive behaviour in India via sequential logistic regressions

This repository is associated with the paper Rigon, Durante and Torelli (2017). Bayesian semiparametric modelling of contraceptive behavior in India via sequential logistic regressions, and aims at providing detailed materials to fully reproduce the analyses in the paper. A Shiny application is also made available to interactively visualize relevant quantities of direct interest for current family planning policies in India.

The documentation is organized in four sections described below.

  • data-cleaning.md: contains detailed guidelines and code to download the raw data, and perform preliminary operations to clean the dataset.
  • estimation.md: contains detailed guidelines and code to perform posterior computation for the model presented in Section 2 of the paper, and the associated sub-models described in Section 4. Some convergence diagnostics for the MCMC chains are also discussed.
  • results.md: contains detailed guidelines and code to reproduce the graphs and tables in Section 4, where posterior inference under the proposed model is performed.
  • predictive_pref.md: contains detailed guidelines and code to study out-of-sample predictive performance, and compare results with relevant competitors.

These sections should be executed in order. Note also that all the above analyses are performed with a MacBook Pro (OS X El Capitan, version 10.11.6), using a R version 3.3.2.

In the repository we also made available the file core_functions.R which contains the core functions, such as the Gibbs sampling algorithm described in detail in Section 3 of the paper. The file glossary.pdf contains a conversion table for the variables defined in the file core_functions.R, using the same notation of the paper.

Shiny application

We also provide a Shiny application in which, for every combination of covariates characterizing the different women profiles, the posterior probabilities of the corresponding contraceptive preferences, and the sequential probabilities in Figure 1, are computed. The characteristics of each woman (e.g. age, child, etc.) can be defined interactively by the user.

The application relies on three R packages: shiny, shinydashboard and ggplot2. If not already available, these packages should be installed using the R function install.packages(). Once these packages are installed, the Shiny application can be launched by executing the following R code.

# # Command required to install the necessary packages
# install.packages("shiny")
# install.packages("shinydashboard")
# install.packages("ggplot2")

shiny::runGitHub("India-SequentiaLogit","tommasorigon", subdir = "SequentiaLogisticApp")