<<

Introduction Continuous RVs Objectives Uniform Distribution Conclusion Today’s Objectives

By the end of this lecture, you should be able to STAT200: Introductory 1 understand the difference between discrete and continuous random variables; §6.0a: The Uniform 2 know the purpose of the density function; Distribution 3 be able to prove that the density is not a probability; 4 know the purpose of the cumulative distribution function; 5 be able to calculate using geometry or the CDF; and 6 understand the Uniform distribution, its two parameters, its sample space, its , and its .

STAT200: Introductory Statistics 6.0a: The Uniform Distribution 2

Introduction Introduction Continuous RVs Continuous RVs Continuous RVs Continuous RVs Uniform Distribution Near Continuous RVs Uniform Distribution Near Continuous RVs Conclusion Conclusion Continuous RVs Near Continuous RVs

Frequently, a discrete is “essentially” continuous Definition (Continuous Random Variables) because the spacing between adjacent values is insignificant when A continuous random variable is a random variable with a sample compared to the useful data range. space consisting of an interval of values. Examples Examples of near-continuous random variables: 1 GPA Examples 2 Annual salary Examples of continuous random variables: 3 Gross domestic product (GDP) 1 Student height 4 GDP per capita 2 Age of car 5 Crime rate 3 Time spent at a stop light 6 Number of ears of corn grown in Iowa 4 Distance a golf ball goes 7 Number of flu cases in a week

STAT200: Introductory Statistics 6.0a: The Uniform Distribution 3 STAT200: Introductory Statistics 6.0a: The Uniform Distribution 4 Introduction Characteristics of the Uniform Introduction Characteristics of the Uniform Continuous RVs Probability Density Function Continuous RVs Probability Density Function Uniform Distribution Example Uniform Distribution Example Conclusion Cumulative Distribution Function Conclusion Cumulative Distribution Function Function Quantile Function Characteristics of the Uniform Probability Density Function

The probability density function for the Uniform distribution is given Definition (Uniform Distribution) by  1 x ∈ [a, b] The Uniform distribution is a continuous distribution that  b − a describes random variables whose likelihood of occurring is constant f(x; a, b) =  across a specified interval. 0 Otherwise

If the random variable X has a Uniform distribution, we write:

X ∼ U(a, b) It is characterized by these features Two parameters: minimum and maximum values (a and b) Sample space is S = [a, b] E  a+b X = 2 V  (b−a)2 X = 12

STAT200: Introductory Statistics 6.0a: The Uniform Distribution 5 STAT200: Introductory Statistics 6.0a: The Uniform Distribution 6

Introduction Characteristics of the Uniform Introduction Characteristics of the Uniform Continuous RVs Probability Density Function Continuous RVs Probability Density Function Uniform Distribution Example Uniform Distribution Example Conclusion Cumulative Distribution Function Conclusion Cumulative Distribution Function Quantile Function Quantile Function Purposes of pdf Example I: Main and Academy

Example Note that the probability density function has two purposes: 1 To help the researcher understand probability for a continuous There is only one stop light between home and school in the morning. distribution It regularly cycles among green (175s), yellow (5s), and red (180s). 2 To help the researcher calculate probabilities of a continuous Given that I stop at the light, what is the probability that I wait at random variable most 60 seconds?

Important!! Solution: Because the time I wait does not depend on when I get there, and because there is a definite lower- and upper-bound to my wait time (0 Probabilities are areas under the density curve. and 180s), the wait time distribution follows a Uniform distribution. If we define T as the time (in seconds) I spend waiting at this light, then

T ∼ U(0, 180) We are asked to calculate P[T ≤ 60].

STAT200: Introductory Statistics 6.0a: The Uniform Distribution 7 STAT200: Introductory Statistics 6.0a: The Uniform Distribution 8 Introduction Characteristics of the Uniform Introduction Characteristics of the Uniform Continuous RVs Probability Density Function Continuous RVs Probability Density Function Uniform Distribution Example Uniform Distribution Example Conclusion Cumulative Distribution Function Conclusion Cumulative Distribution Function Quantile Function Quantile Function Example I: Main and Academy Example I: Main and Academy

Because the pdf of the Uniform distribution is just a rectangle, and Graphically, this is what we just described because areas in pdfs are probabilities, we just need to calculate the area of the region T ≤ 60. This is just a rectangle. Its area is its height times its width.

From geometry: 1 Height = 180 Width = 60 1 Area (Probability) = 180 × 60 = 0.33333... Thus, the probability of waiting at most 60s is 33.3%.

Doing this in R just requires the following line: punif(60, min=0, max=180)

STAT200: Introductory Statistics 6.0a: The Uniform Distribution 9 STAT200: Introductory Statistics 6.0a: The Uniform Distribution 10

Introduction Characteristics of the Uniform Introduction Characteristics of the Uniform Continuous RVs Probability Density Function Continuous RVs Probability Density Function Uniform Distribution Example Uniform Distribution Example Conclusion Cumulative Distribution Function Conclusion Cumulative Distribution Function Quantile Function Quantile Function Cumulative Distribution Function Uniform CDF

The cumulative distribution function (CDF) is the function that describes F (x) = P[X ≤ x]. This can be easily calculated for the Uniform distribution, in general. Definition (Cumulative Distribution Function) The cumulative distribution function (CDF) of a is defined as

F (x) = P[X ≤ x]

This is frequently difficult to calculate. Usually, it requires integral calculus. However, for the Uniform distribution, we can rely on middle-school geometry.

Remember: Probabilities are just areas under the pdf curve.

STAT200: Introductory Statistics 6.0a: The Uniform Distribution 11 STAT200: Introductory Statistics 6.0a: The Uniform Distribution 12 Introduction Characteristics of the Uniform Introduction Characteristics of the Uniform Continuous RVs Probability Density Function Continuous RVs Probability Density Function Uniform Distribution Example Uniform Distribution Example Conclusion Cumulative Distribution Function Conclusion Cumulative Distribution Function Quantile Function Quantile Function Cumulative Distribution Function Quantile Function

The CDF starts with a value of the random variable, x, and calculates The cumulative distribution function (CDF) is the function that a cumulative probability, p, such that P[X ≤ x] = p. The quantile describes F (x) = P[X ≤ x]. This can be easily calculated for the function starts with a cumulative probability, p, and calculates the Uniform distribution, in general. Let x-value such that P[X ≤ x] = p.

X ∼ U(a, b) The two functions are inverses of each other. That is, Q(p) = F −1(p). Thus, the quantile function for the Uniform P The probability [X ≤ x] is the area of the rectangle with distribution is height f(x) = 1 b−a x − a p = width: x − a b − a p(b − a) = x − a This the cumulative distribution function is p(b − a) + a = x x − a P[X ≤ x] = F (x) = That is, the quantile function for the Uniform distribution is b − a Q(p) = p(b − a) + a

STAT200: Introductory Statistics 6.0a: The Uniform Distribution 13 STAT200: Introductory Statistics 6.0a: The Uniform Distribution 14

Introduction Summary Introduction Summary Continuous RVs The Future Continuous RVs The Future Uniform Distribution R Functions Uniform Distribution R Functions Conclusion Some Readings Conclusion Some Readings Calculus Extra Calculus Extra Uniform Summary The Future

Here is what we learned in this slide deck: Continuous random variables describe different phenomena than discrete random variables In the future, we will Instead of a probability mass function (discrete), there is a examine the probability density function (pdf), which describes a probabilty density, not a probability examine the Probability is the area under the pdf curve practice calculating probabilities using formulas, tables, and R The cumulative distribution function (CDF) is the probability continue thinking about the relationship between the random P[X ≤ x] variables around us and their distributions The Uniform distribution describes a random variable where all values are equally likely a+b The of a Uniform random variable is 2

STAT200: Introductory Statistics 6.0a: The Uniform Distribution 15 STAT200: Introductory Statistics 6.0a: The Uniform Distribution 16 Introduction Summary Introduction Summary Continuous RVs The Future Continuous RVs The Future Uniform Distribution R Functions Uniform Distribution R Functions Conclusion Some Readings Conclusion Some Readings Calculus Extra Calculus Extra R Functions Readings

In this slide deck, we covered two R functions. This is in addition to one we have already experienced and one we will experience: dunif(x, min,max) is the density function, f(x) Course Readings: Hawkes Learning: None P punif(x, min,max) = F (x) = [X ≤ x] R for Starters: Appendix B.1, B.2

runif(n, min,max) gives a random sample from this Supplementary Readings distribution (the random function) Wikipedia: Uniform Distribution (Continuous) qunif(p, min,max) calculates x, such that P[X ≤ x] = p (the quantile function)

STAT200: Introductory Statistics 6.0a: The Uniform Distribution 17 STAT200: Introductory Statistics 6.0a: The Uniform Distribution 18

Introduction Summary Continuous RVs The Future Uniform Distribution R Functions Conclusion Some Readings Calculus Extra Calculus Extra STAT200: Introductory Statistics §6.0a: The Uniform How does one directly calculate the expected value? Calculus! Distribution In general, the expected value is actually defined as Z EX  := xf(x) dx S

Similarly, the variance is defined as

Z VX  := (x − µ)2f(x) dx Ole J. Forsberg S Assistant Professor of Mathematics - Statistics Z Knox College, Galesburg, IL 2 2 [email protected] = x f(x) dx − µ S

STAT200: Introductory Statistics 6.0a: The Uniform Distribution 20 Introduction Summary Introduction Summary Continuous RVs The Future Continuous RVs The Future Uniform Distribution R Functions Uniform Distribution R Functions Conclusion Some Readings Conclusion Some Readings Calculus Extra Calculus Extra Calculus Extra Calculus Extra

For the Uniform distribution, the expected value is For the Uniform distribution, the variance is Z b  2   2 1 a + b Z V X = x dx − EX  := xf(x) dx a b − a 2 S  3 b  2 1 x a + b Z b 1 = − = x dx b − a 3 a 2 a b − a 3 3 1 b − a 1 2 2   2 b = − a + b + 2ab x 1 3 b − a 4 = 2 2 2 b − a a 1 4(b − a)(b + ab + a )  = − 3 a2 + b2 + 2ab 1 b2 − a2  12 b − a = b − a 2 1 = 4b2 + 4ab + 4a2 − 3a2 − 3b2 − 6ab 1 (b − a)(b + a) 12 = 1 2 b − a = b2 − 2ab + a2 a + b 12 = (b − a)2 2 = 12

STAT200: Introductory Statistics 6.0a: The Uniform Distribution 21 STAT200: Introductory Statistics 6.0a: The Uniform Distribution 22