How amrit-sarker/bdhs2022-contraceptive-use-analysis works
1. Repository purpose
This is a single-purpose statistical analysis project, not an application or service. Its main job is to turn a cleaned BDHS 2022 fertility dataset into a narrated research report about contraceptive use among Bangladeshi women aged 15–49.
2. Primary artifacts and roles
The repo has three layers of the same analysis: the source Quarto document, the raw R script, and the rendered PDF. The .qmd file is the main authored analysis narrative, the .R file is the executable script version, and the .pdf is the compiled report output.
3. Data boundary
fertility.csv is the only bundled analysis dataset. It represents a cleaned, derived extract from the BDHS 2022 survey. The original DHS IR file is intentionally not included, so the repo’s data boundary is the cleaned CSV rather than the raw survey source.
4. Ingestion and preparation
The analysis begins by loading fertility.csv into R. From there, the data is prepared into variables suitable for descriptive summaries, grouped comparisons, and regression modeling. The repo implies a controlled preprocessing step already happened before this repository, since the dataset is described as cleaned.
5. Exploratory analysis subsystem
A large part of the workflow is EDA: distributions of total children and age at first birth, boxplots by education/wealth/division, and bar charts for contraceptive use. This subsystem is primarily visual and is used to reveal patterns before formal testing.
6. Statistical testing subsystem
The project includes chi-square tests to evaluate associations between contraceptive use and socio-demographic factors such as education, wealth, residence, and division. This is the inferential boundary between simple visualization and statistically supported claims.
7. Modeling subsystem
A logistic regression model is used to estimate the relationship between contraceptive use and predictors like age, education, wealth, residence, and division. This serves as the multivariable layer that checks whether observed bivariate patterns persist when factors are considered together.
8. Trend analysis subsystem
There is a dedicated age-trend analysis that smooths contraceptive use across age, showing a rise into the mid-30s and then decline. This is distinct from the grouped summaries because it emphasizes continuous age behavior rather than categorical comparisons.
9. Reporting and publication layer
The .qmd file is the reporting surface that combines prose, code, charts, and statistical output into a coherent narrative. Rendering produces the PDF deliverable, which is the final shareable artifact for readers.
10. Technology and tooling boundary
The project is centered on R and Quarto, with tidyverse-style data work and ggplot2-based visualization. haven is listed because the broader workflow likely touches DHS-originated survey data formats, even though the repo ships with a cleaned CSV instead of the original file.
11. End-to-end data flow
The overall flow is: survey-derived data in fertility.csv → analysis code in R/Quarto → descriptive plots and statistical tests → logistic regression and age trend interpretation → rendered PDF report. There is no backend, database, or interactive UI; the architecture is a reproducible offline analysis pipeline.
12. What to draw in an architecture diagram
A good diagram would show one input dataset feeding a single analysis/reporting pipeline, then branching into EDA, hypothesis testing, and regression, all recombined into one authored Quarto report and one PDF output. The key boundaries are the external DHS source, the cleaned local CSV, and the rendered publication artifact.
Main entry points: bdhs2022-contraceptive-analysis.qmd Quarto report · fertility.csv fertility.csv · bdhs2022-contraceptive-analysis.R R script · bdhs2022-contraceptive-analysis.pdf PDF report
Components 10
Data input
Cleaned analysis dataset bundled with the repo.
- fertility.csv · Derived BDHS 2022 fertility extract used as the analysis input.
fertility.csv
Analysis workflow
R/Quarto analysis steps for exploration, testing, modeling, and trend analysis.
- R script · Script version of the report logic for reproducing the analysis steps.
bdhs2022-contraceptive-analysis.R - Data prep · Loads the cleaned CSV and shapes variables for summaries, comparisons, and modeling.
- Exploration · Summaries and plots for children, age at first birth, and contraceptive use patterns.
- Chi-square tests · Association tests for contraceptive use versus socio-demographic factors.
- Logistic model · Estimates contraceptive use against age, education, wealth, residence, and division.
- Age trend · Continuous age-pattern analysis showing contraceptive use changes across age.
Reporting
Authored narrative and rendered publication artifacts.
- Quarto report · Main authored document combining prose, code, figures, and statistical output.
bdhs2022-contraceptive-analysis.qmd - PDF report · Final shareable report generated from the Quarto source.
bdhs2022-contraceptive-analysis.pdf - Report build · Combines analysis outputs into the final narrative publication.
Connections 12
- fertility.csv → Data prep: load · Read the cleaned fertility dataset into R.
- Data prep → Exploration: summarize · Produce descriptive summaries and charts.
- Data prep → Chi-square tests: compare · Cross-tabulate contraceptive use against socio-demographic factors.
- Data prep → Logistic model: fit · Use prepared variables in logistic regression.
- Data prep → Age trend: smooth · Analyze contraceptive use across age as a continuous trend.
- Exploration → Quarto report: embed · Insert figures and descriptive findings into the narrative.
- Chi-square tests → Quarto report: report · Document inferential results and significance claims.
- Logistic model → Quarto report: report · Present multivariable regression results in the report.
- Age trend → Quarto report: interpret · Add age-pattern interpretation to the narrative.
- Quarto report → Report build: render · Quarto compiles the authored source into a publication artifact.
- R script → Data prep: mirror · Executable script mirrors the report's analysis workflow.
- Report build → PDF report: output · Generate the final PDF deliverable.