Skip to content

Repository files navigation

Quantitative Research Methods — Reproduction Scripts

R scripts that reproduce every computed number, table, and figure in the book Quantitative Research Methods: A Practical Guide with R and SPSS (Dr George Owusu, Department of Geography and Resource Development, University of Ghana).

Each reproduce_chapterNN.R regenerates the results for one chapter. afro_prep.R is a shared helper that loads and cleans the Afrobarometer data identically for every chapter that uses it.

No data is included in this repository. The datasets are freely available from their original sources (see Getting the data below). This keeps the repository light and respects the data providers' terms.

Chapters

Script Chapter Data
afro_prep.R shared loader/cleaner (sourced by the Afrobarometer scripts) Afrobarometer
reproduce_chapter02.R 2 — Variables, Measurement, Visualization Afrobarometer
reproduce_chapter06.R 6 — Descriptives, Correlation, Simple Regression Afrobarometer
reproduce_chapter07.R 7 — Hypothesis Testing Afrobarometer
reproduce_chapter08.R 8 — Composite Scoring & Chi-square Afrobarometer
reproduce_chapter09.R 9 — Multiple / Logistic / Multinomial Regression Gapminder
reproduce_chapter10.R 10 — ANOVA Afrobarometer
reproduce_chapter11.R 11 — Factor Analysis Afrobarometer
reproduce_chapter12.R 12 — Non-Parametric Tests Afrobarometer
reproduce_chapter13.R 13 — The Role of AI in Quantitative Research Methods Afrobarometer

Chapters 1, 3, 4, and 5 are conceptual and involve no computation, so they have no script.

Practicals

The practicals/ folder holds practice exercises for every chapter — concept checks and hands-on data tasks (with different variables from the book's worked examples). See practicals/README.md. Model answers are provided to instructors separately.

Requirements

  • R 4.x
  • R packages: haven, psych, GPArotation, car, nnet, effectsize, FSA, dunn.test, sf, tmap, gapminder. Install with:
install.packages(c("haven","psych","GPArotation","car","nnet","effectsize",
                   "FSA","dunn.test","sf","tmap","gapminder","geodata"))

Getting the data

Afrobarometer Round 9, Ghana (2023) — used by most chapters. Free, no registration: download the SPSS .sav file from https://www.afrobarometer.org/survey-resource/ghana-round-9-data-2023/ (direct file: afrobarometer_release-dataset_gha_r9_en_2023-04-01.sav). Save it somewhere on your machine; you will point the scripts at it (see Running the scripts).

Gapminder — used by Chapter 9 only. No download needed; it ships with the gapminder R package.

Ghana regional boundaries (map in Chapter 2) — no manual download needed. reproduce_chapter02.R fetches Ghana's level-1 boundaries (GADM 4.1) automatically at runtime via the geodata package and caches them under a gis/ sub-folder. (If you already have a local gis/gadm41_GHA_1.json, the script uses that instead.)

Running the scripts

The Afrobarometer scripts expect a variable AFRO_SAV giving the path to your .sav file. Set it before running (edit the path to wherever you saved the file):

AFRO_SAV <- "C:/path/to/afrobarometer_release-dataset_gha_r9_en_2023-04-01.sav"
source("reproduce_chapter08.R")   # or any other chapter

reproduce_chapter09.R (Gapminder) needs no data file — just run it:

source("reproduce_chapter09.R")

Each script prints its results to the console and writes any figures to a figures/ sub-folder.

Reproducibility note

Every result in the book was produced by running these scripts against the real data — nothing was invented. Running a script yourself should reproduce the corresponding numbers in the book exactly.

License

Scripts © 2026 George Owusu. The Afrobarometer and Gapminder datasets remain the property of their respective providers and are used under their own terms.

About

Companion code for "Quantitative Research Methods: A Practical Guide with R and SPSS" — reproducing every number and figure from the book using Afrobarometer Round 9 Ghana data.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages