Skip to content
Proyek

Tentang

Streamline a data analysis process. A book on data analysis, causal inference, and econometrics, written for readers with little to no prior background who want to develop both statistical intuition and practical R skills.

Pembelajaran mesin

Cara angka ini diukur

Pertumbuhan bintang terukur

dalam 24 jam
0
dalam 7 hari
Mengumpulkan riwayat
dalam 15 hari
Mengumpulkan riwayat
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

A Guide on Data Analysis

Read online Springer DOI License: CC BY-NC-SA 4.0 Made with bookdown R

GitHub stars Last commit Issues Contributions welcome

A Guide on Data Analysis logo

A book on data analysis, causal inference, and econometrics, written for readers with little to no prior background who want to develop both statistical intuition and practical R skills. The print edition is published by Springer Cham as a four-volume series, and this repository hosts the open online edition that the print volumes are drawn from.

Read it online: https://mike-data-analysis.share.connect.posit.cloud/

What the book covers

The online edition runs from descriptive statistics through inference, regression, and causal inference, with a strong emphasis on the methods that have come to define modern empirical practice.

  • Foundations: descriptive statistics, basic inference, hypothesis testing, sampling, ANOVA.
  • Regression: OLS, GLS, MLE, penalized, robust, partial least squares.
  • Generalized linear and mixed models: logistic, count, hierarchical.
  • Modeling workflow: variable transformation, imputation, model specification, variable selection.
  • Effects and decomposition: marginal effects, moderation, mediation, prediction vs. estimation.
  • Causal inference: difference-in-differences with the modern staggered estimators (Goodman-Bacon, Callaway-Sant'Anna, Sun-Abraham, de Chaisemartin-D'Haultfoeuille, Borusyak-Jaravel-Spiess), regression discontinuity (incl. rdrobust), interrupted time series, synthetic control, synthetic DiD, changes-in-changes, event studies, instrumental variables (incl. examiner designs and proxies), matching, and DAGs.
  • Sensitivity and robustness: specification curves, Oster coefficient stability, Cinelli-Hazlett robustness value (sensemakr), Rosenbaum bounds.
  • Workflow and reporting: experimental design, EDA, reproducibility, synthetic data, HPC.

Table of contents

The book is organized into five parts plus an appendix. This section is auto-generated by tools/build-toc.R on every push — do not edit by hand.

Part I. Foundations

  1. Prerequisites
  2. Descriptive Statistics
  3. Basic Statistical Inference

Part II. Regression

  1. Linear Regression
  2. Non-Linear Regression
  3. Generalized Linear Models
  4. Discrete Choice and Limited Dependent Variables
  5. Tweedie Regression
  6. Linear Mixed Models
  7. Nonlinear and Generalized Linear Mixed Models
  8. Nonparametric Regression
  9. Quantile Regression and Distributional Methods

Part III. Ramifications

  1. Data
  2. Time Series Analysis
  3. Variable Transformation
  4. Imputation (Missing Data)
  5. Model Specification Tests
  6. Variable Selection
  7. Hypothesis Testing
  8. Marginal Effects
  9. Moderation
  10. Mediation
  11. Prediction and Estimation

Part IV. Causal Inference

  1. Causal Inference
  • A. Experimental Design
  1. Experimental Design
  2. Interference and Spillover Effects
  3. Sampling
  4. Survey and Response Quality
  5. Analysis of Variance
  6. Multivariate Methods
  • B. Quasi-Experimental Design
  1. Quasi-Experimental Methods
  2. Regression Discontinuity
  3. Temporal Discontinuity Designs
  4. Synthetic Difference-in-Differences
  5. Difference-in-Differences
  6. Changes-in-Changes
  7. Synthetic Control
  8. Event Studies
  9. Instrumental Variables
  10. Matching Methods
  11. Machine Learning for Causal Inference
  12. Uplift Modeling and Heterogeneous Treatment Effects
  13. Text as Data and NLP for Causal Inference
  • C. Other Concerns
  1. Endogeneity
  2. Biases
  3. Directed Acyclic Graphs
  4. Controls

Part V. Miscellaneous

  1. Reporting Your Analysis
  2. Exploratory Data Analysis
  3. Sensitivity Analysis and Robustness Checks
  4. Replication and Synthetic Data
  5. Differential Privacy
  6. High-Performance Computing
  7. Clustered and Robust Inference

Part VI. Structural Econometrics

  1. Estimation Methods for Structural Models
  2. Structural Econometrics and Demand Estimation
  3. Dynamic Discrete Choice
  4. Dynamic Games
  5. Structural Models of Selection and Unobserved Heterogeneity
  6. Production Functions and Productivity
  7. Frontier and Efficiency Analysis
  8. Markups, Market Power, and Mergers
  9. Demand Systems
  10. Structural Models of Auctions
  11. Machine Learning and AI for Structural Estimation
  12. Structural Models in Marketing
  13. Branding and Brand Equity
  14. Structural Models in Finance

Appendix

A. Appendix B. Bookdown cheat sheet

Print edition (Springer Cham, 2025)

The book is published in four volumes by Springer Cham:

Volume Title Identifier
1 Foundations of Data Analysis DOI 10.1007/978-3-032-01858-8
2 Regression Techniques for Data Analysis ISBN 978-3-032-01834-2
3 Advanced Modeling and Data Challenges ISBN 978-3-032-01718-5
4 Experimental Design ISBN 978-3-032-01838-0

How to cite

Nguyen, M. (2025). Foundations of Data Analysis (Vol. 1). Springer Cham. https://doi.org/10.1007/978-3-032-01858-8

@book{Nguyen2025Vol1,
  author    = {Nguyen, Mike},
  title     = {Foundations of Data Analysis},
  volume    = {1},
  year      = {2025},
  publisher = {Springer Cham},
  doi       = {10.1007/978-3-032-01858-8}
}

Citation entries for Volumes 2 to 4 are listed in the preface of the online edition.

Building locally

The book is built with bookdown and renders to HTML (gitbook), PDF (LuaLaTeX), and EPUB.

install.packages(c("bookdown", "rmarkdown"))
bookdown::render_book(input = "index.Rmd")

The PDF route requires a working LaTeX installation with LuaLaTeX. On Windows, TinyTeX or MiKTeX both work; on macOS, MacTeX; on Linux, TeX Live.

The repo uses renv for package version pinning. After cloning, run renv::restore() to recreate the package environment used by the book.

Deploying the online edition

The online edition is the bs4_book HTML in _book/. The same files are published to two hosts:

  • GitHub Pages (https://mikenguyen13.github.io/data_analysis/, branch gh-pages) is the canonical copy that search engines index.
  • Posit Connect Cloud (https://mike-data-analysis.share.connect.posit.cloud/) keeps serving readers who arrive there, including every old bookdown.org link, which Posit redirects there.

Google indexes almost nothing on share.connect.posit.cloud: in Nov 2026, Search Console showed 1 of 161 pages indexed. So every page carries <link rel="canonical"> pointing at GitHub Pages. After rendering, run both pre-deploy steps from the repo root, then deploy _book/ to both hosts:

bookdown::render_book("index.Rmd", output_format = "bookdown::bs4_book")
source("gen_sitemap_posit.R")   # llms.txt, redirect stubs -> _book/
system("Rscript redirects/set_canonical_host.R _book https://mikenguyen13.github.io/data_analysis/")
#   canonical links, og:url, JSON-LD, sitemap.xml, robots.txt, .nojekyll
rsconnect::deployApp(appDir = "_book", appId = "019b4ef3-ffbb-c7d8-9465-334d7a28631e",
                     account = "mike", server = "connect.posit.cloud", contentCategory = "site")

Then publish the same _book/ to GitHub Pages as a single-commit orphan gh-pages branch. Leave out _book/rsconnect/. The .nojekyll file must be included, or GitHub Pages drops libs/ and the *_files/ folders. A force-push is fine here: gh-pages holds only the built site, and nothing else depends on its history.

Do not skip gen_sitemap_posit.R. Besides the sitemap, it copies the redirect stubs in redirects/ into _book/. The book moved from bookdown.org to Posit Connect Cloud in May 2026, and many chapter filenames changed. Each stub is a small HTML page (meta refresh, canonical link and location.replace) that sends an old bookdown.org filename to its new page or section. Without them, the old URLs that search engines still rank return 404, which is what cut traffic by about three quarters before the stubs went live.

  • redirects/redirect_map.json is the source of truth: old filename -> to (new page, optionally #section), plus how it was matched and the old title.
  • redirects/stubs/*.html are generated from the map and committed. After editing the map, regenerate them with Rscript redirects/build_redirects.R stubs.
  • A stub never overwrites a page the render produced. If a chapter later reuses an old filename, the real page wins and the pre-deploy step prints a warning. It also warns when a stub points at a page missing from _book/.
  • Stubs are kept out of sitemap.xml.

Repository layout

.
├── index.Rmd               # title page and preface
├── 02-50*.Rmd              # numbered chapters
├── _bookdown.yml           # book configuration
├── _output.yml             # output formats (gitbook, PDF, EPUB, bs4_book)
├── preamble.tex            # LaTeX preamble for the PDF build
├── *.bib                   # bibliographies (book.bib, references.bib, packages.bib, references1.bib)
├── images/                 # figures and cover art
├── data/                   # datasets used in examples
├── renv/, renv.lock        # pinned package environment
├── gen_sitemap_posit.R     # pre-deploy step (sitemap, site files, redirect stubs)
├── redirects/              # old bookdown.org URL -> new page map and generated stubs
└── _book/                  # rendered output (git-ignored)

Files prefixed with _ (e.g., _06.01-...) are draft fragments not included in the live book.

Errata

Spotted an error or have a suggestion? Please open an issue on this repository.

Author

Mike Nguyen, mikenguyen.netlify.app, GitHub @mikenguyen13.

License

The online edition is released under CC BY-NC-SA 4.0. The print editions of Volumes 1 to 4 published by Springer Cham (2025) are not covered by this license; all rights to the print editions are reserved by the publisher. See LICENSE for the full notice.

Jelajahi proyek terkait

Memuat…