0% found this document useful (0 votes)
29 views52 pages

Math Lec2 1900

Uploaded by

sabah nushra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views52 pages

Math Lec2 1900

Uploaded by

sabah nushra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

MATHMETICAL ANALYSIS

LECTURE 2

1
RECAP

1. PROBABILITY
2. Conditional PROB.
3. R.V.
4. PMF PDF CDF E[X]
5. Variance
6. TYPES OF Discrete and Continuous RV
7. PRACTICE

2
Random Variable

•A random variable x takes on a defined set of


values with different probabilities.
• For example, if you roll a die, the outcome is random (not fixed)
and there are 6 possible outcomes, each of which occur with
probability one-sixth.
• For example, if you poll people about their voting preferences,
the percentage of the sample that responds “Yes on Proposition
100” is a also a random variable (the percentage will be slightly
differently every time you poll).

3
Random variables can be discrete or
continuous
• Discrete random variables have a countable number of outcomes
• Examples: Dead/alive, treatment/placebo, dice, counts, etc.
• Continuous random variables have an infinite continuum of possible
values.
• Examples: blood pressure, weight, the speed of a car, the real numbers from
1 to 6.

4
Probability functions

• A probability function maps the possible values of


x against their respective probabilities of
occurrence, p(x)
• p(x) is a number from 0 to 1.0.
• The area under a probability function is always 1.

5
Discrete example: roll of a die

p(x)

1/6

x
1 2 3 4 5 6

 P(x)  1
all x
6
Probability mass function (pmf)

x p(x)
1 p(x=1)=1/6

2 p(x=2)=1/6

3 p(x=3)=1/6

4 p(x=4)=1/6

5 p(x=5)=1/6

6 p(x=6)=1/6
7
1.0
Cumulative distribution function (CDF)

1.0 P(x)
5/6
2/3
1/2
1/3
1/6
1 2 3 4 5 6 x

8
Cumulative distribution function

x P(x≤A)
1 P(x≤1)=1/6

2 P(x≤2)=2/6

3 P(x≤3)=3/6

4 P(x≤4)=4/6

5 P(x≤5)=5/6

6 P(x≤6)=6/6
9
PMF

• Calculate the PMF for roll of 2 dices

10
Rolling 2 Dice – Probability Mass Function

11
Examples

1. What’s the probability that you roll a 3 or less?


P(x≤3)=1/2

2. What’s the probability that you roll a 5 or higher?


P(x≥5) = 1 – P(x≤4) = 1-2/3 = 1/3

12
Practice Problem:

• The number of ships to arrive at a harbor on any given day is a random


variable represented by x. The probability distribution for x is:

x 10 11 12 13 14
P(x) .4 .2 .2 .1 .1

Find the probability that on a given day:


a. exactly 14 ships arrive p(x=14)= .1
b. At least 12 ships arrive p(x12)= (.2 + .1 +.1) = .4

c. At most 11 ships arrive


13
p(x≤11)= (.4 +.2) = .6
Important discrete distributions in
epidemiology…
• Binomial
• Yes/no outcomes (dead/alive, treated/untreated, smoker/non-smoker,
sick/well, etc.)
• Poisson
• Counts (e.g., how many cases of disease in a given area)

14
Continuous case

§ The probability function that accompanies a


continuous random variable is a continuous
mathematical function that integrates to 1.
§ The probabilities associated with continuous
functions are just areas under the curve
(integrals!).
§ Probabilities are given for a range of values,
rather than a particular value (e.g., the
probability of getting a math SAT score between
700 and 800 is 2%).

15
Continuous case: “probability density
function” (pdf)

p(x)=e-x

The probability that x is any exact particular value (such as 1.9976) is 0;


we can only assign probabilities to possible ranges of x.
16
For example, the probability of x falling within 1 to 2:

p(x)=e-x

x
1 2

2 2

  e  2  e 1  .135  .368  .23


x x
P(1  x  2)  e  e
1 17
1
Example 2: Uniform distribution

The uniform distribution: all values are equally likely

The uniform distribution:


p(x)
f(x)= 1 , for 1 x 0
1

x
1

We can see it’s a probability distribution because it integrates


to 1 (the area under the curve is 1): 1 1

1  x
0
0
1 0 1
18
Example: Uniform distribution

What’s the probability that x is between ¼ and ½?

p(x)

¼ ½ x
1

P(½ x ¼ )= ¼ 19
Practice Problem

4. Survival drops off rapidly in the year following diagnosis of a certain type
of advanced cancer. Suppose that the length of survival (or time-to-death) is
a random variable that approximately follows an exponential distribution with
parameter 2:

probability function : p( x  T )  2e 2T

 


2 x 2 x
[note : 2e  e  0  1  1]
0
0

What’s the probability that a person who is diagnosed with this


illness survives a year? 20
Answer

The probability of dying within 1 year can be calculated using the cumulative
distribution function:

Cumulative distribution function is:


T
2 x
P ( x  T )  e  1  e  2 (T )
0

The chance of surviving past 1 year is: P(x≥1) = 1 – P(x≤1)

1  (1  e 2(1) )  .135

21
Expected Value and Variance

• All probability distributions are characterized by an expected value


and a variance (standard deviation squared).

22
For example, bell-curve (normal) distribution:

One standard
deviation from the
Mean ()
mean ()

23
Expected value, or mean

• If we understand the underlying probability function of a certain


phenomenon, then we can make informed decisions based on
how we expect x to behave on-average over the long-run…(so
called “frequentist” theory of probability).

• Expected value is just the weighted average or mean (µ) of


random variable x. Imagine placing the masses p(x) at the points
X on a beam; the balance point of the beam is the expected value
of x.

24
Example: expected value

• Recall the following probability distribution of


ship arrivals:

x 10 11 12 13 14
P(x) .4 .2 .2 .1 .1

 x p( x)  10(.4)  11(.2)  12(.2)  13(.1)  14(.1)  11 .3


i 1
i

25
Expected value, formally

Discrete case:

E( X )   x p(x )
all x
i i

Continuous case:

E( X )  
all x
xi p(xi )dx
26
Extension to continuous case:
uniform distribution

p(x)

x
1

1
x2 1
1 1

E ( X ) x (1) dx 
0
2 0

2
0
2
27
Symbol Interlude

• E(X) = µ
• these symbols are used interchangeably

28
Expected Value

• Expected value is an extremely useful concept for good decision-


making!

29
Example: the lottery

• The Lottery (also known as a tax on people who are


bad at math…)
• A certain lottery works by picking 6 numbers from 1
to 49. It costs $1.00 to play the lottery, and if you
win, you win $2 million after taxes.

• If you play the lottery once, what are your expected


winnings or losses?

30
Lottery

Calculate the probability of winning in 1 try:

1 1 1 “49 choose 6”
   7.2 x 10 -8
 49  49! 13,983,816
  Out of 49 numbers,
6 43!6!
this is the number
of distinct
combinations of 6.
The probability function (note, sums to 1.0):
x$ p(x)
-1 .999999928

+ 2 million 7.2 x 10--8


31
Expected Value

The probability function


x$ p(x)
-1 .999999928

+ 2 million 7.2 x 10--8

Expected Value
E(X) = P(win)*$2,000,000 + P(lose)*-$1.00
= 2.0 x 106 * 7.2 x 10-8+ .999999928 (-1) = .144 - .999999928 = -$.86

Negative expected value is never good!


You shouldn’t play if you expect to lose money!
32
Expected Value

If you play the lottery every week for 10 years, what are your
expected winnings or losses?

520 x (-.86) = -$447.20

33
Practice Problem

If X is a random integer between 1 and 10, what’s the expected


value of X?

34
Answer

If X is a random integer between 1 and 10, what’s the expected value of


X?

10 10
1 1 10(10  1)

  E ( x)  i( ) 
i 1 10 10
 i
i  (.1)
2
 55(.1)  5.5

35
Law of Large numbers

• Empirical data can be used to estimate the probability mass


function. Consider, for example, the number of TVs in a
household. . .
• No. of TVs No. of Households x P(x)
0 1,218 0 0.012
1 32,379 1 0.319
2 37,961 2 0.374
3 19,387 3 0.191
4 7,714 4 0.076
5 2,842 5 0.028
101,501 1.000
• For x = 0, the probability 0.012 comes from 1,218/101,501.
• Other probabilities are estimated similarly

36
Law of Large numbers

• Empirical data can be used to estimate the probability mass


function. Consider, for example, the number of TVs in a
household. . .
• No. of TVs No. of Households x P(x)
0 1,218 0 0.012
1 32,379 1 0.319
2 37,961 2 0.374
3 19,387 3 0.191
4 7,714 4 0.076
5 2,842 5 0.028
101,501 1.000
• For x = 0, the probability 0.012 comes from 1,218/101,501.
• Other probabilities are estimated similarly

37
Law of Large numbers

• The correct answer is that the expected value


should be interpreted as a long-run average.
Formally, let x1, x2, . . . , xn be n (independent)
realizations of X;
• Such a statement is called a law of large numbers.
• Thus, in the previous example, the average number
of TVs in a large number of randomly-selected
households will approach the expected value 2.084.

38
Expected value isn’t everything though…

• Take the show “Deal or No Deal”


• Everyone know the rules?
• Let’s say you are down to two cases left. $1 and
$400,000. The banker offers you $200,000.
• So, Deal or No Deal?

39
Expected value isn’t everything though…

• Take the show “Deal or No Deal”


• Everyone know the rules?
• Let’s say you are down to two cases left. $1 and
$400,000. The banker offers you $200,000.
• So, Deal or No Deal?

40
Deal or No Deal…

• This could really be represented as a probability distribution and a


non-random variable:

x$ p(x)
+1 .50

+$400,000 .50

x$ p(x)
+$200,000 1.0 41
Expected value doesn’t help…

x$ p(x)
+1 .50

+$400,000 .50

  E(X )  x
all x
i p(x i )   1(. 50 )  400 ,000 (. 50 )  200 ,000

x$ p(x)
+$200,000 1.0

  E ( X )  200,000 42
Practice Problem

Two dice are thrown and their score added together.


If p (X=x) = 1/18 . x??

43
Practice Problem

A continuous Random Variable, X, follows a Uniform Distribution so


that the probability of any value between 2 and 5 is p

What is the value of p?

44
Practice Problem
Two cards are chosen randomly from a standard deck of fifty two
cards. Suppose that we win $2 for each spade selected and we lose
$1 for each heart or diamond selected, we neither win nor lose if we
pick a club.
Let X denote our winnings.
What are the possible values of X, and what is the probability mass
function of X?

45
Practice Problem
• If you pick 2 cards that are either hearts or diamonds, you “win” X =
−2 dollars.

This happens with probability :


pX(−2) = P(X = −2)
= 26 C 2 / 52 C 2
= 25/102
• If you pick one spade and the other one is either heart or diamond,
you win X = 1 dollar??

46
Practice Problem

You’re a telemarketer selling service contracts for Macy’s. You’ve sold


20 in your last 100 calls (p = .20). If you
call 12 people tonight, what’s the probability of
A. No sales?
B. Exactly 2 sales?
C. At most 2 sales?
D. At least 2 sales?

47
Practice Problem

n = 12, p = .20
A. p(0) = .0687
B. p(2) = .2835
C. p(at most 2) = p(0) + p(1) + p(2)
= .0687 + .2062 + .2835
= .5584
D. p(at least 2) = p(2) + p(3)...+ p(12)
= 1 – [p(0) + p(1)]
= 1 – .0687 – .2062
= .7251

48
Practice Problem

Light bulb life has a normal distribution with = 2000 hours and =
200 hours. What’s the probability that a bulb will last

between 2000 and 2400 hours?

49
Poisson Probability Distribution
Function
x –
e
p (x )  (x = 0, 1, 2, 3, . . .)
x!


p(x) = Probability of x given 
 = Mean (expected) number of events in unit
e = 2.71828 . . . (base of natural logarithm)
x = Number of events per unit
© 2011 Pearson Education, Inc
Poisson Probability Distribution
Function
Customers arrive at a rate of 72 per hour.
What is the probability of 4 customers arriving in 3
minutes?

© 2011 Pearson Education, Inc


Poisson Distribution Solution

72 Per Hr. = 1.2 Per Min. = 3.6 Per 3 Min. Interval


-
 e
x
p( x) 
x!
 3.6 
4 -3.6
e
p (4)   .1912
4!

© 2011 Pearson Education, Inc

You might also like