\(u\)-Subs and \(Z\)-scores
If you take an elementary statistics class, you’re sure to compute some \(Z\)-scores to compare a value against a normal distribution. A typical problem might look like so:
Suppose that \(X\) is normally distributed with mean \(\mu=2\) and standard deviation \(\sigma=1/2\). Compute the probability that \(X>2.6\).
You would solve this by computing a \(Z\)-score for \(X\) and comparing that score to values in a normal table. As it turns out, the formula for the \(Z\)-score arises from \(u\)-substitution applied to a definite integral! This set of class notes explains that procedure.
Data
Ultimately, the objective of statistics is to understand data, so let’s start there.
The table below, for example, lists every Ohio State vs Michigan game since the legendary Woody Hayes started coaching OSU in 1951.
A table is definitely nice. It lets you see what kind of data you’ve got, what it pertains to, and what sort of values to expect. A table doesn’t give you a very good picture of the shape of the data, though. There are a number of statistical graphs that are nice for that.
The Diff column in the scores table, for example, forms a list of numeric values. For that type of data, a histogram is often a good visual tool. The histogram for this data looks like so:
Note that the horizontal axis is split into intervals of length 10. Centered around the origin, for example, is the interval containing the integers from -5 to 4. The area of the rectangle over that interval tells us the proportion of games where \[-5 \leq \text{Ohio State's score}-\text{Michigan's score} < 5.\] There were 19 of those games out of 75 games in all for a proportion of 0.253; thus, that’s the area of that rectangle.
Note that the teams are fairly evenly matched overall, which is why the histogram is tallest near the origin and the rectangles get shorter as we move away from the origin.
Mean and standard deviation
Of course, the teams are not exactly evenly matched. We can get an overall measure of that distinction by computing the average score difference - that is, the average of the numbers in the Diff column. That computation might look like \[ \mu = \frac{(-28) + (-28) + (-22) + \cdots + 35 + 36 + 45}{75} \approx 3.32. \] That number is the true center of the data and is displayed as a thin, dashed, vertical line in the histogram.
More generally, we might have a numerical list of numbers \[\{x_1,x_2,x_3,\ldots,x_n\}.\] The mean \(\mu\) (also called the average) is computed by simply adding up those numbers and dividing by the total. That is, \[\mu = \frac{1}{n}\sum_{i=1}^n x_i.\]
The mean gives us a good idea of where the data is centered. We can get a more complete view of the data by also measuring the “spread” of the data. The tool we use to measure this spread is called the standard deviation. The formula is a little more complicated but it makes a lot of sense if you understand what it’s supposed to measure.
NoteStandard deviation
The standard deviation of a list of numbers measures how far those numbers deviate from the mean on average. It is denoted with a \(\sigma\), though we often find it convenient to work with \(\sigma^2\), also called the variance.
Given a numerical list of numbers with mean \(\mu\) as before, the variance can be computed as \[\sigma^2 = \frac{1}{n} \sum_{i=1}^n (x_i - \mu)^2.\]
Note that we square each difference because we want the contribution of each term to be nonnegative. Squaring the difference is the simplest algebraic way to ensure that. Squaring changes the units, though, so we take the square root so that the standard deviation has the same units. Thus,
\[\sigma = \sqrt{\frac{1}{n} \sum_{i=1}^n (x_i - \mu)^2}.\]
You will not need to compute these values for actual data in this class. It’s useful to understand the concepts, though, when we approximate data with a normal curve.
For this particular example, the mean and standard deviation work out to be
\[ \begin{aligned} \mu &\approx 3.32 \\ \sigma &\approx 15.3 \end{aligned} \]
The normal distribution
As we said already, the objective of statistics is to understand data. We often do this by creating a model of the data. The most fundamental model for a basic list of numbers is the normal distribution. The figure below shows the same histogram of score differences and also shows its normal model.
Note that the normal curve shown in the figure has the same overall shape as the data. It achieves its maximum at about 3.32 and it generally gets smaller as we move away from that point. Sometimes, the curve is above the rectangles and sometimes below. As a result, we can estimate the area of the rectangles over a particular region by computing the area under the curve.
Normal mean and standard deviation
The normal distribution is not some mysterious or magical function. Rather, it is a specific function with a concrete formula expressed in terms of two parameters \(\mu\) and \(\sigma\). That formula is \[ f_{\mu,\sigma}(x) = \frac{1}{\sqrt{2\pi}\sigma} e^{-(x-\mu)^2/{2\sigma^2}}. \] This really defines a family of functions indexed by \(\mu\) and \(\sigma\). When \(\mu=0\) and \(\sigma=1\), we get the so-called standard normal distribution with simpler formula \[ f_{0,1}(x) = \frac{1}{\sqrt{2\pi}} e^{-x^2/{2}}. \]
We can see how these formulae fit together using the interactive graph below. Note that \(\mu\) controls the center of mass of the function while \(\sigma\) controls its spread - just like the mean and standard deviation associated with data.
Note that
- Changing the mean \(\mu\) moves the maximum to the left or right.
- Changing the standard deviation \(\sigma\) affects how concentrated the function is about that mean.
Total area
As it turns out, the total area under the standard normal is 1. That is, \[ \int_{-\infty}^{\infty} f_{0,1}(x) \, dx = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} e^{-x^2/2} \, dx = 1. \] We can prove this fun fact in Calculus III! You’ll have to take my word for that fact for the moment.
Once we know that the total area under the standard normal is 1, though, it’s easy to see that the total area under any normal is 1. That’s because
- Changing the mean \(\mu\) simply shifts the graph left or right, which doesn’t change the area.
- Changing the standard deviation \(\sigma\) stretches or compresses the graph by the factor \(\sigma\) in the horizontal direction but compresses or stretches by that same factor in the vertical. This again preserves the total area.
Probability and area
In statistics, a random variable represents some random process that generates a number. We know what types of numbers the process will generate and what the distribution of those possibilities looks like but we don’t know what the actual value is until the process takes place. We often express questions about this sort of process in terms of probabilities.
Symbolically, a random variable is often represented with a capital letter, like an \(X\) or \(Y\) or \(Z\) or \(S\) or \(D\). Probabilities are often represented like
- \(P(a<X<b)\) for the probability that \(X\) lies between \(a\) and \(b\),
- \(P(a<X)\) or \(P(X<b)\) for one-sided probabilities.
Example
Here’s a fair question: What’s the probability that Ohio State beats Michigan by more than 10 points next year?
A purely data-based approach
We really don’t have much to go on just yet since both teams are in flux. Thus, it seems reasonable to just examine our historical data. We’ve got 75 games and, as it turns out, Ohio State beat Michigan by more than 10 points in 23 of those games. Thus, if \(D\) represents the score difference (OSU-Mich), then a reasonable guess might be \[P(D>10) \approx \frac{23}{75} \approx 0.307.\] Note that probability is always expressed as a number between zero and one like this.
A model-based approach
Alternatively, we could apply a normal model \[f_{\mu,\sigma}(x) = \frac{1}{\sqrt{2\pi}\sigma} e^{-(x-\mu)^2/(2\sigma^2)}, \] with \(\mu = 3.32\) and \(\sigma = 15.30\). Again, those specific numbers are computed from the data, as we showed above.
\[P(D>10) \approx \frac{1}{\sqrt{2\pi}\sigma} \int_{10.5}^{\infty} e^{-(x-\mu)^2/(2\sigma^2)} \, dx.\]
Unfortunately, we can’t evaluate this integral symbolically. We can ask a computer to approximate the integral using Riemann-like sums, though:
The answer of about \(0.31943438\) is quite close to our purely data-based approach of about \(0.307\).
That’s kinda the point!
\(Z\)-scores
In a stat class, you would finish this question with a different technique involving the \(Z\)-score. For a given \(X\) and a general \(\mu\) and \(\sigma\), the \(Z\)-score is defined by \[ Z = \frac{X-\mu}{\sigma}. \] In our case we have \(X=10.5\), \(\mu=3.32\), and \(\sigma = 15.3\). Thus, \[ Z = \frac{10.5 - 3.32}{15.3} \approx 0.47. \] We would then use a standard normal table to look up \[P(Z<-0.47) \approx 0.3192.\]
You could do this using this interactive normal table.
\(u\)-Subs and \(Z\)-scores
Our main objective now is to understand where the \(Z\)-score \[Z = \frac{X-\mu}{\sigma}\] comes from. As it turns out, it’s essentially \(u\)-substitution with a change of bounds in a definite integral.
To be clear,
- \(X\) is the value produced by a random variable with that same name,
- \(\mu\) is the mean of that random variable, and
- \(\sigma\) is the standard deviation.
For example, if \(X\) is a random variable with mean \(\mu=500\) and standard deviation \(\sigma=100\), then the \(Z\)-score of \(X=700\) is \[Z = \frac{700-500}{100} = 2.\] In statistical terms, we might say that \(X=700\) is two standard deviations past the mean.
With the \(Z\)-score, we could look up the answer in a standard normal table. The question now, though, is why this works?
Ultimately, it boils down to the following formula: \[ \frac{1}{\sqrt{2\pi }\sigma }\int_a^b e^{-\frac{(x-\mu )^2}{2\sigma ^2}} \, dx= \frac{1}{\sqrt{2\pi }}\int _{(a-\mu )/\sigma }^{(b-\mu )/\sigma}e^{\left.-x^2\right/2}dx. \] Let’s use \(u\)-substitution to verify this. Let \(u=(x-\mu )/\sigma\) so that \(du = \frac{1}{\sigma} dx\). Then, \[ \begin{aligned} \frac{1}{\sqrt{2\pi }\sigma }\int_a^b e^{-\frac{(x-\mu )^2}{2\sigma ^2}} \, dx &= \frac{1}{\sqrt{2\pi }}\int_a^b e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2} \, \frac{1}{\sigma}dx \\ &= \frac{1}{\sqrt{2\pi }}\int_{(a-\mu)/\sigma}^{(b-\mu)/\sigma} e^{-u^2/2}\,du. \end{aligned} \]
Examples
Here are a couple of examples.
SAT
Here’s another look at the random variable \(X\) with mean \(\mu=500\) and standard deviation \(\sigma=100\). Suppose we’re curious about the probability \[P(500 < X < 700).\] Expressed as an integral, we get \[\frac{1}{\sqrt{2\pi}\times100} \int_{500}^{700} e^{-(x-500)^2/(2\times100^2)}\, dx.\] Setting \(u=(x-500)/100\), we could write this as \[ \frac{1}{\sqrt{2\pi}} \int_{500}^{700} e^{-\frac{1}{2}\left(\frac{x-500}{100}\right)^2} \, \frac{1}{100}dx = \frac{1}{\sqrt{2\pi }}\int_{0}^{2}e^{-u^2/2}du. \]
Another
Use \(u\)-substitution to convert the normal integral \[ \frac{1}{\sqrt{2\pi}10} \int_{65}^{80} e^{-(x-70)^2/(2\times10^2)}\,dx \] to a standard normal integral.
Solution
Note that \(\mu=70\) and \(\sigma = 10\). Thus, we let \(u=(x-70)/10\) so that \[ \begin{aligned} \frac{1}{\sqrt{2\pi}\,10}\int_{65}^{80} e^{-(x-70)^2/(2\times10^2)} \, dx &= \frac{1}{\sqrt{2\pi}}\int_{65}^{80} e^{-\frac{1}{2}\left(\frac{x-70}{10}\right)^2} \, \frac{1}{10}dx \\ &= \frac{1}{\sqrt{2\pi}}\int_{(65-70)/10}^{(80-70)/10} e^{-u^2/2} \, du \\ &= \frac{1}{\sqrt{2\pi}}\int_{-1/2}^{1} e^{-u^2/2} \, du. \end{aligned} \]
Problems
Using \(u\)-substitution, convert the following normal integrals into standard normal integrals.
- \(\displaystyle \frac{1}{\sqrt{2\pi }2}\int_0^1 e^{\left.-(x-1)^2\right/8} \, dx\)
- \(\displaystyle \frac{1}{\sqrt{2\pi }4}\int_{12}^{18} e^{\left.-(x-10)^2\right/32} \, dx\)