Discrete Random Variables. David Gerard Many slides borrowed from Linda Collins

Similar documents
PROBABILITY THEORY. Prof. S. J. Soni. Assistant Professor Computer Engg. Department SPCE, Visnagar

Notes 12 Autumn 2005

4.2 Probability Models

Thus, P(F or L) = P(F) + P(L) - P(F & L) = = 0.553

Topic 3: The Expectation of a Random Variable

Physics 1140 Lecture 6: Gaussian Distributions

Random variables (section 6.1)

Lecture 10. Variance and standard deviation

Chapter 14. From Randomness to Probability. Copyright 2012, 2008, 2005 Pearson Education, Inc.

STAT2201. Analysis of Engineering & Scientific Data. Unit 3

Notation: X = random variable; x = particular value; P(X = x) denotes probability that X equals the value x.

SDS 321: Introduction to Probability and Statistics

What is a random variable

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Note 16. Random Variables: Distribution and Expectation

STAT 430/510 Probability Lecture 7: Random Variable and Expectation

Dept. of Linguistics, Indiana University Fall 2015

STA 4321/5325 Solution to Extra Homework 1 February 8, 2017

CS 361: Probability & Statistics

Notes 6 Autumn Example (One die: part 1) One fair six-sided die is thrown. X is the number showing.

HW1 Solutions. October 5, (20 pts.) Random variables, sample space and events Consider the random experiment of ipping a coin 4 times.

Random Variables Chris Piech CS109, Stanford University. Piech, CS106A, Stanford University

Algorithms for Uncertainty Quantification

Advantages of Sampling. Cheaper Often the only possible way Better quality control over measurement Investigation can be destructive

STA Module 4 Probability Concepts. Rev.F08 1

Lecture 2: Repetition of probability theory and statistics

Introduction to Probability 2017/18 Supplementary Problems

3 Multiple Discrete Random Variables

Conditional distributions (discrete case)

Lecture 10: Bayes' Theorem, Expected Value and Variance Lecturer: Lale Özkahya

Lecture 16. Lectures 1-15 Review

Review for Exam Spring 2018

Conditional Probability & Independence. Conditional Probabilities

Steve Smith Tuition: Maths Notes

Notice how similar the answers are in i,ii,iii, and iv. Go back and modify your answers so that all the parts look almost identical.

Random Variables. Lecture 6: E(X ), Var(X ), & Cov(X, Y ) Random Variables - Vocabulary. Random Variables, cont.

TOPIC 12: RANDOM VARIABLES AND THEIR DISTRIBUTIONS

Introduction to Stochastic Processes

Bernoulli Trials, Binomial and Cumulative Distributions

Lecture 2 31 Jan Logistics: see piazza site for bootcamps, ps0, bashprob

Debugging Intuition. How to calculate the probability of at least k successes in n trials?

Chapter 2. Random Variable. Define single random variables in terms of their PDF and CDF, and calculate moments such as the mean and variance.

MATH1231 Algebra, 2017 Chapter 9: Probability and Statistics

Probability Theory for Machine Learning. Chris Cremer September 2015

Lecture 10: Probability distributions TUESDAY, FEBRUARY 19, 2019

Central Limit Theorem and the Law of Large Numbers Class 6, Jeremy Orloff and Jonathan Bloom

SDS 321: Introduction to Probability and Statistics

9. DISCRETE PROBABILITY DISTRIBUTIONS

Brief Review of Probability

STAT 430/510: Lecture 10

MP203 Statistical and Thermal Physics. Problem set 7 - Solutions

Class 26: review for final exam 18.05, Spring 2014

Analysis of Engineering and Scientific Data. Semester

Notes 10.1 Probability

p. 4-1 Random Variables

The Practice of Statistics Third Edition

1 Random Variable: Topics

Statistics for Linguists. Don t pannic

COS 424: Interacting with Data. Lecturer: Dave Blei Lecture #2 Scribe: Ellen Kim February 7, 2008

MATH MW Elementary Probability Course Notes Part I: Models and Counting

Elementary Statistics for Geographers, 3 rd Edition

DISCRETE RANDOM VARIABLES: PMF s & CDF s [DEVORE 3.2]

TRANSFORMATIONS OF RANDOM VARIABLES

Lecture 9. Expectations of discrete random variables

Conditional Probability & Independence. Conditional Probabilities

Probability. Paul Schrimpf. January 23, Definitions 2. 2 Properties 3

Deep Learning for Computer Vision

Probability Theory and Simulation Methods

Random variables (discrete)

CMPT 882 Machine Learning

Math 341: Probability Eighth Lecture (10/6/09)

Expectation and Variance

Continuous Distributions

Stochastic processes Lecture 1: Multiple Random Variables Ch. 5

CISC 1100/1400 Structures of Comp. Sci./Discrete Structures Chapter 7 Probability. Outline. Terminology and background. Arthur G.

Notes for Math 324, Part 20

What does independence look like?

MA : Introductory Probability

2. Discrete Random Variables Part II: Expecta:on. ECE 302 Spring 2012 Purdue University, School of ECE Prof. Ilya Pollak

6.041/6.431 Fall 2010 Quiz 2 Solutions

Topic 5 Basics of Probability

Chapter 3: Random Variables 1

Appendix A : Introduction to Probability and stochastic processes

18.440: Lecture 19 Normal random variables

Chap 1: Experiments, Models, and Probabilities. Random Processes. Chap 1 : Experiments, Models, and Probabilities

Probability Distribution. Stat Camp for the MBA Program. Debbon Air Seat Release

Lecture 3. Discrete Random Variables

M378K In-Class Assignment #1

Stochastic processes and stopping time Exercises

Scientific Computing: Monte Carlo

CMPSCI 240: Reasoning Under Uncertainty

Probability Theory. Introduction to Probability Theory. Principles of Counting Examples. Principles of Counting. Probability spaces.

Extra Topic: DISTRIBUTIONS OF FUNCTIONS OF RANDOM VARIABLES

STAT509: Discrete Random Variable

Lecture 8 Sampling Theory

Probability Review. Chao Lan

Lecture 13 (Part 2): Deviation from mean: Markov s inequality, variance and its properties, Chebyshev s inequality

Lecture 1: August 28

18.440: Lecture 26 Conditional expectation

Binomial and Poisson Probability Distributions

n px p x (1 p) n x. p x n(n 1)... (n x + 1) x!

Transcription:

Discrete Random Variables David Gerard Many slides borrowed from Linda Collins 2017-09-28 1

Learning Objectives Random Variables Discrete random variables. Means of discrete random variables. Means of functions of random variables. Variances of discrete random variables. Sections 2.4, 3.3.1, 3.4 in DBC 2

Random Variable Sequence of head/tails in 4 tosses. Possible events: HHHH, HTHT, HHTT,.... In a clinical trial, the list of all people who had side effects: Bob, Lisa, Drake,.... We are usually interested in summary level data, like the number of heads in a toss or the number of people who had side effects. random variable A random variable is a variable whose value is a numerical outcome of a random process. More formally, a random variable is a function from the sample space to the real numbers R. 3

Eample Suppose X is the number of heads on 4 flips of a fair coin. The domain of X is {HHHH, HHHT, HHTH,..., TTTT }. The range of X is {0, 1, 2, 3, 4}. This is also the sample space of X. X (HHHH) = X (HTTH) = X (HTHT ) = 4

Distribution We are interested in the distribution of a random variable what values it can take and how often it takes those values. What is the probability of 0 heads in 4 tosses? 3 heads in 4 tosses? A random variable can have either a discrete or a continuous distribution. 5

Discrete Random Variable Discrete Random Variable A discrete random variable X has possible values that can be given in an ordered list. The probability distribution of X lists the values and their probabilities: Value of X 1 2 3 Probability p 1 p 2 p 3 The probabilities p i must satisfy two requirements: 1. Every probability p i is a number between 0 and 1. 2. p 1 + p 2 + = 1 Find the probability of an event by adding the probabilities p i of the particular values i that make up the event. 6

pmf pmf The probability mass function (pmf) of a random variable maps the outcomes to their individual probabilities. So P( i ) = p i, where Value of X 1 2 3 Probability p 1 p 2 p 3 7

Coin eample Let X = number of heads in 4 tosses of a fair coin. P(X = 1) = P({HTTT, THTT, TTHT, TTTH}) = P(HTTT ) + P(THTT ) + P(TTHT ) + P(TTTH) = 1/16 + 1/16 + 1/16 + 1/16 = 4/16 = 1/4. 8

pmf for X We can summarize the pmf for this X in this table 0 1 2 3 4 f () 1/16 4/16 6/16 4/16 1/16 Note: these probabilities sum to 1: f () = 1/16 + 4/16 + 6/16 + 4/16 + 1/16 = 1 9

Probability Distribution for Discrete Random Variable Can find probabilities of events using pmf: 0 1 2 3 4 f () 1/16 4/16 6/16 4/16 1/16 P(A) = P(X A) A = Event of 3 heads P(A) = P(X = 3) = 4/16 B = Event that all 4 flips result in either all heads or all tails P(B) = P(X = 0 X = 4) = P(X = 0) + P(X = 4) = 1 16 + 1 16 = 2 16 C = Event that at most one of the 4 flips is heads P(C) = P(X 3) = P(X = 3 X = 4) = 4/16 + 1/16 = 5/16 10

The Mean The same way we try to describe the center and spread of data, we often want to describe the center and spread of the distribution of a random variable. Mean (Epected Value) Suppose X is a discrete random variable, then mean of X = E[X ] = all = all = µ P(X = ) f () 11

Mean Intuition I: Benford s Law The first digits of numbers in legitimate financial records often follows Benford s law. 1st Digit 1 2 3 4 5 6 7 8 9 Prob 0.30 0.18 0.13 0.1 0.08 0.07 0.06 0.05 0.05 Etreme deviations from these probabilities can alert investigators to fraud. 12

Mean Intuition II: Calculate Mean E[X ] = 1 0.30 + 2 0.18 + 3 0.13 + 4 0.1 + 5 0.08 + 6 0.07 + 7 0.06 + 8 0.05 + 9 0.05 = 3.441 13

Mean Intuition III: Probability Histogram and Center of Mass Probability Histogram P(X = ) 0.05 0.15 0.25 Mean 2 4 6 8 14

Mean Intuition IV: Average when simulate a lot of data Suppose we chose 100 digits at random using the distribution from Benford s Law Then we would epect about 30 1 s, 18 2 s, 13 3 s, etc... If we take an average of the values we epect, we get: 30 1 + 18 2 + 13 3 + + 5 9 100 = 30 100 1 + 18 100 2 + 13 100 3 + + 5 100 9 = 0.3 1 + 0.18 1 + 0.13 1 + + 0.05 9 = 3.441. Notice that we empirically derived the formula for epected value that we used earlier. 15

Mean Intuition V: Average when simulate a lot of data Recall: most samples of 100 digits won t be eactly equal to 3.441. But if we took a sample of MANY MANY digits, we could get pretty close: ben <- c(0.301, 0.176, 0.125, 0.097, 0.079, 0.067, 0.058, 0.051, 0.046) sample_digits <- sample( = 1:9, size = 10000, prob = ben, replace = TRUE) mean(sample_digits) [1] 3.443 Recall that the mean is 3.441 16

Mean Intuition VI: Average when simulate a lot of data Sample Mean 1.0 2.0 3.0 4.0 True Mean 0 2000 4000 6000 8000 10000 Number of Observations So E[X ] = average when we take a HUGE sample. 17

Functions of a random variable i If X : S R is a random variable, and g : R R is a function then Y = g(x ) is also a random variable with range R Y = g(r X ). 1 if 5 Eample: For Benford s law eample take g() = 0 if > 5. Then Y = g(x ) has range R Y = {1, 0} and distribution f Y (1) = P(Y = 1) = P(X {1, 2, 3, 4, 5}) = 0.778 f Y (0) = P(Y = 0) = P(X {6, 7, 8, 9}) = 0.222. So we can compute the mean: E(Y ) = 1 0.778 + 0 0.222 = 0.778 Sometimes it is difficult to compute the new distribution of Y. It s still easy to compute E(Y ) in terms of the distribution of X. 18

Functions of random variables ii Law of unconscious statistican Suppose we know the pmf of X and Y = g(x ), then K E(Y ) = Eg(X ) = g( k )f X ( k ). k=1 19

Functions of random variables iii 1st Digit 1 2 3 4 5 6 7 8 9 Prob 0.30 0.18 0.13 0.1 0.08 0.07 0.06 0.05 0.05 So in our Benford s law eample we compute E(Y ) =g(1) 0.301 + g(2) 0.176 + g(3) 0.125 + g(4) 0.097 + g(5) 0.079 + g(6) 0.067 + g(7) 0.058 + g(8) 0.051 + g(9) 0.046 =1 0.301 + 1 0.176 + 1 0.125 + 1 0.097 + 1 0.079 + 0 0.067 + 0 0.058 + 0 0.051 + 0 0.046 =0.778. 20

Parameters: Describing the Spread of a r.v. One measure of spread a probability distribution is variance. Variance: The variance of a probability distribution is the average squared distance from the mean. Variance Variance of X = Var(X ) = σ 2 = sigma squared = E[(X µ) 2 ] Variance is in squared units. Take the square root to determine the standard deviation. Standard Deviation of X = Var(X ) = σ = sigma = SD(X ) One standard deviation is roughly the typical distance of outcomes from the mean. 21

A Formula Useful for Calculating Variance of a r.v. This formula is not intuitive! Instead, think of variance as the average squared distance of outcomes from their mean. However, to make calculation of variance easier, we can show that Var(X ) = E[(X µ) 2 ] = E(X 2 ) (µ) 2 E[(X µ) 2 ] = ( µ) 2 f () = = }{{}}{{}}{{} = = 22

A Formula Useful for Calculating Variance of a r.v. This formula is not intuitive! Instead, think of variance as the average squared distance of outcomes from their mean. However, to make calculation of variance easier, we can show that Var(X ) = E[(X µ) 2 ] = E(X 2 ) (µ) 2 E[(X µ) 2 ] = = ( µ) 2 f () ( 2 2µ + µ 2 ) f () = }{{}}{{}}{{} = = 22

A Formula Useful for Calculating Variance of a r.v. This formula is not intuitive! Instead, think of variance as the average squared distance of outcomes from their mean. However, to make calculation of variance easier, we can show that Var(X ) = E[(X µ) 2 ] = E(X 2 ) (µ) 2 E[(X µ) 2 ] = = ( µ) 2 f () ( 2 2µ + µ 2 ) f () = 2 f () }{{} 2µ f () }{{} + µ 2 f () }{{} = = 22

A Formula Useful for Calculating Variance of a r.v. This formula is not intuitive! Instead, think of variance as the average squared distance of outcomes from their mean. However, to make calculation of variance easier, we can show that Var(X ) = E[(X µ) 2 ] = E(X 2 ) (µ) 2 E[(X µ) 2 ] = = ( µ) 2 f () ( 2 2µ + µ 2 ) f () = 2 f () 2µ f () }{{}}{{} = E(X 2 ) = = + µ 2 f () }{{} 22

A Formula Useful for Calculating Variance of a r.v. This formula is not intuitive! Instead, think of variance as the average squared distance of outcomes from their mean. However, to make calculation of variance easier, we can show that Var(X ) = E[(X µ) 2 ] = E(X 2 ) (µ) 2 E[(X µ) 2 ] = = ( µ) 2 f () ( 2 2µ + µ 2 ) f () = 2 f () 2µ f () }{{}}{{} = E(X 2 ) = µ = = + µ 2 f () }{{} 22

A Formula Useful for Calculating Variance of a r.v. This formula is not intuitive! Instead, think of variance as the average squared distance of outcomes from their mean. However, to make calculation of variance easier, we can show that Var(X ) = E[(X µ) 2 ] = E(X 2 ) (µ) 2 E[(X µ) 2 ] = = ( µ) 2 f () ( 2 2µ + µ 2 ) f () = 2 f () 2µ f () }{{}}{{} = E(X 2 ) = µ = = + µ 2 f () } {{ } = 1 22

A Formula Useful for Calculating Variance of a r.v. This formula is not intuitive! Instead, think of variance as the average squared distance of outcomes from their mean. However, to make calculation of variance easier, we can show that Var(X ) = E[(X µ) 2 ] = E(X 2 ) (µ) 2 E[(X µ) 2 ] = = ( µ) 2 f () ( 2 2µ + µ 2 ) f () = 2 f () 2µ f () }{{}}{{} = E(X 2 ) = µ = E(X 2 ) 2µ 2 + µ 2 = + µ 2 f () } {{ } = 1 22

A Formula Useful for Calculating Variance of a r.v. This formula is not intuitive! Instead, think of variance as the average squared distance of outcomes from their mean. However, to make calculation of variance easier, we can show that Var(X ) = E[(X µ) 2 ] = E(X 2 ) (µ) 2 E[(X µ) 2 ] = = ( µ) 2 f () ( 2 2µ + µ 2 ) f () = 2 f () 2µ f () + µ 2 f () }{{}}{{}}{{} = E(X 2 ) = µ = 1 = E(X 2 ) 2µ 2 + µ 2 = E(X 2 ) µ 2 22