Introduction Uniform Distribution Binomial Distribution Hypergeometric Distribution Continuous Distributions

Introduction to Statistical Data Analysis Lecture 3: Distributions

James V. Lambers

Department of Mathematics The University of Southern Mississippi

James V. Lambers Statistical Data Analysis 1 / 56 Introduction Random Variables Uniform Distribution Discrete Probability Distributions Binomial Distribution Rules for Discrete Distributions Hypergeometric Distribution Mean Poisson Distribution and Standard Deviation Continuous Distributions Introduction

Now that we know how to compute of events, we can study the behavior of the probability across all possible outcomes of an experiment–that is, the distribution of the probability across the . Our understanding of the will eventually allow us to make inferences from the data from which the distribution arises.

James V. Lambers Statistical Data Analysis 2 / 56 Introduction Random Variables Uniform Distribution Discrete Probability Distributions Binomial Distribution Rules for Discrete Distributions Hypergeometric Distribution Mean Poisson Distribution Variance and Standard Deviation Continuous Distributions Random Variables

A , usually denoted by a capital letter such as X , is an of an experiment that has a numerical value. The value itself is usually denoted by the lower-case version of the letter used to denote the variable itself; that is, a random variable X takes on numerical values that are denoted by x. Random variables can either be continuous or discrete. A continuous random variable can assume a value equal to any real number within some interval, whereas a discrete random variable can only assume selected numerical values, such as, for example, nonnegative integers. We will study random variables of both kinds.

James V. Lambers Statistical Data Analysis 3 / 56 Introduction Random Variables Uniform Distribution Discrete Probability Distributions Binomial Distribution Rules for Discrete Distributions Hypergeometric Distribution Mean Poisson Distribution Variance and Standard Deviation Continuous Distributions Discrete Probability Distributions

A discrete probability distribution is a listing of all possible values of a discrete random variable, along with the probability of each value being assumed by the variable.

James V. Lambers Statistical Data Analysis 4 / 56 Introduction Random Variables Uniform Distribution Discrete Probability Distributions Binomial Distribution Rules for Discrete Distributions Hypergeometric Distribution Mean Poisson Distribution Variance and Standard Deviation Continuous Distributions Example

Let X be a discrete random variable whose outcomes correspond to where one finishes in a race: first, second, third, etc. If there are 10 runners in the race, then X can assume as a value any positive integer between 1 and 10.

James V. Lambers Statistical Data Analysis 5 / 56 Introduction Random Variables Uniform Distribution Discrete Probability Distributions Binomial Distribution Rules for Discrete Distributions Hypergeometric Distribution Mean Poisson Distribution Variance and Standard Deviation Continuous Distributions The Distribution

The probability distribution might look like the following: x P(X = x) 1 0.1 2 0.15 3 0.23 4 0.18 5 0.15 6 0.1 7 0.04 8 0.02 9 0.02 10 0.01

Note that the notation P(X = x) is used to refer to the probability that the random variable X assumes the value x.

James V. Lambers Statistical Data Analysis 6 / 56 Introduction Random Variables Uniform Distribution Discrete Probability Distributions Binomial Distribution Rules for Discrete Distributions Hypergeometric Distribution Mean Poisson Distribution Variance and Standard Deviation Continuous Distributions Rules for Discrete Distributions

A discrete probability distribution must follow these rules:

I Each outcome must be mutually exclusive of the others; that is, we cannot have X assume two values simultaneously as a the result of an experiment.

I For each outcome x, we must have 0 ≤ P(X = x) ≤ 1.

I If the distribution has n possible outcomes x1, x2,..., xn, then we must have n X P(X = xi ) = 1. i=1

James V. Lambers Statistical Data Analysis 7 / 56 Introduction Random Variables Uniform Distribution Discrete Probability Distributions Binomial Distribution Rules for Discrete Distributions Hypergeometric Distribution Mean Poisson Distribution Variance and Standard Deviation Continuous Distributions Mean

For a given probability distribution, it is very helpful to know the “most likely”, or expected, value that the variable will assume. This can be obtained by computing a weighted mean of the outcomes, where the probabilities serve as the weights. We therefore define the mean, or , of the discrete random variable X by n X E[X ] = µ = xi P(X = xi ). i=1

James V. Lambers Statistical Data Analysis 8 / 56 Introduction Random Variables Uniform Distribution Discrete Probability Distributions Binomial Distribution Rules for Discrete Distributions Hypergeometric Distribution Mean Poisson Distribution Variance and Standard Deviation Continuous Distributions Example

Consider a raffle, in which each ticket costs $5. There is one grand prize of $100, two first prizes of $50 each, and four second prizes of $25 each. If 200 tickets are sold, then the probability of winning the grand prize is 1/200 = 0.005, while the probabilities of winning first prize and second prize are 2/200 = 0.01 and 4/200 = 0.02, respectively. Then, the expected amount of winnings is

E[X ] = 100(0.005) + 50(0.01) + 25(0.02) + 0(0.965) = 1.5.

James V. Lambers Statistical Data Analysis 9 / 56 Introduction Random Variables Uniform Distribution Discrete Probability Distributions Binomial Distribution Rules for Discrete Distributions Hypergeometric Distribution Mean Poisson Distribution Variance and Standard Deviation Continuous Distributions Interpretation

That is, a ticket holder can expect to win, on average, $1.50. However, we must account for the cost of the ticket, which applies to all participants; therefore, the expected net winnings is −$3.50. Since the expected amount is negative, the raffle is not fair to the ticket holders; if the expected value was zero, then the raffle would be considered a “fair game”.

James V. Lambers Statistical Data Analysis 10 / 56 Introduction Random Variables Uniform Distribution Discrete Probability Distributions Binomial Distribution Rules for Discrete Distributions Hypergeometric Distribution Mean Poisson Distribution Variance and Standard Deviation Continuous Distributions Variance and Standard Deviation

Using the mean of X , we can then characterize the dispersion of the outcomes by defining the variance of X as follows:

n 2 X 2 σ = (xi − µ) P(X = xi ). i=1 An equivalent formula, in terms of expected values, is

σ2 = E[X 2] − E[X ]2.

Note that in the first term, the values of X are squared, and then they are multiplied by the probabilities and summed, whereas in the second term, the expected value is computed first, and then squared.

James V. Lambers Statistical Data Analysis 11 / 56 Introduction Uniform Distribution Binomial Distribution Hypergeometric Distribution Poisson Distribution Continuous Distributions Uniform Distribution

The uniform distribution U{a, b} is the probability distribution for a random variable X with domain {a, a + 1,..., b} in which each value in the domain of X is equally likely to be observed It follows that the probability mass function for this distribution is 1 P(X = k) = , n = b − a + 1, k ∈ {a, a + 1,..., b} n

James V. Lambers Statistical Data Analysis 12 / 56 Introduction Uniform Distribution Binomial Distribution Hypergeometric Distribution Poisson Distribution Continuous Distributions Mean and Variance

Using the above definitions of the mean and variance of a discrete random variable, it can be shown that

a + b (b − a + 1)2 − 1 E[X ] = , σ2 = 2 12 If a random variable X has the distribution U{a, b}, we write X ∼ U{a, b} We will use similar notation with other probability distributions, in order to indicate that a given random variable has a particular distribution

James V. Lambers Statistical Data Analysis 13 / 56 Introduction Uniform Distribution Binomial Experiments Binomial Distribution The Binomial Distribution Hypergeometric Distribution The Mean and Standard Deviation Poisson Distribution Continuous Distributions Binomial Experiments

Suppose that an experiment is performed n times, and it can have only two outcomes, that are classified as “success” and “failure”. Each of these individual experiments is referred to as a trial. Furthermore, suppose that each trial is independent of the others, and that the probability of a trial being successful is p, where 0 < p < 1 (and therefore, the probability of failure is q = 1 − p). These trials are called Bernoulli trials.

James V. Lambers Statistical Data Analysis 14 / 56 Introduction Uniform Distribution Binomial Experiments Binomial Distribution The Binomial Distribution Hypergeometric Distribution The Mean and Standard Deviation Poisson Distribution Continuous Distributions Examples

Examples of Bernoulli trials are:

I Testing for defective parts, in which n is the number of parts to be checked, p is the probability that a part is not defective, and k is the number of parts that are not defective.

I Observing the number of correct responses on exam, in which n is the total number of questions, p is the probability of getting the correct answer on a single question, and k is the number of correct responses.

I Counting number of households with an internet connection, in which n is the number of households, p is the probability of a single household having an internet connection, and k is the number of households that have an internet connection.

James V. Lambers Statistical Data Analysis 15 / 56 Introduction Uniform Distribution Binomial Experiments Binomial Distribution The Binomial Distribution Hypergeometric Distribution The Mean and Standard Deviation Poisson Distribution Continuous Distributions The Binomial Distribution

The binomial distribution B(n, p) is the probability distribution for the discrete random variable X whose value is the number of successes, denoted by k, in n Bernoulli trials, with probability of success p for each trial. Given a value for k, 0 ≤ k ≤ n, what is P(X = k), the probability that X is equal to k? First, we note that because the trials are independent, the probability of success (or failure) in consecutive trials can be obtained simply by multiplying the probabilities of the outcomes of the individual trials. It follows that the probability of k successes, followed by n − k failures, is

pk (1 − p)n−k .

James V. Lambers Statistical Data Analysis 16 / 56 Introduction Uniform Distribution Binomial Experiments Binomial Distribution The Binomial Distribution Hypergeometric Distribution The Mean and Standard Deviation Poisson Distribution Continuous Distributions Probability Mass Function

However, to determine the probability that any k of the n trials are successful, we have to consider all possible ways to choose k trials out of the n to be successful.

That is, we must multiply the above expression by nCk . We conclude that the probability mass function for the binomial distribution is n! P(X = k) = C pk (1 − p)n−k = pk (1 − p)n−k . n k k!(n − k)!

Using properties of the binomial coefficients, it can be verified that the sum of all of these probabilities, for k = 0, 1, 2,..., n, is equal to 1.

James V. Lambers Statistical Data Analysis 17 / 56 Introduction Uniform Distribution Binomial Experiments Binomial Distribution The Binomial Distribution Hypergeometric Distribution The Mean and Standard Deviation Poisson Distribution Continuous Distributions Examples

The binomial distribution, for various values of n and p

James V. Lambers Statistical Data Analysis 18 / 56 Introduction Uniform Distribution Binomial Experiments Binomial Distribution The Binomial Distribution Hypergeometric Distribution The Mean and Standard Deviation Poisson Distribution Continuous Distributions Behavior of the Distribution

Note that the binomial distribution is symmetric if p = 0.5, in which case −n the probability mass function simplifies to P(X = k) = nCk 2 . Otherwise, the distribution skews to the left if p < 0.5, because there is a greater probability of more failures, and skews to the right if p > 0.5, since there is a greater probability of more successes.

James V. Lambers Statistical Data Analysis 19 / 56 Introduction Uniform Distribution Binomial Experiments Binomial Distribution The Binomial Distribution Hypergeometric Distribution The Mean and Standard Deviation Poisson Distribution Continuous Distributions The Mean and Standard Deviation

Using the definition of expected value, and properties of binomial coefficients, it can be shown by direct computation, and a lot of algebraic manipulation, that if X is a discrete random variable with a binomial distribution corresponding to n trials and probability of success p, then

E[X ] = µ = np.

It can also be shown that the standard deviation is given by

σ = pnp(1 − p).

James V. Lambers Statistical Data Analysis 20 / 56 Introduction Uniform Distribution Binomial Experiments Binomial Distribution The Binomial Distribution Hypergeometric Distribution The Mean and Standard Deviation Poisson Distribution Continuous Distributions Binomial Distribution in R

In R, the function dbinom can be used to compute probabilities from a binomial distribution. Its first argument is a value, or vector of values, of k (number of successes). The second argument is n, the number of trials, and the third argument is p, the probability of success. An example of its usage is: > dbinom(c(0,1,2,3,4),4,0.5) [1] 0.0625 0.2500 0.3750 0.2500 0.0625 The output lists P(X = k), for k = 0, 1, 2, 3, 4, with p = 0.5 and n = 4.

James V. Lambers Statistical Data Analysis 21 / 56 Introduction Uniform Distribution Binomial Distribution Hypergeometric Distribution Poisson Distribution Continuous Distributions Hypergeometric Distribution

The binomial distribution involves with replacement, because each trial is independent of the other trials. By contrast, the hypergeometric distribution is based on sampling without replacement. Suppose that n trials are to be performed, but the outcomes of these trials are drawn from a set of N + M outcomes, of which N are successes and M are failures. The hypergeometric distribution describes the probability that k of the n trials are successes.

James V. Lambers Statistical Data Analysis 22 / 56 Introduction Uniform Distribution Binomial Distribution Hypergeometric Distribution Poisson Distribution Continuous Distributions Example

A situation that would call for the hypergeometric distribution is the following: Suppose that you have 100 lightbulbs, and you know that 10 of them are defective. If you need 20 lightbulbs and you start taking them from the collection of 100, what is the probability that at most 2 of the chosen lightbulbs are defective?

James V. Lambers Statistical Data Analysis 23 / 56 Introduction Uniform Distribution Binomial Distribution Hypergeometric Distribution Poisson Distribution Continuous Distributions Probability Mass Function

To compute the probability of k successes out of n trials, we need to count the number of ways to choose k objects (the successes) out of a set of N, and then choose n − k objects (the failures) out of a set of M. This is divided by the number of ways to choose n objects from a set of N + M, to obtain the probability mass function

 N   M  k n − k P(X = k) = .  N + M  n

James V. Lambers Statistical Data Analysis 24 / 56 Introduction Uniform Distribution Binomial Distribution Hypergeometric Distribution Poisson Distribution Continuous Distributions Mean and Variance

It can be shown that if X is a random variable that follows the hypergeometric distribution, and p = N/(N + M) is the probability of success in a single trial, then the mean and variance are given by

 n − 1  E[X ] = np, Var(X ) = np(1 − p) 1 − . N + M − 1

It is interesting to note as N + M → ∞ in such a way that p remains fixed, the variance converges to that of the binomial distribution, which makes sense because as the number of outcomes increases, the distinction between sampling with replacement and sampling without replacement diminishes.

James V. Lambers Statistical Data Analysis 25 / 56 Introduction Uniform Distribution Binomial Distribution Hypergeometric Distribution Poisson Distribution Continuous Distributions Example

Continuing the previous example of sampling lightbulbs, the probability of at most two defective lightbulbs (failures), or at least 18 successes, is

P(X ≥ 18) = P(X = 18) + P(X = 19) + P(X = 20)  90   10   90   10   90   10  18 2 19 1 20 0 = + +  100   100   100  20 20 20 = 0.318 + 0.268 + 0.095 = 0.681.

James V. Lambers Statistical Data Analysis 26 / 56 Introduction Uniform Distribution Poisson Processes Binomial Distribution The Poisson Distribution Hypergeometric Distribution Approximating the Binomial Distribution Poisson Distribution Continuous Distributions Poisson Processes

In contrast to Bernoulli trials, in which an experiment consists of a fixed number of trials and the number of successful trials is counted, a Poisson process is an experiment that counts the number of occurrences of a certain outcome over a certain period of time, area, or other domain-defining quantity. In addition, a Poisson process has these defining characteristics:

I The mean number of occurrences must be the same for each interval of measurement, and

I The number of occurrences within an interval must be independent of those in any other interval.

James V. Lambers Statistical Data Analysis 27 / 56 Introduction Uniform Distribution Poisson Processes Binomial Distribution The Poisson Distribution Hypergeometric Distribution Approximating the Binomial Distribution Poisson Distribution Continuous Distributions Examples of Poisson processes

I Car accidents within a particular area

I Requests for documents from a web server

I Calls received by a call center

I Customers entering a queue

James V. Lambers Statistical Data Analysis 28 / 56 Introduction Uniform Distribution Poisson Processes Binomial Distribution The Poisson Distribution Hypergeometric Distribution Approximating the Binomial Distribution Poisson Distribution Continuous Distributions The Poisson Distribution

Suppose a Poisson process has a mean of µ. Then, the probability distribution of the process P(µ) is described by the probability mass function

µk e−µ P(X = k) = , k = 0, 1, 2,.... k! It can be shown that the variance is actually equal to the mean, and √ therefore the standard deviation is µ.

James V. Lambers Statistical Data Analysis 29 / 56 Introduction Uniform Distribution Poisson Processes Binomial Distribution The Poisson Distribution Hypergeometric Distribution Approximating the Binomial Distribution Poisson Distribution Continuous Distributions Various Poisson Distributions

The Poisson distribution P(µ), for various values of µ

James V. Lambers Statistical Data Analysis 30 / 56 Introduction Uniform Distribution Poisson Processes Binomial Distribution The Poisson Distribution Hypergeometric Distribution Approximating the Binomial Distribution Poisson Distribution Continuous Distributions Example

Suppose that a tire manufacturing plant determines that on average, 0.5 defective tires are produced per hour. Then, if X is the random variable for the number of defective tires per hour, the probability that 1 defective tire is produced within the next hour is given by

(0.5)1e−0.5 e−0.5 P(X = 1) = = = 0.303. 1! 2

James V. Lambers Statistical Data Analysis 31 / 56 Introduction Uniform Distribution Poisson Processes Binomial Distribution The Poisson Distribution Hypergeometric Distribution Approximating the Binomial Distribution Poisson Distribution Continuous Distributions Example, cont’d

To determine the probability that at most 3 defective tires will be produced during the next day, where a work day is defined to be 8 hours, we use the fact that the mean is the same for each interval of measurement to determine that on average, 4 defective tires will be produced per day. Then, the probability of at most 3 defective tires is given by

3 X 40e−4 41e−4 42e−4 43e−4 P(X = k) = + + + = 0.433. 0! 1! 2! 3! k=0

James V. Lambers Statistical Data Analysis 32 / 56 Introduction Uniform Distribution Poisson Processes Binomial Distribution The Poisson Distribution Hypergeometric Distribution Approximating the Binomial Distribution Poisson Distribution Continuous Distributions Poisson Distribution in R

The R function dpois gives the probability for given values of k (first argument) with a specified mean µ (second argument). To easily compute cumulative probabilities

n X P(X = k), k=0 use the ppois function. The first argument is n, the highest number of desired outcomes, and the second argument is the mean µ.

James V. Lambers Statistical Data Analysis 33 / 56 Introduction Uniform Distribution Poisson Processes Binomial Distribution The Poisson Distribution Hypergeometric Distribution Approximating the Binomial Distribution Poisson Distribution Continuous Distributions Poisson Distribution in R, cont’d

The following output gives two ways to perform the computation from the preceding example: > sum(dpois(c(0,1,2,3),4)) [1] 0.4334701 > ppois(3,4) [1] 0.4334701

James V. Lambers Statistical Data Analysis 34 / 56 Introduction Uniform Distribution Poisson Processes Binomial Distribution The Poisson Distribution Hypergeometric Distribution Approximating the Binomial Distribution Poisson Distribution Continuous Distributions Approximating the Binomial Distribution

The Poisson distribution can be used to approximate the binomial distribution. This is useful because evaluating the probability mass function

µk e−µ P(X = k) = k! is easier than evaluating the binomial distribution function n! P(X = k) = pk (1 − p)n−k . k!(n − k)!

James V. Lambers Statistical Data Analysis 35 / 56 Introduction Uniform Distribution Poisson Processes Binomial Distribution The Poisson Distribution Hypergeometric Distribution Approximating the Binomial Distribution Poisson Distribution Continuous Distributions Assumptions

The mean np of the binomial distribution can be substituted for the value of µ, the mean of the Poisson distribution. This approximation works well provided that the number of trials n is at least 20, and the probability of success p is quite small, at most 0.05. Otherwise, the Poisson distribution is not a good fit for the binomial distribution curve.

James V. Lambers Statistical Data Analysis 36 / 56 Introduction Uniform Distribution Poisson Processes Binomial Distribution The Poisson Distribution Hypergeometric Distribution Approximating the Binomial Distribution Poisson Distribution Continuous Distributions Assumptions are Important!

Note that in the left plot, the parameters n and p do not satisfy the conditions n ≥ 20, p ≤ 0.05, and therefore the two distributions do not agree very well. In the right plot, the parameters do satisfy the conditions (barely), and the fit is much better.

Approximation of the binomial distribution (blue circles) by the Poisson distribution (red crosses) for n = 15, p = 0.1 (left plot) and n = 20, p = 0.05 (right plot).

James V. Lambers Statistical Data Analysis 37 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Hypergeometric Distribution Poisson Distribution Continuous Distributions Continuous Probability Distribution

Recall that a continuous random variable is a random variable X whose domain is an interval D = [a, b], which is a subset of R, the set of real numbers A continuous probability distribution is a function f : D → [0, 1] whose value at x ∈ D is the probability P(X = x) The function f (x) is the probability density function of X . By analogy with the requirement that the sum of all probabilities in a discrete probability distribution must equal one, a probability density function for a continuous random variable X must satisfy

Z b f (x) dx = 1, a where the interval [a, b] is the domain of X

James V. Lambers Statistical Data Analysis 38 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Mean and Variance

The mean, or expected value, of a continuous random variable X is defined by Z b E[X ] = xf (x) dx a Then, we can define the variance in the same way as for a discrete random variable: Var[X ] = E[X 2] − E[X ]2

James V. Lambers Statistical Data Analysis 39 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Continuous Uniform Distribution

The continuous uniform distribution U(a, b) is the probability distribution for a random variable X with domain [a, b] in which all subintervals of [a, b] of the same width are equally likely to be observed It follows that the probability density function for this distribution is 1 f (x) = , x ∈ [a, b] b − a Using the above definitions of the mean and variance of a continuous random variable, it can be shown that

a + b (b − a)2 E[X ] = , σ2 = 2 12

James V. Lambers Statistical Data Analysis 40 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Continuous Uniform Distribution in R

The R function dunif gives the probability of observing within a subinterval of width 1 centered at x (first argument) on a specified interval [a, b] (second and third arguments). It simply returns 1/(b − a) if a ≤ x ≤ b, and 0 otherwise. To easily obtain cumulative probabilities, use the punif function. The first argument is c, the largest desired outcome, and the second and third arguments are the endpoints a and b, respectively, of the domain of X Finally, given a probability p, the function qunif(p,a,b) returns the value of x (that is, the ) such that P(X ≤ x) = p. It can easily be determined that x = p(b − a) + a

James V. Lambers Statistical Data Analysis 41 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Exponential Distribution

The exponential distribution Exp(λ) is a continuous distribution that describes the time between events in a Poisson process Its parameter λ is a nonnegative real number that is called the rate parameter It refers to the number of events per unit of time that are expected to occur.

James V. Lambers Statistical Data Analysis 42 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions The Particulars

The probability density function for a continuous random variable X ∼ Exp(λ) is f (x) = λe−λx , and its mean and variance are 1 1 E[X ] = , Var[X ] = λ λ2

For example, suppose an operator at a call center receives, on average, two calls per hour. Then the time between calls is a random variable X ∼ Exp(2), and its mean is E[X ] = 1/2. That is, the operator can expect to receive a call every half hour

James V. Lambers Statistical Data Analysis 43 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Example

Suppose that you are renting a car late at night, and there is only one customer service representative working at the counter. On average, he can assist 10 customers per hour, or one customer every 6 minutes. This corresponds to a rate parameter of 1/6 customers per minute. If he just started helping a customer, and you are at the front of the line, what is the probability that you will get to the counter within the next 5 minutes? That probability is

Z 5 1 P(X ≤ 5) = e−x/6 dx = 1 − e−5/6 = 0.57. 0 6 That is, you have a 57% chance of being waited on within 5 minutes.

James V. Lambers Statistical Data Analysis 44 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Normal Distribution

The normal distribution is a probability distribution that is followed by continuous random variables, that can assume any real value within some interval. A normal distribution has two parameters, its mean µ and its standard deviation σ; often, N (µ, σ) is used to refer to a specific normal distribution. Its mean, and are all the same, and equal to µ.

James V. Lambers Statistical Data Analysis 45 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Characteristics

The distribution is “bell-shaped”, and is symmetric around the mean. In view of the essential properties of probability, the area under the entire bell-shaped normal distribution curve must be equal to 1. The probability is always strictly positive; it can never be zero, though the probability approaches zero for values of the variable that are far from the mean. The probability density function is

1 2 2 P(X = x) = √ e−(x−µ) /(2σ ). σ 2π

James V. Lambers Statistical Data Analysis 46 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Normal Distribution in R

This function can be evaluated in R using its function dnorm; for example, dnorm(1,0.5,2) computes P(X = 1) for the normal distribution with mean µ = 0.5 and standard deviation σ = 2. If the third argument is omitted, then σ is assumed to be 1; if the second argument is omitted as well, then µ is assumed to be 0. This corresponds to the notion of the standard normal distribution, that has mean 0 and standard deviation 1.

James V. Lambers Statistical Data Analysis 47 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions The Standard Normal Distribution

The standard normal distribution, with mean 0 and standard deviation 1

James V. Lambers Statistical Data Analysis 48 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Calculating Probabilities

Suppose we wish to determine P(X ≤ x0), which happens to the area of the region bounded by the normal distribution curve, the x-axis, and the vertical line x = x0. As such, this probability would be given by

Z x0 Z x0 1 −(x−µ)2/(2σ2) P(X ≤ x0) = P(X = x) dx = √ e dx, −∞ σ 2π −∞ but this integral cannot be evaluated using analytical techniques from calculus. It must instead be evaluated numerically, which is cumbersome.

James V. Lambers Statistical Data Analysis 49 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions More R Functions

In R, we can use the pnorm function; for example, pnorm(1) computes P(X ≤ 1) for the normal distribution with µ = 0 and σ = 1.

More generally, to compute the probability P(X ≤ x0): pnorm(x0,m,s) where m is the mean and s is the standard deviation

To find the quantile x0 such that P(X ≤ x0) = a: x0=qnorm(a,m,s) As with dnorm, the default values of m and s are 0 and 1, respectively

James V. Lambers Statistical Data Analysis 50 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Tables and z-scores

Tables are often used to evaluate normal distribution probabilities. Such tables use the standard normal distribution N (0, 1); therefore, if a different distribution is being used, a conversion to the standard distribution must be performed first. This involves computing the z-score, x − µ z = . σ If x is a value of the normal distribution N (µ, σ), then z is the corresponding value in N (0, 1); more precisely, it is the number of standard deviations between x and µ.

James V. Lambers Statistical Data Analysis 51 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Using Symmetry

We can now describe how to compute various probabilities using normal distribution tables. In the following, we assume that z0 is the z-score for x0.

I P(X ≤ x0): Obtain P(Z ≤ z0) from a standard normal distribution table, or by using pnorm

I P(X > x0) = 1 − P(X ≤ x0), because the events X > x0 and X ≤ x0 are complementary. That is, they are mutually exclusive and exhaustive, so their probabilities must sum to 1.

I P(X ≤ µ − x0) = 1 − P(X ≤ µ + x0), by the symmetry of the normal distribution.

I P(X > µ − x0) = P(X ≤ µ + x0), again by symmetry.

I P(x1 ≤ X ≤ x2) = P(X ≤ x2) − P(X ≤ x1).

James V. Lambers Statistical Data Analysis 52 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions The Empirical Rule, Revisited

The empirical rule, introduced previously, can be used to estimate normal distribution probabilities. While it is approximately true for any bell-shaped, symmetric distribution, it is exact for any normal distribution. In fact, the rule is derived from the behavior of the normal distribution. Expressed in terms of probabilities, the empirical rule states that

P(−1 ≤ Z ≤ 1) ≈ 0.68, P(−2 ≤ Z ≤ 2) ≈ 0.95, P(−3 ≤ Z ≤ 3) ≈ 0.997.

James V. Lambers Statistical Data Analysis 53 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Approximating the Binomial Distribution

Like the Poisson distribution, the normal distribution can be used to approximate the binomial distribution, as long as the number of trials n and the probability of success p satisfy

np ≥ 5, n(1 − p) ≥ 5.

James V. Lambers Statistical Data Analysis 54 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Un-discretization

For computing probabilities, it is best to use the midpoints of the discrete values of the number of successes. For example, to approximate P(X ≤ 5), where X is a discrete random variable with a binomial distribution, one should work with a continuous random variable Y with a normal distribution

N (np, pnp(1 − p))

and compute P(Y ≤ 4.5), rather than P(Y ≤ 5). This is due to the change from a discrete random variable to a continuous random variable.

James V. Lambers Statistical Data Analysis 55 / 56 Introduction Uniform Distribution Continuous Uniform Distribution Binomial Distribution Exponential Distribution Hypergeometric Distribution Normal Distribution Poisson Distribution Continuous Distributions Example

Approximation of the binomial distribution with n = 30 and p = 0.25 (blue circles) by N (np, pnp(1 − p)) (red curve)

James V. Lambers Statistical Data Analysis 56 / 56