Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Section 3.1 — Estimators

This notebook contains the code examples from Section 3.1 Estimators of the No Bullshit Guide to Statistics. Use the “rocket” icon at the top-right to make the code cells interactive (Live Code), or run this notebook an ephemeral JupyterLab cloud instance (Binder).

We’ll begin our study of inferential statistics by introducing estimators, which are the math tools used for computing confidence intervals and running hypothesis tests.

simplified_estimators.png

Notebook setup

Note: you may need to restart the kernel to use updated packages.
<Figure size 640x480 with 0 Axes>
datasets/ directory already exists.

\def\stderr#1{\mathbf{se}_{#1}} \def\stderrhat#1{\hat{\mathbf{se}}_{#1}} \def\Mean{\textbf{mean}} \def\Var{\textbf{var}} \def\Std{\textbf{std}} \def\Freq{\textbf{freq}} \def\RelFreq{\textbf{relfreq}} \def\CI#1{\textbf{CI}_{#1}} \def\CIL#1{\textbf{L}_{#1}} \def\CIU#1{\textbf{U}_{#1}} \def\ci#1{\textbf{ci}_{#1}} \def\cil#1{\textbf{l}_{#1}} \def\ciu#1{\textbf{u}_{#1}} \def\DMeans{\textbf{dmeans}} \def\Prop{\textbf{prop}} \def\DProps{\textbf{dprops}} \def\Err{ {\Large \varepsilon}} \def\calN{\mathcal{N}} \def\Tdist{\mathcal{T}} \def\Expon{\mathrm{Expon}}

(this cell contains the macro definitions like sex‾\stderr{\overline{\mathbf{x}}}, se^\stderrhat{}, mean\Mean, ...)

Applications of sampling distributions

  • Parameter estimates

  • Confidence intervals (next section)

  • Test statistics (remainder of the sections in this chapter)

Definitions

Review of data concepts

To get things started, let’s review the data analysis concepts:

  • Population: the entire group of individuals we’re interested in. We generally assume it’s impossible to collect measurements for the entire population, because it consists of thousands or millions of individuals.

  • Sample x=(x1,x2,…,xn)\mathbf{x} = (x_1, x_2, \ldots, x_n): a sequence of nn observations from the population. Each xix_i corresponds to a measurement from one individual randomly selected from the population.

  • Sample statistic: any quantity computed from the sample x\mathbf{x}.

  • Descriptive statistics: numerical summaries that describe the characteristics of the sample x\mathbf{x}. Example of descriptive statistics include, the sample mean x‾\overline{\mathbf{x}}, the sample variance sx2s_{\mathbf{x}}^2, and the sample standard deviation sxs_{\mathbf{x}}.

Review of probability concepts

Let’s review the main concepts and the notation we used to describe probability models:

  • X∼M(θ)X \sim \mathcal{M}(\theta): the population probability model describes the variability of the data in the population as a random variable XX with probability distribution fXf_X.

  • M\mathcal{M}: the model family describes the general “shape” of the distribution. Examples of probability model families include the uniform U\mathcal{U}, the normal N\mathcal{N}, and the exponential Expon\text{Expon}.

  • θ\theta: the model parameters that describe the specific population. Examples of model parameters: α\alpha and β\beta for uniform models, μ\mu and σ\sigma for normal models, and λ\lambda for exponential models.

  • rvX\tt{rvX}: the computer model of the random variable X∼M(θ)X \sim \mathcal{M}(\theta).

  • Random sample X=(X1,X2,…,Xn)\mathbf{X} = (X_1, X_2, \ldots, X_n): a sequence of nn observations from the population model. Each XiX_i is an independent copy of the random variable X∼M(θ)X \sim \mathcal{M}(\theta).

New concepts

Building on the DATA and PROB definitions, we can now introduce the notation and terminology around estimators:

  • Estimate θ^\hat{\theta}: a statistic computed from the sample x\mathbf{x} for the purpose of making inferences about a population parameter θ\theta. For example, the sample mean x‾\overline{\mathbf{x}} is an estimate of the population mean μX\mu_X.

  • Estimator g:Xn→Rg : \mathcal{X}^n \to \mathbb{R}: the function that we use to compute the estimate θ^\hat{\theta} from a given sample x=(x1,x2,…,xn)\mathbf{x} = (x_1, x_2, \ldots, x_n). We denote this as θ^=g(x)\hat{\theta} = g(\mathbf{x}). For example, the estimator mean\Mean is defined as the function mean(x)=1n ⁣∑i=1nxi\Mean(\mathbf{x}) = \tfrac{1}{n}\!\sum_{i=1}^n x_i. We use the estimator mean\Mean to compute the sample mean estimate x‾\overline{\mathbf{x}}.

  • The sampling distribution of the estimator gg is denoted Θ^=g(X)\hat{\Theta} = g(\mathbf{X}) and describes the estimates we can expect to observe from random samples from the population X=(X1,X2,…,Xn)\mathbf{X} = (X_1, X_2, \ldots, X_n). For example, the sampling distribution of the mean is the random variable X‾=mean(X)=1n ⁣∑i=1nXi\overline{\mathbf{X}} = \Mean(\mathbf{X}) = \tfrac{1}{n}\!\sum_{i=1}^n X_i.

  • The standard error of an estimator gg is denoted seθ^\stderr{\hat{\theta}} and describes the standard deviation of its sampling distribution. For example, the standard error of the mean is denoted sex‾\stderr{\overline{\mathbf{x}}}.

estimator from particular sample

Statistical inference is the use the values of the statistics obtained from the sample x=(x1,x2,…,xn)\mathbf{x} = (x_1, x_2, \ldots, x_n) to estimate the population parameters θ\theta. For example, the sample mean x‾=mean(x)\overline{\mathbf{x}}=\Mean(\mathbf{x}) is an estimate of the population mean μ\mu, and the sample variance sx2=var(x)s_{\mathbf{x}}^2=\Var(\mathbf{x}) is an estimate of the population variance σ2\sigma^2.

Estimators

Let’s start with some estimators you’re already familiar with (discussed in descriptive statistics):

Sample mean estimator

  • estimator: x‾=mean(x)=1n∑i=1nxi\overline{\mathbf{x}} = \Mean(\mathbf{x}) = \frac{1}{n}\sum_{i=1}^n x_i

  • gives an estimate for the population mean μ\mu

Sample variance and standard deviation

  • estimator: sx2=var(x)=1n−1∑i=1n(xi−x‾)2s_{\mathbf{x}}^2 = \Var(\mathbf{x}) = \frac{1}{n-1}\sum_{i=1}^n (x_i-\overline{\mathbf{x}})^2

  • gives an estimate for the population variance σ2\sigma^2

  • note the denominator is (n−1)(n-1) and not nn

The standard deviation sx2s_{\mathbf{x}}^2 is the square root of the sample variance:

sx2=sx=std(x)=1n−1∑i=1n(xi−x‾)2.\sqrt{s_{\mathbf{x}}^2} = s_{\mathbf{x}} = \Std(\mathbf{x}) = \sqrt{ \frac{1}{n-1}\sum_{i=1}^n (x_i-\overline{\mathbf{x}})^2 }.

We can now define a Python function std for computing the standard deviation by taking the square root of the variance:

Example 1: apple weight mean and variance

30
0 205.0 1 182.0 2 192.0 Name: weight, dtype: float64
pandas.Series
numpy.ndarray
array([205., 182., 192., 189., 217., 192., 210., 240., 225., 191., 193., 209., 167., 183., 210., 198., 239., 188., 179., 182., 200., 197., 245., 192., 201., 218., 198., 211., 208., 217.])
<Figure size 700x200 with 1 Axes>
<Figure size 700x200 with 1 Axes>

Next let’s calculate the mean of the sample:

202.6

Let’s also calculate the variance and the standard deviation of the sample of the apple weights:

345.9724137931035
18.60033370112223
count 30.000000 mean 202.600000 std 18.600334 min 167.000000 25% 191.250000 50% 199.000000 75% 210.750000 max 245.000000 Name: weight, dtype: float64

Example 2: kombucha volume mean and variance

40
0 1016.24 1 993.88 2 994.72 Name: volume, dtype: float64
<Figure size 700x200 with 1 Axes>
999.10375
95.4365419871796
9.769162808919686

Sampling distributions

Let’s look at the same estimators that we described in the previous section, but this time applied to random samples of size nn:

  • Sample mean: X‾=mean(X)=1n∑i=1nXi\overline{\mathbf{X}} = \Mean(\mathbf{X}) = \tfrac{1}{n}\sum_{i=1}^n X_i

  • Sample variance: SX2=var(X)=1n−1∑i=1n(Xi−X‾)2S_{\mathbf{X}}^2 = \Var(\mathbf{X}) = \tfrac{1}{n-1}\sum_{i=1}^n \left(X_i - \overline{\mathbf{X}} \right)^2

  • Sample standard deviation: SX=var(X)=1n−1∑i=1n(Xi−X‾)2S_{\mathbf{X}} = \sqrt{\Var(\mathbf{X})} = \sqrt{\tfrac{1}{n-1}\sum_{i=1}^n \left(X_i - \overline{\mathbf{X}} \right)^2}

Note these formulas is identical to the formulas we saw earlier. The only difference is that we’re calculating the functions gg, hh, and dd based on a random sample X=(X1,X2,…,Xn)\mathbf{X} = (X_1, X_2, \ldots, X_n), instead of particular sample x=(x1,x2,…,xn)\mathbf{x} = (x_1, x_2, \ldots, x_n).

Example 4

Let’s generate N=10N=10 samples z1,z2,z3,…,z10\mathbf{z}_1, \mathbf{z}_2, \mathbf{z}_3, \ldots, \mathbf{z}_{10}, and compute the mean, the variance, and the standard deviation in each sample.

<Figure size 700x200 with 1 Axes>

Now imagine repeating this process for N=1000N=1000 samples z1,z2,z3,…,z1000\mathbf{z}_1, \mathbf{z}_2, \mathbf{z}_3, \ldots, \mathbf{z}_{1000}.

We can obtain an approximation of the sampling distribution of the mean, by plotting a histogram of the means we computed from the 1000 random samples:

[z‾1,z‾2,z‾3,…,z‾1000],[\overline{\mathbf{z}}_1, \overline{\mathbf{z}}_2, \overline{\mathbf{z}}_3, \ldots, \overline{\mathbf{z}}_{1000}],

where z‾i\overline{\mathbf{z}}_i denotes the sample mean computed from the data in the iith sample: z‾i=mean(zi)\overline{\mathbf{z}}_i = \Mean(\mathbf{z}_i).

<Figure size 700x200 with 1 Axes>

We can obtain an approximation of the sampling distribution of the sample standard deviation, by plotting a histogram of the standard deviations we computed from the 1000 random samples:

[sz1,sz2,sz3,…,sz1000],[s_{\mathbf{z}_1}, s_{\mathbf{z}_2}, s_{\mathbf{z}_3}, \ldots, s_{\mathbf{z}_{1000}}],

where szis_{\mathbf{z}_i} denotes the standard deviation computed from the iith sample: szi=mean(zi)=var(zi)s_{\mathbf{z}_i} = \Mean(\mathbf{z}_i) = \sqrt{ \Var(\mathbf{z}_i) }.

<Figure size 700x200 with 1 Axes>

Illustration

The sampling distribution of the estimator gg is defined as the random variable Θ^=g(X)\hat{\Theta} = g(\mathbf{X}), which is the output of the estimator gg when the input is a random sample X=(X1,X2,…,Xn)\mathbf{X} = (X_1, X_2, \ldots, X_n).

sampling distribution

Estimator properties

  • The bias of the estimator gg is defined as: bias(g)=EX[Θ^]−θ\mathbf{bias}(g) = \mathbb{E}_{\mathbf{X}}[\hat{\Theta}] - \theta. The bias measures how much the estimates differ from the true population parameter, on average.

  • The variance of an estimator is   var(Θ^)=EX[(Θ^−E[Θ^])2]\mathbf{var}\big(\hat{\Theta}\big) = \mathbb{E}_{\mathbf{X}}\big[(\hat{\Theta} - \mathbb{E}[\hat{\Theta}])^2\big], and it measures the variability of the estimates around the average.

  • The standard error of the estimator gg is the square root of its variance and denoted seθ^=var(Θ^)\stderr{\hat{\theta}} = \sqrt{ \mathbf{var}(\hat{\Theta}) }.

Illustration

bias and variance
  • a) all the arrow hits are on target (low bias) and close together (low variance). This is the best-case scenario.

  • b) the arrow hits are still close to each other, which means the estimator has low variance, but the hits are consistently “off” the centre (below and to the right), which illustrates a biased estimator.

  • c) is an illustration of a high-variance estimator with no bias. The arrow hits are spread out, but mostly centred on the target.

  • d) shows the worst case scenario: and estimator that has high bias (consistently off) and high variance (spread out).

Computational approach to sampling distributions

Example 5: sampling distributions of the kombucha volume

The probability distribution of the kombucha volume is know to be K∼N(μK=1000,σK=10)K \sim \mathcal{N}(\mu_K=1000, \sigma_K=10). This is an usual case where we know the population parameters, but we’ll investigate because it allows us to learn more about sampling distributions.

<Figure size 700x200 with 1 Axes>
Sampling distribution of the mean
<Figure size 700x200 with 1 Axes>

We can verify the mean estimator is unbiased, since the mean of the sampling distribution is very close to the population mean:

(999.9759718368696, 1000)

Let’s calculate the standard error of the estimator

2.2080598530804383
2.23606797749979
Sampling distribution of the variance
<Figure size 700x200 with 1 Axes>

The sample variance estimator is unbiased

(99.39922540353122, 100)

Approximating sampling distribution

Let’s look at a particular sample ksample02 that comes from Batch 02 of the kombucha bottling plant.

20
array([ 995.83, 999.44, 978.64, 1016.4 , 982.07, 991.58, 1005.03, 987.55, 989.42, 990.91, 1005.51, 1022.92, 1000.42, 988.82, 1005.39, 994.04, 999.81, 1011.75, 992.52, 1000.09])
<Figure size 700x200 with 1 Axes>
997.9069999999999
11.149780314097287

Bootstrap estimation

Minimal example

3
array([3, 4, 1, 3])

Interactive bootstrap samples example

Re-run the following code cell many times to see different bootstrap samples from ksample02.

<Figure size 400x200 with 1 Axes>

General-purpose bootstrap estimation function

Example 6

Let’s use the function gen_boot_dist to obtain the sampling distribution of the mean from the sample ksample02.

<Figure size 700x200 with 1 Axes>

We can obtain an bootstrap estimate of standard error of the mean by computing the standard deviation of the bootstrap distribution.

(2.415083743362255, 2.2080598530804383)

The expected value of the bootstrap distribution matches the sample mean.

(997.9296855999999, 997.9069999999999, 1000)

Analytical approximation formulas

We can use probability theory formulas to come up with approximations for certain sampling distributions.

Indeed many of the probability distributions we learned about in the probability chapter are used to describe sampling distributions of various estimators:

  • The normal distribution

  • Student’s tt-distribution: sample mean from a normally distributed population with unknown variance

  • Chi-square distribution: variance of samples from a normal population

  • Fisher–Snedecor FF-distribution: ratios of variances (only discussed later in the book)

The best example of the analytical approximation formula is the central limit theorem.

Central limit theorem

(2.23606797749979, 2.2080598530804383)
<Figure size 700x200 with 1 Axes>

Sampling distribution of the mean

The central limit theorem tells us everything we need to know about the sampling distribution of the sample mean estimator mean\Mean, which corresponds to the random variable X‾=mean(X)\overline{\mathbf{X}} = \Mean(\mathbf{X}).

The central limit theorem states that the sampling distribution of the mean converges to a normal distribution as nn goes to infinity:

X‾∼N(μX,σXn).\overline{\mathbf{X}} \quad \sim \quad \mathcal{N}\big(\mu_X, \tfrac{\sigma_X}{\sqrt{n}} \big).

Note the central limit theorem gives a sampling distribution of the sample mean computed from samples taken from any population X∼M(θ)X \sim \mathcal{M}(\theta).

True sampling distribution

We start by running a simulation to obtain the true sampling distribution of the sample mean for samples of size n=7n=7 from the population K∼N(μK=1000,σK=10)K \sim \mathcal{N}(\mu_K=1000,\sigma_K=10).

<Figure size 700x200 with 1 Axes>

This is the true sampling distribution of the sample mean generated using simulation from N=10000N=10000 samples of size n=7n=7. We can use this graph as the “ground truth” for the approximations techniques we’ll learn next.

3.8051688517483897

Prediction of the central limit theorem

Compute the standard error using according to the central limit theorem sek‾=σKn\stderr{\overline{\mathbf{k}}} = \frac{\sigma_K}{\sqrt{n}}:

3.779644730092272

Sampling distribution of the mean according to CLT

Let’s now superimpose a lineplot of the analytical approximation formula we obtain from the central limit theorem.

<Figure size 700x200 with 1 Axes>

The plug-in principle

Next we consider real-world statistical analysis scenario when we don’t know the population variance, but instead have to estimate it from a particular sample of observations. Specifically, we’ll load the sample form Batch 03.

7
60 1005.19 61 987.31 62 1002.40 Name: volume, dtype: float64

The estimated standard deviation sks_{\mathbf{k}} computed from ksample03 is:

8.519494731273129

This estimate is pretty close to the true population standard deviation sigmaK =σK=10= \sigma_K = 10.

Let’s now compute the estimated standard error using the plug-in formula: se^k‾=skn\stderrhat{\overline{\mathbf{k}}} = \frac{s_{\mathbf{k}}}{\sqrt{n}}, where sks_{\mathbf{k}} is the estimated standard deviation computed from ksample03.

3.220066336410536

This is pretty close to the standard error we would obtain if we knew the population standard deviation: sek‾=σKn=\stderr{\overline{\mathbf{k}}} = \frac{\sigma_K}{\sqrt{n}} = sigmaK/np.sqrt(7) = 3.78.

Normal approximation to the sampling distribution

We now obtain the best normal approximation based on the estimated standard error sehat03 that we computed from the data in ksample03.

<Figure size 700x200 with 1 Axes>

A better approximation

Student’s t-distribution (used whenever working with normally needed in context where using ss as plug-in estimate for σ).

Obtain Student’s tt-distribution based on the estimated standard error sehat03 that we computed from the data in ksample03.

<Figure size 700x200 with 1 Axes>
(3.943759731059507, 3.8051688517483897)

Bootstrapped sampling distribution of the sample mean

<Figure size 700x200 with 1 Axes>

The expected value of the sampling distribution we obtained using bootstrap estimation is

(1000.5607797142856, 1000.5371428571428, 1000)

The standard error of the sampling distribution

(2.9673068567038365, 3.8051688517483897)
(8.519494731273129, 10)

Sampling distribution of the variance

When the population is normally distributed X∼N(μ,σ)X \sim \mathcal{N}(\mu,\sigma), the sampling distribution of the sample variance Sx2S_{\mathbf{x}}^2 is described by a scaled version of the chi-square distribution:

Sx2    ∼    σ2(n−1)⏟scale  ⋅  χ(n−1)2,S_{\mathbf{x}}^2 \;\; \sim \;\; \underbrace{\frac{ \sigma^2 }{ (n-1) } }_{\tt{scale}} \; \cdot \; \chi^2_{(n-1)},

where nn is the sample size and χ(n−1)2\chi^2_{(n-1)} is the chi-square distribution with n−1n-1 degrees of freedom.

Sampling distribution of the variance

Let’s start by plotting a histogram of the sampling distribution of the variance computed from samples of size n=20n=20 from the random variable rvK = K∼N(μK=1000,σK=10)K \sim \mathcal{N}(\mu_K=1000,\sigma_K=10).

<Figure size 700x200 with 1 Axes>

Let’s now superimpose the chi-square distribution with 20−1=1920-1=19 degrees of freedom, with scale parameter set to σN2/(n−1)\sigma_N^2/(n-1).

<Figure size 700x200 with 1 Axes>

Bootstrapped sampling distribution of the sample variance

Let’s look again at the sample ksample02 that comes from Batch 02 of the kombucha bottling plant.

20

The sample variance we find from ksample02 is an over-estimate of the population variance:

(124.31760105263139, 100)

So we should expect the bootstrap estimate we obtain by resampling from ksample02 will also be an overestimate of the population.

<Figure size 700x200 with 1 Axes>

The expected value the sampling distribution we obtained using bootstrap estimation is:

(118.6780201503156, 100)

The expected value bootstrap variances overestimates the true population variance.

We can also compute standard error of the sampling distribution of the variance, denoted se^sk2∗\stderrhat{s_{\mathbf{k}}^2}^*, and compare it to the true standard error sesk2\stderr{s_{\mathbf{k}}^2} computed through simulation:

(35.96396081594617, 32.27334227853393)

Alternative calculation methods

Using statsmodels for bootstrap estimation

Bootstrap mean

5000
<Figure size 700x200 with 1 Axes>

We can obtain bootstrap distribution of the variance by simply changing the argument statistic=var. See Exercise E3.16.

Explanations

Biased and unbiased estimators for the population variance

The sample variance estimator sx2=1n−1∑i=1n(xi−x‾)2s_{\mathbf{x}}^2 = \frac{1}{n-1} \sum_{i=1}^n (x_i - \overline{\mathbf{x}})^2 is an unbiased estimator of the population variance.

Let’s see what happens if we the estimator s~x2=1n∑i=1n(xi−x‾)2\tilde{s}_{\mathbf{x}}^2 = \frac{1}{n} \sum_{i=1}^n (x_i - \overline{x})^2, which has denominator nn instead of (n−1)(n-1).

First, let’s define the Python function altvar that performs this calculation:

<Figure size 700x200 with 1 Axes>
(95.28131350335453, 100)

The expected value of the sampling distribution for this estimator does not equal the population variance, E[S~2]≠σK2=100\mathbb{E}[\tilde{S}^2] \neq \sigma_K^2 = 100. The expected value E[S~2]\mathbb{E}[\tilde{S}^2] will consistently underestimate σK2\sigma_K^2.

We can correct the bias in this estimator by simply using the normalization factor (n−1)(n-1) in the formula instead of nn. This is how we end up with the unbiased estimator formula sx2=1n−1∑i=1n(xi−x‾)2s_{\mathbf{x}}^2 = \frac{1}{n-1} \sum_{i=1}^n (x_i - \overline{\mathbf{x}})^2, for which E[SK2]≈σK2=100\mathbb{E}[S_{\mathbf{K}}^2] \approx \sigma_K^2 = 100.

(99.91922831464032, 100)

Pivotal quantities

Rephrase analytical approximations in terms of standard reference distributions, thanks to pivot transformation

Y    =    scale⋅X  +  loc.Y \;\; = \;\; \texttt{scale} \cdot X \; + \; \texttt{loc}.
X    =    Y−locscaleX \;\; = \;\; \frac{ Y - \texttt{loc} }{ \texttt{scale} }

We say XX is a pivotal quantity.

FY(y)=FX(y−locscale)andfY(y)=1scale⋅fX(y−locscale).F_Y(y) = F_X\left( \frac{ y - \texttt{loc} }{ \texttt{scale} } \right) \quad \text{and} \quad f_Y(y) = \frac{1}{\texttt{scale}} \cdot f_X\left(\frac{y-\texttt{loc}}{\texttt{scale}} \right).

Recall the distribution for mean of kombucha volume modelled as rvTKbar, and corresponds to the custom tt-distribution: TK‾      =      se^k‾⋅T(6)  +  μKT_{\overline{\mathbf{K}}} \;\;\; = \;\;\; \stderrhat{\overline{\mathbf{k}}} \cdot \mathcal{T}(6) \; + \; \mu_K.

We can also get the same results using the standard tt-distribution.

(1006.2571694068641, 1006.2571694068641)
(0.8062670118096587, 0.8062670118096587)

Recall the sampling distribution of the variance rvS2 with custom scale parameter. Here are some examples of how we can do calculations using the un-scaled standard chi-square distribution.

(158.6501431876113, 158.6501431876113)
(0.9257325359937036, 0.9257325359937036)

Shifted sampling distributions

Two contexts for using sampling distribution:

  • Case 1: the population mean μX\mu_X is known. We draw the sampling distribution centred on the population mean μX\mu_X:

    TB    ∼    T(n−1,  loc ⁣=μX,  scale ⁣= ⁣se^x‾).T_B \;\; \sim \;\; \mathcal{T}(n-1, \; \tt{loc}\!=\mu_X, \; \tt{scale}\!=\!\stderrhat{\overline{\mathbf{x}}}).
  • Case 2: the population mean μX\mu_X is unknown. We can draw the sampling distribution centred on the sample mean x‾\overline{\mathbf{x}}:

    TA    ∼    T(n−1,  loc ⁣=x‾,  scale ⁣= ⁣se^x‾).T_A \;\; \sim \;\; \mathcal{T}(n-1, \; \tt{loc}\!=\overline{\mathbf{x}}, \; \tt{scale}\!=\!\stderrhat{\overline{\mathbf{x}}}).

Essentially, the sampling distribution formula we obtained describes the distribution of the deviations of the sample mean from the population mean: x‾−μX\overline{\mathbf{x}} - \mu_X, so this is why we can use the same distribution in both contexts.

Estimation of the apples weights

<Figure size 700x200 with 1 Axes>

Kombucha volume probabilities

In Case P we know the population mean, and the random variable TBT_B describes what kind of sample means we can expect to observe. We’ll use this type of reasoning for hypothesis testing.

<Figure size 700x200 with 1 Axes>

Discussion

Congratulations on surviving until the end this notebook! In the remainder of this chapter and the next, we’ll learn about various applications of the formulas we introduces in this section. Basically, it’s all downhill from here.

In the next notebook, we’ll learn how to use everything we learned about sampling distributions to calculate confidence intervals.