Bernoulli and Binomial

Similar documents
More discrete distributions

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

The Normal Distribution

Lecture 08: Poisson and More. Lisa Yan July 13, 2018

a zoo of (discrete) random variables

CSE 312, 2011 Winter, W.L.Ruzzo. 6. random variables

Common Discrete Distributions

Independent random variables

Poisson Chris Piech CS109, Stanford University. Piech, CS106A, Stanford University

Conditional distributions

Binomial in the Limit

Discrete Random Variables

Lecture 10: Probability distributions TUESDAY, FEBRUARY 19, 2019

Continuous Variables Chris Piech CS109, Stanford University

Topic 3: The Expectation of a Random Variable

STAT2201. Analysis of Engineering & Scientific Data. Unit 3

Lecture 10: Normal RV. Lisa Yan July 18, 2018

random variables T T T T H T H H

Lecture 3. Discrete Random Variables

a zoo of (discrete) random variables

Review of Probability. CS1538: Introduction to Simulations

A Probability Primer. A random walk down a probabilistic path leading to some stochastic thoughts on chance events and uncertain outcomes.

3 Multiple Discrete Random Variables

SDS 321: Introduction to Probability and Statistics

Lecture 13. Poisson Distribution. Text: A Course in Probability by Weiss 5.5. STAT 225 Introduction to Probability Models February 16, 2014

Fundamental Tools - Probability Theory II

Will Monroe July 5, with materials by Mehran Sahami and Chris Piech. image: Therightclicks. Independence

Analysis of Engineering and Scientific Data. Semester

Basics on Probability. Jingrui He 09/11/2007

CMPSCI 240: Reasoning Under Uncertainty

Relationship between probability set function and random variable - 2 -

Bernoulli Trials, Binomial and Cumulative Distributions

Chapter 3: Random Variables 1

Topic 3: The Expectation of a Random Variable

Recitation 2: Probability

ELEG 3143 Probability & Stochastic Process Ch. 2 Discrete Random Variables

Math/Stat 352 Lecture 8

MAS113 Introduction to Probability and Statistics

Binomial and Poisson Probability Distributions

An-Najah National University Faculty of Engineering Industrial Engineering Department. Course : Quantitative Methods (65211)

Chapter 3 Discrete Random Variables

Special distributions

Probability Distributions

Special Discrete RV s. Then X = the number of successes is a binomial RV. X ~ Bin(n,p).

Notes 12 Autumn 2005

Outline PMF, CDF and PDF Mean, Variance and Percentiles Some Common Distributions. Week 5 Random Variables and Their Distributions

INF FALL NATURAL LANGUAGE PROCESSING. Jan Tore Lønning

Continuous-Valued Probability Review

Discrete random variables and probability distributions

More on Distribution Function

Expectation of Random Variables

Continuous Random Variables. What continuous random variables are and how to use them. I can give a definition of a continuous random variable.

p. 4-1 Random Variables

Lecture 4: Sampling, Tail Inequalities

Chapter 3: Random Variables 1

Suppose that you have three coins. Coin A is fair, coin B shows heads with probability 0.6 and coin C shows heads with probability 0.8.

To find the median, find the 40 th quartile and the 70 th quartile (which are easily found at y=1 and y=2, respectively). Then we interpolate:

1 Generating functions

Lecture 2: Repetition of probability theory and statistics

CSE 312 Final Review: Section AA

What does independence look like?

Discrete Random Variables

Discrete Random Variables

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 20

4. Discrete Probability Distributions. Introduction & Binomial Distribution

Central Theorems Chris Piech CS109, Stanford University

Random Variable. Pr(X = a) = Pr(s)

3.4. The Binomial Probability Distribution

Guidelines for Solving Probability Problems

Statistical Methods in Particle Physics

Lecture 18: Central Limit Theorem. Lisa Yan August 6, 2018

Massachusetts Institute of Technology

Discrete Random Variable

IAM 530 ELEMENTS OF PROBABILITY AND STATISTICS LECTURE 3-RANDOM VARIABLES

7 Random samples and sampling distributions

Introduction to Probability and Statistics Slides 3 Chapter 3

[POLS 8500] Review of Linear Algebra, Probability and Information Theory

STAT509: Discrete Random Variable

CSE 312, 2012 Autumn, W.L.Ruzzo. 6. random variables T T T T H T H H

MgtOp 215 Chapter 5 Dr. Ahn

EE/CpE 345. Modeling and Simulation. Fall Class 5 September 30, 2002

SDS 321: Introduction to Probability and Statistics

CSE 103 Homework 8: Solutions November 30, var(x) = np(1 p) = P r( X ) 0.95 P r( X ) 0.

Tom Salisbury

Statistics for Economists. Lectures 3 & 4

Probability reminders

Data Mining Techniques. Lecture 3: Probability

ECON Fundamentals of Probability

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

CSE 312: Foundations of Computing II Quiz Section #10: Review Questions for Final Exam (solutions)

The Random Variable for Probabilities Chris Piech CS109, Stanford University

BINOMIAL DISTRIBUTION

X = X X n, + X 2

The Central Limit Theorem

MA/ST 810 Mathematical-Statistical Modeling and Analysis of Complex Systems

CDA6530: Performance Models of Computers and Networks. Chapter 2: Review of Practical Random Variables

ACM 116: Lecture 2. Agenda. Independence. Bayes rule. Discrete random variables Bernoulli distribution Binomial distribution

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

Week 9 The Central Limit Theorem and Estimation Concepts

Probability Theory for Machine Learning. Chris Cremer September 2015

Transcription:

Bernoulli and Binomial Will Monroe July 1, 217 image: Antoine Taveneaux with materials by Mehran Sahami and Chris Piech

Announcements: Problem Set 2 Due this Wednesday, 7/12, at 12:3pm (before class). (Cell phone location sensing)

Announcements: Midterm Two weeks from tomorrow: Tuesday, July 25, 7:-9:pm Tell me by the end of this week if you have a conflict!

Review: Random variables A random variable takes on values probabilistically. 1 P( X =2)= 36 P( X= x) x

Review: Probability mass function The probability mass function (PMF) of a random variable is a function from values of the variable to probabilities. py (k )=P (Y =k ) P(Y =k ) k

Review: Cumulative distribution function The cumulative distribution function (CDF) of a random variable is a function giving the probability that the random variable is less than or equal to a value. F Y (k )=P(Y k ) 1.9.8.7.6 P(Y k ).5.4.3.2.1 2 3 4 5 6 7 k 8 9 1 11 12

Review: Expectation The expectation of a random variable is the average value of the variable (weighted by probability). E [ X ]= p( x) x x : p(x)> E[X] = 7 P( X =x) x

Review: Linearity of expectation Adding random variables or constants? Add the expectations. Multiplying by a constant? Multiply the expectation by the constant. E [ax +by +c ]=ae [ X ]+be [Y ]+c X 2X 2X + 4

Review: Variance Variance is the average square of the distance of a variable from the expectation. Variance measures the spread of the variable. 2 Var( X )=E [( X E [ X ]) ] 2 2 =E [ X ] (E [ X ]) E[X] Var(X) (2.42)2 P( X =x) x

Today: Basic distributions Many types of random variables come up repeatedly. Known frequently-occurring distributions lets you do computations without deriving formulas from scratch. variable family parameters X Bin (n, p) We have independent, INTEGER PLURAL NOUN each of which with probability VERB ENDING IN -S. How many of the REAL NUMBER? REPEAT VERB -S REPEAT PLURAL NOUN

Bernoulli random variable An indicator variable (a possibly biased coin flip) obeys a Bernoulli distribution. Bernoulli random variables can be or 1. X Ber ( p) p X (1)= p p X ()=1 p ( elsewhere)

Review: Indicator variable An indicator variable is a Boolean variable, which takes values or 1 corresponding to whether an event takes place. 1 if event A occurs I= [ A ]= otherwise {

Bernoulli: Fact sheet X Ber ( p) probability of success (e.g., heads)

Program crashes Run a program, crashes with prob. p, works with prob. (1 p) X: 1 if program crashes P(X = 1) = p P(X = ) = 1 - p X ~ Ber(p)

Ad revenue Serve an ad, clicked with prob. p, ignored with prob. (1 p) C: 1 if ad is clicked P(C = 1) = p P(C = ) = 1 - p C ~ Ber(p)

Bernoulli: Fact sheet X Ber ( p)? probability of success (heads, ad click,...) PMF: p X (1)= p p X ()=1 p ( elsewhere) expectation: image (right): Gabriela Serrano

Expectation of an indicator variable 1 if event A occurs I = [ A ]= otherwise { E [ I ]=P( A) 1+[1 P( A)] =P ( A )

Bernoulli: Fact sheet X Ber ( p)? probability of success (heads, ad click,...) PMF: expectation: p X (1)= p p X ()=1 p ( elsewhere) E [ X ]= p variance: image (right): Gabriela Serrano

Variance of a Bernoulli RV p X (1)= p p X ()=1 p 2 2 ( elsewhere) E [ X ]= p 1 +(1 p) 2 =p 2 2 Var( X )=E [ X ] (E [ X ]) 2 = p ( p) = p (1 p)

Bernoulli: Fact sheet? X Ber ( p) probability of success (heads, ad click,...) PMF: expectation: variance: p X (1)= p p X ()=1 p ( elsewhere) E [ X ]= p Var( X )= p(1 p) image (right): Gabriela Serrano

Jacob Bernoulli Swiss mathematician (1654-175) Came from a family of competitive mathematicians (!) image (right): The Gazette Review

Jacob Bernoulli Swiss mathematician (1654-175) Came from a family of competitive mathematicians (!) image (right): The Gazette Review

Binomial random variable The number of heads on n (possibly biased) coin flips obeys a binomial distribution. X Bin (n, p) n p k (1 p)n k if k ℕ, k n p X (k)= k otherwise { ()

Binomial: Fact sheet number of trials (flips, program runs,...) X Bin (n, p) probability of success (heads, crash,...)

Program crashes n runs of program, each crashes with prob. p, works with prob. (1 p) H: number of crashes n pk (1 p)n k P(H = k) = k () H ~ Bin(n, p)

Ad revenue n ads served, each clicked with prob. p, ignored with prob. (1 p) H: number of clicks n pk (1 p)n k P(H = k) = k () H ~ Bin(n, p)

Binomial: Fact sheet number of trials (flips, program runs,...) X Bin (n, p) probability of success (heads, crash,...) PMF: n p k (1 p)n k if k ℕ, k n p X (k )= k otherwise { ()

The Galton board n trials failure success X Bin (n,.5) X = final position = number of successes

PMF of Binomial X Bin (1,.5) P( X =k ) k

PMF of Binomial X Bin (1,.3) P( X =k ) k

Break time!

Binomial: Fact sheet number of trials (flips, program runs,...) X Bin (n, p) probability of success (heads, crash,...) PMF: expectation: n p k (1 p)n k if k ℕ, k n p X (k )= k otherwise { ()

Expectation of a binomial n p k (1 p)n k if k ℕ, k n p X (k)= k otherwise { () n E[ X ]= P( X =k ) k k = n k n k n = p (1 p) k k = k n n! k n k = p (1 p) k =1 (k 1)!(n k )! () n = n n 1 p p (1 p) k 1 k =1 n 1 j n 1 j n 1 n 1 =np p (1 p) =( p+1 p) =np j j= ( ) ( ) k 1 n k

Expectation of a binomial X = number of successes Xi = indicator variable for success on i-th trial n X = X i X i Ber ( p) i=1 n E[ X ]=E [ ] Xi i=1

Review: Linearity of expectation Adding random variables or constants? Add the expectations. Multiplying by a constant? Multiply the expectation by the constant. E [ax +by +c ]=ae [ X ]+be [Y ]+c X 2X 2X + 4

Expectation of a binomial X = number of successes Xi = indicator variable for success on i-th trial n X = X i X i Ber ( p) i=1 n E[ X ]=E [ ] n X i = E [ X i ] i=1 i=1 n = p i=1 =np

Binomial: Fact sheet number of trials (flips, program runs,...) X Bin (n, p) probability of success (heads, crash,...) PMF: expectation: variance: n p k (1 p)n k if k ℕ, k n p X (k )= k otherwise { () E [ X ]=np Var( X )=np(1 p) note: Ber ( p)=bin (1, p)

Eye color Parents each have one brown (B) and one blue (b) gene.* Brown is dominant: Bb brown eyes. Parents have 4 children. X: number of children with brown eyes E [ X ]=np=4.75=3 X Bin (4,.75) *Don t get your genetics information from CS 19! Eye color is influenced by more than one gene.

Eye color Parents each have one brown (B) and one blue (b) gene.* Brown is dominant: Bb brown eyes. Parents have 4 children. X: number of children with brown eyes 3 3 3 1 4 P ( X =3)= (.75) (.25) =4 4.422 3 4 X Bin (4,.75) () *Don t get your genetics information from CS 19! Eye color is influenced by more than one gene.

Sending satellite messages Sending a 4-bit message through space. Each bit corrupted (flipped) with probability p =.1. X: number of bits flipped X ~ Bin(4,.1) (bit flip = success. not much of a success!) 4 4 P ( X =)= (.1) (.9) 4 =(.9).656 ()

Hamming codes Message: 1 1 5 6 3 1 1 1 2 1 7 4 1 Send as: 1 1 1 Receive: 1 1 1 1

Hamming codes Message: 1 1 5 6 3 1 1 2 1 7 4 1 Send as: 1 1 1 Receive: 1 1 1 1 Correct to: 1 1 1

Hamming codes Message: 1 1 5 6 3 1 2 1 7 4 1 Send as: 1 1 1 Receive: 1 1

Hamming codes Message: 1 1 5 6 3 1 1 2 1 7 4 1 Send as: 1 1 1 Receive: 1 1 Correct to: 1 1 1

Sending satellite messages Sending a 4-bit message through space. Each bit corrupted (flipped) with probability p =.1. X: number of bits flipped X ~ Bin(4,.1) P ( X 1)=P ( X =)+ P ( X =1) 7 1 7 1 7 7 = (.1) (.9) + (.1) (.9) 1 7 6 =(.9) +7 (.1) (.9).478+.372=.85 () ()