Access to money is vital to day-to-day human survival. But who do we turn to for the cash we need when formal avenues are unavailable, undesirable, or malicious? The evolutionary theory of kin selection and the network theory of multiplexity (i.e., link superimposition) suggest that financial aid will freely flow from friends and family. Yet, economic sociologists theorise that finance is highly context specific such that friendship and kinship need not systematically mix with money. Using Bayesian Dirichlet-Multinomial models and data on 6,052 financial patrons reported by 2,559 adults in 16 Ugandan villages, I show that ≈60% of preferred money lenders are friends and/or kin — where non-friend kin outrank non-kin friends and friends-who-are-kin, with the least-abundant patrons being intimates for whom one is also a source of cash (i.e., reciprocal aid). Roughly 40% of lenders are estimated to be non-kin-who-are-not-friends. Still, models contravene the sociological notion that money is not fungible across relational scenarios as they indicate diverse combinations of friendship and kinship with lending — possibly due to a lack of other viable strategies for securing informal finance amongst the poor.
Figure 1. Parallel-coordinate style plot (common y-axis) of posterior means for
Figure 2. Small multiple of posterior predictive checks for the three Dirichlet-Multinomial models in Fig. 1. Model fit is assessed by comparing the observed frequency of counts (0 to 5) of various types of money lenders across the entire
Enclosed in this repository are six Python scripts in addition to three ".csv" data files, amongst other items. Throughout the scripts, you will find code to carry out the analyses reported in my paper alongside commands used to produce useful print out (e.g., descriptive statistics) and comments that (hopefully) give you insight into the thinking behind the decisions I take.
After you have placed the data files and all Python scripts in the same working directory/folder (see Line 33-34 in "main.py"), installed the necessary Python modules (see again "main.py" for a list of all necessary modules), and set the number of available computing cores for your machine ("main.py", Line 65), you should be able to simply run "main.py", which executes the other scripts, to redo my analysis. This will also carry out all of the goodness-of-fit tests (see "fit_models.py") and generate the figures in the paper using Plotnine — a wonderful Python implementation of R's "ggplot" library.
Finally, when re-running my analysis, some numerical results may differ slightly from those reported in the paper due to stochastic perturbations. I have used the same random seed (20200127) to ensure exact reproducibility wherever possible. However, this is not always an option depending on the function. Also, note that models are fitted in a Bayesian framework using PyMC — i.e., a Python-based probabilistic-programming language. Accordingly, changing the number of CPU cores, which currently also controls the number of Markov chains for each model, could lead to somewhat different results.
-
main.py (Script for Loading Modules and Executing Other Parts of the Analysis)
-
load_data.py (Script for Loading and Filtering Data)
-
build_features.py (Script for the Transformation of Data for Model Fitting)
-
fit_models.py (Script for Writing + Estimating Dirichlet-Multinomial Models with PyMC)
-
visualise_results.py (Script for Visualisation of Results with Plotnine)
-
reported_statistics.py (Script for Extracting Numeric Quantities Reported in the Results Section of My Paper)
-
nodes.csv (Monadic covariates for the individual villagers collected by Ferrali et al. (2020)[2] for their paper in the American Journal of Political Science [2])
-
nodes_CPS_Version_1.2.csv (Dataset of monadic covariates that includes household membership which was used by Ferrali et al. (2021)[3] for their paper in Comparative Political Studies)
-
ties.csv (Sociometric data on lending, kinship, and friendship for the individual villagers collected by Ferrali et al. [2])
-
Ferrali_et_al_2020.pdf [2]
-
Ferrali_et_al_2021.pdf [3]
-
dataverse_files_Ferrali_et_al_AJPS_Version_1 (2019-08-07).zip (Ferrali et al.'s [1] original replication materials)
-
dataverse_files_Ferrali_et_al_CPS_Version_1.2 (2021-06-01).zip (Ferrali et al.'s [2] original replication materials)
[1] Simpson, C.R. In Prep. "The Relational Bases of Informal Financial Cooperation". Working Paper.
[2] Ferrali, R., Grossman, G., Platas, M. R., & Rodden, J. (2020). It Takes a Village: Peer Effects and Externalities in Technology Adoption. American Journal of Political Science, 64(3), 536–553. https://doi.org/10.1111/ajps.12471
[3] Ferrali, R., Grossman, G., Platas, M. R., & Rodden, J. (2021). Who Registers? Village Networks, Household Dynamics, and Voter Registration in Rural Uganda. Comparative Political Studies, 001041402110360. https://doi.org/10.1177/00104140211036048
-
Thank you for your interest in my work! Please do let me know if something goes wrong. I am more than happy to help and you can always email me.
-
Some steps in "visualise_results.py" are slow, namely the calls to the custom/user-defined function "prepare_pymc_trace_for_ppc()". Each call takes a few minutes on my machine (Apple M1 Max; 32GB Ram). This function was written to help transform the posterior predictive samples from PyMC (given as xarray objects) into Pandas dataframes that are suitable for visualisation with Plotnine. Currently, I am still exploring how to speed up the function given the information needed and the large dataframes of posterior samples (n.b., the response variable is 8-dimensional and there are about 2,500 samples/cases, leading to dataframes of substantial size).