Notebooks#

This folder contains the notebooks created for the No Bullshit Guide to Statistics.

The purpose of these notebooks is to allow you to experiment and play with all the code examples presented in the book. Each notebook contains numerous empty code cells, which are an invitation for you to try some commands on your own. For example, you can copy-paste some of the neighbouring commands and try modifying them to see what outputs you get.

Chapter 1: Data#

1.1 Introduction to data#

This is a very short notebook that gives some examples of random selection and random assignment.

1.2 Data in practice#

This notebook explains practical aspects of data manipulations using Pandas and talks about data pre-processing steps like data cleaning and outlier removal.

TODO: finish the notebook with dataset pre-processing steps: 12b_background_stories.ipynb.

1.3 Descriptive statistics#

This notebook explains how to compute numerical summaries (mean, standard deviation, quartiles, etc.) and how to generate data visualizations like histograms, box plots, bar plots, etc.

Chapter 2: Probability#

In this chapter you’ll learn about random variables and probability models.

2.1 Discrete random variables#

This notebook contains a complete introduction to probability theory, including definitions, formulas, and lots of examples of discrete random variables like coin toss, die roll, and other.

2.2 Multiple random variables#

This section will introduce you to the concept of a joint probability distribution. For example, the pair of random variables \((X,Y)\) can be described by the joint probability distribution function \(f_{XY}\).

2.3 Inventory of discrete distributions#

The Python module scipy.stats contains pre-defined probability models that you can use for modeling tasks. These are like LEGOs for the XXIst century.

2.4 Calculus prerequisites#

You need to know a bit of calculus to understand the math machinery for calculating probabilities of continuous random variables. Don’t worry—there is only one new concept to learn: the integral \(\int_{x=a}^{x=b} f(x)dx\), which corresponds to computing the area under the graph of \(f(x)\) between \(x=a\) and \(x=b\).

2.5 Continuous random variables#

In this notebook we’ll revisit all the probability concepts we learned for discrete random variables, and learn the analogous concepts for continuous random variables. You can think of Section 2.5 as the result of taking Section 2.1 and replacing every occurrence \(\textrm{Pr}(a \leq X \leq b)=\sum_{x=a}^{x=b}f_X(x)\) with \(\textrm{Pr}(a \leq X \leq b)=\int_{x=a}^{x=b}f_X(x)dx\).

2.6 Inventory of continuous distributions#

In this section we’ll complete the inventory of probability distributions by introducing the “continuous LEGOs” distributions like uniform, norm, expon, t, f, chi2, gamma, beta, etc.

2.7 Random variable generation#

How can we use computers to generation observations from random variables? In this notebooks, we’ll describe some practical techniques for generating observations from any probability distribution, and develop math tools to verify that the random generation process is workin as expected.

2.8 Probability models for random samples#

Consider a random variable \(X\) with a known probability distribution \(f_X\). What can we say about the characteristics of \(n\) copies of the random variable \(\mathbf{X} = X_1X_2X_3\cdots X_n \sim f_{X_1X_2\cdots X_n}\). Each \(X_i\) is independent copy of the random variable \(X\). This is called the independent, identically distributed (iid) setting. Understanding the properties of \(\mathbf{X}\) is important for all the statistics operations we’ll be doing in the next two chapters.

Chapter 3: Inferential statistics#

See the list of notebooks in 30_STATS.md or check out the Chapter 3 outline.

Chapter 4: Linear models#

See the list of notebooks in 40_LINEAR_MODELS.md or read the Chapter 4 outline.

See also PART IV of the Stats overview tutorial.

Chapter 5: Bayesian statistics#

Coming soon. See the Chapter 5 outline.