# jiajing-sun/regression_with_r_and_python architecture

> Architecture diagram of the GitHub repository jiajing-sun/regression_with_r_and_python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jiajing-sun/regression_with_r_and_python
- Repository: https://github.com/jiajing-sun/regression_with_r_and_python

## Overview

This repository is a Python and R computational companion to an applied regression textbook, not a standalone analysis service. The main user workflow is to run a chapter script alongside the book and inspect the calculations and analyses it demonstrates; box-level snippets offer smaller code examples. The Python materials span probability and inference, correlation and regression, and prediction, time-series, and causal methods. The appendix provides programming and data-work topics, including external-data examples. Chapter scripts and appendix files are grouped by their documented subject; unsampled integrations and data paths are not inferred.

Main entry points: [`Chapter02_Covariation_in_data/python/chapter02.py`](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter02_Covariation_in_data/python/chapter02.py) (Covariation), [`Chapter03_Basic_probability_theory_and_statistical_inference_ch_probability_theory/python/chapter03.py`](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter03_Basic_probability_theory_and_statistical_inference_ch_probability_theory/python/chapter03.py) (Probability inference), [`Chapter04_Correlation_and_inference_about_a_population_ch_population_korrelation/python/chapter04.py`](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter04_Correlation_and_inference_about_a_population_ch_population_korrelation/python/chapter04.py) (Correlation inference), [`Chapter05_The_simple_linear_regression_model/python/chapter05.py`](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter05_The_simple_linear_regression_model/python/chapter05.py) (Simple regression)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_foundations["Foundations"]
  node_chapter02["Covariation<br/>[chapter02.py]"]
  node_chapter03["Probability inference<br/>[chapter03.py]"]
  node_chapter04["Correlation inference<br/>[chapter04.py]"]
end

subgraph group_regression["Regression"]
  node_chapter05["Simple regression<br/>[chapter05.py]"]
  node_chapter06["Multiple regression<br/>[chapter06.py]"]
  node_chapter07["Nonlinear forms<br/>[chapter07.py]"]
  node_chapter08["Dependent errors<br/>[chapter08.py]"]
end

subgraph group_extensions["Applied extensions"]
  node_chapter09["Binary outcomes<br/>[chapter09.py]"]
  node_chapter10["Prediction methods<br/>[chapter10.py]"]
  node_chapter11["Nonparametric methods<br/>[chapter11.py]"]
  node_chapter12["Time series<br/>[chapter12.py]"]
  node_chapter13["Causal analysis<br/>[chapter13.py]"]
end

subgraph group_appendix["Python appendix"]
  node_appendix_all["Appendix collection"]
  node_appendix_data["Dataset manipulation"]
  node_appendix_visuals["Data visualisation"]
  node_appendix_sources["External data topics"]
end

node_reader(("Textbook reader"))

node_reader -->|"runs chapter"| node_chapter02
node_reader -->|"runs chapter"| node_chapter03
node_reader -->|"runs chapter"| node_chapter04
node_reader -->|"runs chapter"| node_chapter05
node_reader -->|"runs chapter"| node_chapter06
node_reader -->|"runs chapter"| node_chapter07
node_reader -->|"runs chapter"| node_chapter08
node_reader -->|"runs chapter"| node_chapter09
node_reader -->|"runs chapter"| node_chapter10
node_reader -->|"runs chapter"| node_chapter11
node_reader -->|"runs chapter"| node_chapter12
node_reader -->|"runs chapter"| node_chapter13
node_reader -->|"uses appendix"| node_appendix_all
node_reader -->|"uses appendix"| node_appendix_data
node_reader -->|"uses appendix"| node_appendix_visuals
node_reader -->|"uses appendix"| node_appendix_sources

click node_chapter02 "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter02_Covariation_in_data/python/chapter02.py"
click node_chapter03 "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter03_Basic_probability_theory_and_statistical_inference_ch_probability_theory/python/chapter03.py"
click node_chapter04 "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter04_Correlation_and_inference_about_a_population_ch_population_korrelation/python/chapter04.py"
click node_chapter05 "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter05_The_simple_linear_regression_model/python/chapter05.py"
click node_chapter06 "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter06_Multiple_Linear_Regression/python/chapter06.py"
click node_chapter07 "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter07_Nonlinear_functional_form/python/chapter07.py"
click node_chapter08 "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter08_Regression_analysis_with_dependent_error_terms_ch_reg_dep_error/python/chapter08.py"
click node_chapter09 "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter09_Binary_dependent_variable_ch_logit/python/chapter09.py"
click node_chapter10 "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter10_Prediction_ch_prediction/python/chapter10.py"
click node_chapter11 "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter11_Nonparametric_Regression_chapter_nonparametric/python/chapter11.py"
click node_chapter12 "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter12_Time_series_analysis/python/chapter12.py"
click node_chapter13 "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter13_Causal_analyses_ch_causality/python/chapter13.py"
click node_appendix_all "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Appendix_Python_code/appendix_python_all.py"
click node_appendix_data "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Appendix_Python_code/by_topic/07_basic_dataset_manipulation_in_python.py"
click node_appendix_visuals "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Appendix_Python_code/by_topic/08_data_visualisation_in_python.py"
click node_appendix_sources "https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Appendix_Python_code/by_topic/06_importing_data_and_accessing_external_sources.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_chapter02,node_chapter03,node_chapter04 toneBlue
class node_chapter05,node_chapter06,node_chapter07,node_chapter08 toneAmber
class node_chapter09,node_chapter10,node_chapter11,node_chapter12,node_chapter13 toneMint
class node_appendix_all,node_appendix_data,node_appendix_visuals,node_appendix_sources toneRose
class node_reader toneIndigo
```

## Components

### Foundations

- [Covariation](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter02_Covariation_in_data/python/chapter02.py): `Chapter02_Covariation_in_data/python/chapter02.py`
- [Probability inference](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter03_Basic_probability_theory_and_statistical_inference_ch_probability_theory/python/chapter03.py): `Chapter03_Basic_probability_theory_and_statistical_inference_ch_probability_theory/python/chapter03.py`
- [Correlation inference](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter04_Correlation_and_inference_about_a_population_ch_population_korrelation/python/chapter04.py): `Chapter04_Correlation_and_inference_about_a_population_ch_population_korrelation/python/chapter04.py`

### Regression

- [Simple regression](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter05_The_simple_linear_regression_model/python/chapter05.py): `Chapter05_The_simple_linear_regression_model/python/chapter05.py`
- [Multiple regression](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter06_Multiple_Linear_Regression/python/chapter06.py): `Chapter06_Multiple_Linear_Regression/python/chapter06.py`
- [Nonlinear forms](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter07_Nonlinear_functional_form/python/chapter07.py): `Chapter07_Nonlinear_functional_form/python/chapter07.py`
- [Dependent errors](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter08_Regression_analysis_with_dependent_error_terms_ch_reg_dep_error/python/chapter08.py): `Chapter08_Regression_analysis_with_dependent_error_terms_ch_reg_dep_error/python/chapter08.py`

### Applied extensions

- [Binary outcomes](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter09_Binary_dependent_variable_ch_logit/python/chapter09.py): `Chapter09_Binary_dependent_variable_ch_logit/python/chapter09.py`
- [Prediction methods](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter10_Prediction_ch_prediction/python/chapter10.py): `Chapter10_Prediction_ch_prediction/python/chapter10.py`
- [Nonparametric methods](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter11_Nonparametric_Regression_chapter_nonparametric/python/chapter11.py): `Chapter11_Nonparametric_Regression_chapter_nonparametric/python/chapter11.py`
- [Time series](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter12_Time_series_analysis/python/chapter12.py): `Chapter12_Time_series_analysis/python/chapter12.py`
- [Causal analysis](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Chapter13_Causal_analyses_ch_causality/python/chapter13.py): `Chapter13_Causal_analyses_ch_causality/python/chapter13.py`

### Python appendix

- [Appendix collection](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Appendix_Python_code/appendix_python_all.py): `Appendix_Python_code/appendix_python_all.py`
- [Dataset manipulation](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Appendix_Python_code/by_topic/07_basic_dataset_manipulation_in_python.py): `Appendix_Python_code/by_topic/07_basic_dataset_manipulation_in_python.py`
- [Data visualisation](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Appendix_Python_code/by_topic/08_data_visualisation_in_python.py): `Appendix_Python_code/by_topic/08_data_visualisation_in_python.py`
- [External data topics](https://github.com/jiajing-sun/regression_with_r_and_python/blob/main/Appendix_Python_code/by_topic/06_importing_data_and_accessing_external_sources.py): `Appendix_Python_code/by_topic/06_importing_data_and_accessing_external_sources.py`

### Other components

- **Textbook reader**

## Connections

- Textbook reader → Covariation: runs chapter (evidence: `README.md`)
- Textbook reader → Probability inference: runs chapter (evidence: `README.md`)
- Textbook reader → Correlation inference: runs chapter (evidence: `README.md`)
- Textbook reader → Simple regression: runs chapter (evidence: `README.md`)
- Textbook reader → Multiple regression: runs chapter (evidence: `README.md`)
- Textbook reader → Nonlinear forms: runs chapter (evidence: `README.md`)
- Textbook reader → Dependent errors: runs chapter (evidence: `README.md`)
- Textbook reader → Binary outcomes: runs chapter (evidence: `README.md`)
- Textbook reader → Prediction methods: runs chapter (evidence: `README.md`)
- Textbook reader → Nonparametric methods: runs chapter (evidence: `README.md`)
- Textbook reader → Time series: runs chapter (evidence: `README.md`)
- Textbook reader → Causal analysis: runs chapter (evidence: `README.md`)
- Textbook reader → Appendix collection: uses appendix (evidence: `README.md`)
- Textbook reader → Dataset manipulation: uses appendix (evidence: `README.md`)
- Textbook reader → Data visualisation: uses appendix (evidence: `README.md`)
- Textbook reader → External data topics: uses appendix (evidence: `README.md`)
