Download Understanding Probability Theory: Random Variables, Expectation, & Discrete Distributions and more Slides Java Programming in PDF only on Docsity! Today • Random variables • Expectation • Examples of discrete random variables • Bernoulli random variables • Binomial random variables • Geometric random variables • Poisson random variables • Power law distributions (didn’t get to this.. next time!) Docsity.com Review of Probability Definitions • An experiment is an activity that results in exactly one of several possible outcomes. • The set of all possible outcomes of an experiment is called the sample space, typically denoted Ω. • An event is a collection of outcomes – that is, a subset of the sample space. • The atomic events are the basic, fundamental elements of the sample space. They are always mutually exclusive and exhaustive. Docsity.com Random Variables A random variable is a real-valued function of the outcome of an experiment…. though we won’t always write them as a function. Example: Suppose we roll two six-sided dice. • Sample space Ω ={11, 12, 13, ..., 66} • Random variables: the sum of the two rolls, the number of sixes rolled, the product of the two rolls, the value of the first roll, the number of even rolls, etc. Docsity.com Random Variables Example: Suppose we have four disks, each of which fails with probability p. • Sample space Ω ={0000, 0001, 0010, ..., 1111} • Random variables: the number of disks that failed, a Boolean value indicating if one of the first two disks failed, a Boolean value indicating if at least one disk failed, etc. Docsity.com Random Variables A random variable is called discrete if the set of values that it can take on is finite or countably infinite. For the next few lectures, we will only discuss random variables that are discrete. Docsity.com Probability Mass Functions The probability mass function (PMF) of a random variable X is denoted pX. For any value k that X can take on, pX(k) is the probability of the event {X=k}, so pX(k) = P(X=k) = P({X=k}) Example: Suppose we flip a fair coin twice. Let X be the number of heads. What is pX(0)? What is pX(1)? Docsity.com Probability Mass Function • Let P(X∈S) denote the probability that X takes on a value in the set S. How can we calculate this? Docsity.com Probability Mass Function • Let P(X∈S) denote the probability that X takes on a value in the set S. How can we calculate this? € P(X ∈ S) = pX (k) values k∈S ∑ Docsity.com Bernoulli Random Variables • Consider a biased coin that lands on heads with probability p. Let X be a random variable that takes on the value 1 if the coin is heads and 0 if the coin is tails. Such a variable is called a Bernoulli random variable. Docsity.com Bernoulli Random Variables • Consider a biased coin that lands on heads with probability p. Let X be a random variable that takes on the value 1 if the coin is heads and 0 if the coin is tails. Such a variable is called a Bernoulli random variable. • Examples: A server can be online or not. A new email that you receive can be spam or not. A web user can click or not click on an ad that is displayed. Docsity.com Bernoulli Random Variables • Consider a biased coin that lands on heads with probability p. Let X be a random variable that takes on the value 1 if the coin is heads and 0 if the coin is tails. Such a variable is called a Bernoulli random variable. • Examples: A server can be online or not. A new email that you receive can be spam or not. A web user can click or not click on an ad that is displayed. • The probability mass function is defined as follows: pX(1) = p pX(0) = 1-p Docsity.com Binomial Random Variables • Suppose we flip the biased coin n times. Let X be the total number of heads that we see. Such a variable is called a binomial random variable. • Examples: Number of our n servers that are online, number of emails that are spam when we receive n emails, number of users who click on an ad when n users come to a site. • How can we calculate pX(k) for a particular value of k? Docsity.com Geometric Random Variables • Suppose we flip the biased coin repeatedly until it lands on heads. Let X be the number of times that we have to flip it. Such a variable is called a geometric random variable. Docsity.com Geometric Random Variables • Suppose we flip the biased coin repeatedly until it lands on heads. Let X be the number of times that we have to flip it. Such a variable is called a geometric random variable. • Examples: Number of emails we receive until one is spam (including the spam email), number of users who come to a site until one clicks the ad (including the one who clicks). Docsity.com Expectation • The expected value of a random variable X with probability mass function pX is • We sometimes call this the expectation or mean of X. € E[X] = xpX (x) x ∑ Docsity.com Expectation • The expected value of a random variable X with probability mass function pX is • We sometimes call this the expectation or mean of X. • This is simply the value we’d expect to get for X “on average” if we repeated the same experiment many times. € E[X] = xpX (x) x ∑ Docsity.com Expectation • What is the expected value of a Bernoulli random variable with parameter p? Docsity.com Poisson Random Variables • Consider a book containing n words. Suppose that the probability of any particular word being misspelled is p. Let X be the number of words that are misspelled. Docsity.com Poisson Random Variables • Consider a book containing n words. Suppose that the probability of any particular word being misspelled is p. Let X be the number of words that are misspelled. • We could model X as a binomial random variable, but when n is large and p is small, it is often more convenient to model it as a Poisson random variable. Docsity.com Poisson Random Variables • A Poisson random variable with parameter λ takes on values in {0, 1, 2, ...} and has the PMF • The expected value is simply λ € pX (k) = e−λλk k! Docsity.com