Datasets
The data behind every In R box in the book: 17 files, 2,336 rows in all.
These are synthetic teaching data. No row describes a real person, child, woman, household, village or district; names such as “District A” and “PHC Urban”, and every ID, are invented. Several are built so that the model in the book gives the numbers printed there.
How to use them
Unzip so that the folder data sits in your R working directory. The book's code then runs as printed:
cl <- read.csv("data/clinic_children.csv")Or read a file straight from this site, without downloading it:
cl <- read.csv("https://drharshmaheshwari.com/doctors/books/statistics-first-principles-to-regression/data/clinic_children.csv")Empty cells are missing values (NA in R). The files have no comment lines.
The files
bp_methods.csv30 rowsRead in §16.3
3 columns
adult_id, sbp_mercury, sbp_digital
cbhi_survey.csv500 rowsRead in §7.2, §8.5, §9.3, §10.2, §10.4, §10.6, §13.2, §13.3, §15.1, §15.2, §15.3, §15.4, §15.5
12 columns
hh_id, village_id, distance_km, wealth_index, maternal_education, household_size, cbhi_member, facility_use_past_month, child_sick_2wk, sought_formal_care, reason_not_joining, satisfaction_1to5
clinic_children.csv100 rowsRead in §1.6, §7.2, §9.2, §9.3, §9.5, §11.2, §11.3, §12.2, §12.4, §12.5, §13.1
11 columns
child_id, seen_today, arrival_order, age_months, sex, weight_kg, height_cm, nutritional_status, diarrhoea_episodes_month, wealth_quintile, maternal_education
cohort_dropout.csv300 rowsRead in §14.4, §14.5, §14.6, §14.7, §14.8
7 columns
hh_id, intervention, income_k, distance_km, time_months, dropout, censor_reason
ebf_diarrhoea_cohort.csv200 rowsRead in §8.7, §9.1, §10.6, §11.7, §17.3
4 columns
infant_id, phc, not_ebf, diarrhoea
journey_mlr.csv240 rows5 columns
child_id, age_months, sex, wealth_index, weight_kg
kappa_anaemia.csv100 rowsRead in §16.3
3 columns
patient_id, rater_A, rater_B
km_eight.csv8 rowsRead in §14.4
3 columns
member_id, time_months, dropout
lifetable_district.csv7 rowsRead in §7.5
4 columns
age_start, age_end, midyear_pop, deaths
malaria_villages.csv10 rowsRead in §13.5
4 columns
village, near_water, population, cases
matched_casecontrol.csv160 rows3 columns
pair_id, case, not_ebf
meta_three_trials.csv3 rowsRead in §15.7
5 columns
study, events_int, n_int, events_ctl, n_ctl
nfhs_extract.csv640 rowsRead in §15.2
9 columns
woman_id, stratum, district, residence, psu, weight, age, education, anaemic
paired_hb_ifa.csv10 rowsRead in §9.2
3 columns
id, hb_before, hb_after
pps_villages.csv10 rows§6.2.6 PPS worked list
2 columns
village, population
sign_test_hb.csv12 rows3 columns
woman_id, hb_before, hb_after
Read in §7.4
7 columns
age_group, popA, deathsA, popB, deathsB, std_pop, std_rate_per1000
How they were built
make_data.R is the script that wrote them, with a fixed random seed for each dataset, so the files can be rebuilt exactly (about three minutes in R; it needs the survival package). Its header explains how the engineered datasets were made. One file, paired_hb_ifa.csv, is a ten-row table typed by hand.
Licence
The same as the book: CC BY-NC-SA 4.0. Free to copy, share and adapt for non-commercial use, with credit, under the same licence. If they help you, you can support this project.