Probability Models

Random Variables/ Probability Models Random Variables  A random variable assumes a value based on the outcome of a random event.  We use a capit...
10 downloads 2 Views 1MB Size
Random Variables/ Probability Models

Random Variables 

A random variable assumes a value based on the outcome of a random event. 

We use a capital letter, like X, to denote a random variable.



A particular value of a random variable will be denoted with the corresponding lower case letter, in this case x.

Random Variables 

There are two types of random variables: 

Discrete random variables can take one of a countable number of distinct outcomes. 



Example: No. of Asthma Attacks, No. of Patients with a disease

Continuous random variables can take any numeric value within a range of values. 

Example: Height, Weight, Cholesterol Levels

Expected Value: Center 

A probability model for a random variable consists of:  



The collection of all possible values of a random variable, and the probabilities that the values occur.

Of particular interest is the value we expect a random variable to take on, notated μ (for population mean) or E(X) for expected value.

Expected Value: Center 

The expected value of a (discrete) random variable can be found by summing the products of each possible value by the probability that it occurs: N

  E(X)   Xi P( Xi ) i1



Note: Be sure that every possible outcome is included in the sum and verify that you have a valid probability model to start with.

Expected Value Example  Population values: 1, 1, 2, 2, 3, 3, 4, 4  E(X) = Mean = (1+1+2+2+3+3+4+4)/8 = 20/8 = 2.5  E(X) = 1*(0.25) + 2*(0.25) + 3*(0.25) + 4*(0.25) = 2.5

Example: Categorical Data: Smoke:Yes(1), No(0) Population values: 1, 0, 0, 1, 1, 1, 1, 0,0,1 E(X) = Mean = (1+0+0+1+1+1+1+0+0+1)/10 = 6/10 = 0.6 E(X) = 1*(0.6) + 0*(0.4) = 0.6

Hypertension Example

Hypertension Example

First Center, Now Spread… 



For data, we calculated the standard deviation by first computing the deviation from the mean and squaring it. We do that with discrete random variables as well. The variance for a random variable is: N

σ 2   [X i  E(X)] 2 P(Xi ) i1



The standard deviation for a random variable is: σ  σ2 

N

2 [X  E(X)] P(Xi )  i i1

Hypertension Example N

σ 2   [X i  E(X)] 2 P(Xi ) i1

Find the standard deviation for the expected number of patients to be brought under control for every 4 who are treated.

More About Means and Variances 

Expected Value of the sum of two random variables:

E(X  Y)  E( X)  E( Y) 

Variance of the sum of two random variables:

Var(X  Y)  σ 2X  Y  σ 2X  σ 2Y  2σ XY 

Standard deviation of the sum of two random variables:

σ X Y  σ 2X Y

More About Means and Variances 

In general, 

The mean of the sum of two random variables is the sum of the means.



The mean of the difference of two random variables is the difference of the means. E(X ± Y) = E(X) ± E(Y)



If the random variables are independent, the variance of their sum or difference is always the sum of the variances.

Var(X ± Y) = Var(X) + Var(Y)

More About Means and Variances 

Adding or subtracting a constant from data shifts the mean but doesn’t change the variance or standard deviation:

E(X ± c) = E(X) ± c

Var(X ± c) = Var(X)

Continuous Random Variables 

Good news: nearly everything we’ve said about how discrete random variables behave is true of continuous random variables, as well.



When two independent continuous random variables have Normal models, so does their sum or difference.



This fact will let us apply our knowledge of Normal probabilities to questions about the sum or difference of independent random variables.

Text Question

Discrete Probability Models 

Bernoulli Trials



We have Bernoulli trials if:  there are two possible outcomes (success and failure). 

the probability of success, p, is constant.



the trials are independent.

Bernoulli Random Variable Let X take values: 0 and 1,

X {0,1}

P(X=1)=p P(X=0)=1-p=q We say that X has a Bernoulli distribution with parameter p. X~Bernoulli(p)

17

The Geometric Model 

A single Bernoulli trial is usually not all that interesting.



A Geometric probability model tells us the probability for a random variable that counts the number of Bernoulli trials until the first success.



Geometric models are completely specified by one parameter, p, the probability of success, and are denoted Geom(p).

Example 

Say 10% of your email is spam.



How many emails do you expect to receive (on average) until you receive an email that is spam?

The Geometric Model 

Independent trials, each having a probability p of being a success, are performed until a success occurs.

Let X = the number of trials required to get a ‘success’ S p FS (1-p)p FFS (1-p)2p FFFS (1-p)3p

P(X=x) = qx-1p Email Example: If p=.10 E(X) = 1/.10 = 10 20

P(X=2)?

The Geometric Model Geometric probability model for Bernoulli trials: Geom(p) p = probability of success q = 1 – p = probability of failure X = number of trials until the first success occurs x-1

P(X = x) = q p 1 E(X)    p



q p2

Problem P(X=x) = qx-1p

The Binomial Model 

A Binomial model tells us the probability for a random variable that counts the number of successes in a fixed number of Bernoulli trials.



Two parameters define the Binomial model: n, the number of trials; and, p, the probability of success. We denote this Binom(n, p).

The Binomial Distribution 

A fixed number of observations, n 



e.g., 15 tosses of a coin; 10 selected patients

Each observation is categorized as to whether or not the “event of interest” occurred 

e.g., head or tail in each toss of a coin; patient has the disease or not



Since these two categories are mutually exclusive 

When the probability of the event of interest is represented as p, then the probability of the event of interest not occurring is 1 – p (often written as q)

The Binomial Distribution 

Constant probability for the event of interest occurring (p) for each observation 



Probability of getting a tail is the same each time we toss the coin

Observations are independent 



The outcome of one observation does not affect the outcome of the other Two sampling methods deliver independence  

Infinite population without replacement Finite population with replacement

Independence 

One of the important requirements for Bernoulli trials is that the trials be independent.



When we don’t have an infinite population, the trials are not independent. But, there is a rule that allows us to pretend we have independent trials: 

The 10% condition: Bernoulli trials must be independent. If that assumption is violated, it is still okay to proceed as long as the sample is smaller than 10% of the population.

Example Population: 50 people, 40 Insured - P(Insured) = 0.80 Select 10 people from pool at random w/o replacement P(10th person insured | Ist 9 insured) = 31/41 = 0.75 Population: 500,000 people, 400,000 Insured - P(Insured) = 0.80 Select 10 people from pool at random w/o replacement

P(10th person insured | Ist 9 insured) = 399,991/499,991 = 0.80 (approximately)

The Binomial Model HTHT

TTHH

HHHT

HHHH

HHHT HHTT HTHT HTTT

THHT THTT TTHT TTTT

They are 16 possible outcomes

HHHH HHTH HTHH HTTH

THHH THTH TTHH TTTH

The probability of getting all heads is 1/16 or (0.5) (0.5) (0.5) (0.5) equal to 0.0625. The probability of getting 50% heads and 50% tails is 6/16 (0.375).

Probability Distribution for the number of heads No. of 0 Heads Proportion: 0.0625

1

2

3

4

0.25

0.375

.25

0.0625

The Binomial Distribution 

In n trials, there are

n! n Cx  X! (n  X)! ways to have k successes. 



Read nCx as “n choose x.”

Note: n! = n ╳ (n – 1) ╳ … ╳ 2 ╳ 1, and n! is read as “n factorial.”

The Binomial Distribution Binomial probability model for Bernoulli trials: Binom(n,p) n = number of trials p = probability of success q = 1 – p = probability of failure X = # of successes in n trials x n–x P(X = x) = nCx p q

n! n Cx  X! (n  X)!

Example

Expected Value and Standard Deviation for a Binomial Random Variable

Text Question (Review Exercises)

The Normal Model to the Rescue! 

When dealing with a large number of trials in a Binomial situation, making direct calculations of the probabilities becomes tedious (or outright impossible).



Fortunately, the Normal model comes to the rescue…

The Normal Model to the Rescue 

As long as the Success/Failure Condition holds, we can use the Normal model to approximate Binomial probabilities. 

Success/failure condition: A Binomial model is approximately Normal if we expect at least 10 successes and 10 failures: np ≥ 10 and nq ≥ 10

Normal approximation to binomial 

Condition: np>=10, n(1-p)>=10



Binomial can be closely approximated by a normal distribution with standardized variable

X  np X  np Z  np(1  p) npq

36

Continuous Random Variables 

When we use the Normal model to approximate the Binomial model, we are using a continuous random variable to approximate a discrete random variable.



So, when we use the Normal model, we no longer calculate the probability that the random variable equals a particular value, but only that it lies between two values.

Text Question Condition: np>=10, n(1-p)>=10

X  np X  np Z  np(1  p) npq

What Can Go Wrong? 

Be sure you have Bernoulli trials. 

You need two outcomes per trial, a constant probability of success, and independence.



Remember that the 10% Condition provides a reasonable substitute for independence.



Don’t confuse Geometric and Binomial models.



Don’t use the Normal approximation with small n. 

You need at least 10 successes and 10 failures to use the Normal approximation.

What have we learned? 

Geometric model 



Binomial model 



When we’re interested in the number of Bernoulli trials until the next success. When we’re interested in the number of successes in a certain number of Bernoulli trials.

Normal model 

To approximate a Binomial model when we expect at least 10 successes and 10 failures.