STAT 211 Topic 3

From Notes
Jump to navigation Jump to search

Lecture 5

Lecture 5 Notes

« previous | Tuesday, February 1, 2010 | next »


Random Variables

a function that maps each element in the sample space to a numeric value

Note: Random variables always denoted by uppercase letters

When flipping a coin: if we get heads, we assign 1, if we get tails, we assign 0.

Random variable X so that X(H) = 1 and X(T) = 0
Discrete Variables
Finite number of possible values
EX: gender (male or female); rolling a die (1-6)
Continuous Variables
Possibly infinite number of possible outcomes or along an interval

A random variable that is either 0 or 1 is a Bernoulli random variable


Probability Distribution

Probability Mass Function (PMF)

The PMF is the probability that a trial will result in a certain outcome.

Probability distribution function of a discrete random variable X is a little pX.

p(x)=P(X=x)

Notice that p(x)0 because we can't have negative probability

p(x)=1

Example

Suppose six lots of components are ready to be shipped by a certain supplier. The number of defective components in each lot is as follows:

Lot 1 2 3 4 5 6
Defective Items 0 1 3 0 1 2

Let X be the number of defective items in each lot:

  • P(X=0)=2/6
  • P(X=1)=2/6
  • P(X=2)=1/6
  • P(X=3)=1/6

Cumulative Distribution Function (CDF)

The CDF represents the probability that an observed result will be at most x (ex. rolling a die will be less than 3)

CDF of discrete random variable X with PMF p(x):

F(x)=P(Xx)=y:yxp(y)

Example

Suppose a discrete random variable X gives the face value we get after rolling a die such that x = 1, 2, …, 6

  1 2 3 4 5 6
p(x) 1/6 1/6 1/6 1/6 1/6 1/6
  • F(x<1)=0
  • F(1x<2)=1/6
  • F(2x<3)=1/3
  • F(3x<4)=1/2
  • F(4x<5)=2/3
  • F(5x<6)=5/6
  • F(x6)=1

Complex probability: P(2 ≤ x ≤ 4)

p(2)+p(3)+p(4)=F(4)F(1)=1/2

In General: P(axb)

P(aXb)=F(b)F(a1)

Unfair Coin

Probability of landing on heads and tails is not 50%.

We can "guess" based on many, many, many coin flips, then divide the results by the total trials.


Example

Suppose 3 independent electronic components connected in serial. Let Xi be 1 if the ith component works, and 0 if it fails. Suppose that each component works with probability p

Xi is a discrete variable

PMF

  • pXi(0)=1p
  • pXi(1)=p

Let X be the # of components that work: X can be 0..3

x 0 1 2 3
pX(x) (1p)3 3(1p)2p 3p2(1p) p3

CDF

x 0 1 2 3
FX(x) ...

On average, what is the number of components that work?


Expected Value

Expected value (mean value) of a random variableX is the sum of all possibilities for X multiplied by their PMF; denoted by:

E(X)=xpX(x)

From previous example:

x 0 1 2 3
pX(x) (1p)3 3(1p)2p 3p2(1p) p3

E(X)=0×(1p)3+1×3p(1p)2+2×3p2(1p)+3×p3=3p

Variance of Random Variable

Variance of a random variable X when given PMF:

V(X)=(xE(X))2pX(x)=E(X2)E(X)2

Given our previous example E(X)=3p, we can find the variance:

...

Lecture 6

Lecture 6 Notes

Thursday, February 3, 2011

Review Question

Suppose a local TV station sells 15, 30, and 60 second advertising spots. If X is the length of a randomly selected commercial, we are given the PMF:

x 15 30 60
pX(x) 0.1 0.3 0.6

What is the average length of all commercials on the station? (Expected value)

E(X)=xpX(x)=1.5+9+36=46.5 seconds

What is the variance of the length among all commercials on the station?

V(X)=(xE(X))2pX(x)=99.225+81.675+109.35=290.25 seconds2

Functions of Random Variables

Linear conversion ratios for any function h:

E(h(x))=h(x)pX(x)
V(h(X))=(h(x)E(h(X)))2pX(x)

Special (linear) Cases:

E(aX+b)=aE(X)+b
V(aX+b)=a2V(X)


Binomial Distribution

A Binomial Experiment stisfies the following condisitons:

  1. n = number of independent trials / components
  2. results in success or failure (X = # of successes)
  3. p = probability of success (consistent from trial to trial)
Note: (nk)=nCk=n!(nk)!k!

Written as: XBin(n,p), and if this is the case, the probability of getting x successes is:

P(X=x)=(nx)px(1p)nx
x=0,1,,n

Expected Value of Binomial Distribution

E(X)=pn

Lecture 7

Lecture 7 Notes

Tuesday, February 8, 2011

Binomial Experiments (cont'd)

Example 1

The probability of getting heads by tossing a coin is p. Suppose we toss this coin 4 times:

  1. How many ways can we get only one success (heads)?
    SFFF, FSFF, FFSF, FFFS
  2. What is the probability of getting 1 heads in 4 flips?
    (41)p(1p)3

Example 2

I asked 36 students in my past classes how many times they go out in a week. From the data, the fraction of people who go out at least 4 times per week is 5/36. Suppose I randomly select 5 students among those students:

  1. What is the chance that at least 3 of the 5 students go out at least 4 times a week?
    X = # of students that go out ≥ 4 times/wk among 5 selected students
    X ~ Bin(n = 5, p = 5/36)
    P(X3)=P(x=3)+P(x=4)+P(x=5)=

Example 3

Consider a system with 7 components serially connected. Suppose each component works with probability p=0.4 and work independently:

  1. What is the probability that at most 3 components work?
    X ~ Bin(n = 7, p = 0.4)
    P(X3)=P(x=0)+P(x=1)+P(x=2)+P(x=3)=x=03(7x)0.4x0.67x


Poisson Distribution

Amount of events happening in a fixed unit parameter (time, volume, area, count, etc.)

  • Even though the number of possible outcomes goes to infinity, it is still considered a discrete random variable
  • We need to be given an average rate, well call it λ
  • Written as X ~ Poisson(λ)
pX(x)=p(x;λ)=eλλxx!x=0,1,2,

Expected value = E(X)=λ Variance = V(X)=λ

Example 1

It has been observed that the average number of traffic accidents on the Hollywood Freeway between 7 and 8 AM on Tuesday mornings is 1 per hour. What is the chance that there will be 2 accidents on the Freeway, on some specified Tuesday morning (per hour)?

Let X = # of accidents on freeway in one hour on Tuesday morning: X ~ Poisson(λ = 1)

P(X=2)=pX(2)=e1122!=12e

Example 2

Suppose bacteria distribution in river is 1 per 20 cc. If we draw 10 cc in a test tube:

  1. what is the chance that the sample contains 2 bacteria?
    X = # of bacteria in test tube.
    120=λ10
    P(X=2)=pX(2)=e12(12)22!
  1. what is the chance that the sample contains more than 2 bacteria?
    X ≥ 2 ⇒ P(X ≥ 2) = 1 - P(X ≤ 1)