24
Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find probabilities Budhi Setiawan Teknik Sipil - UNSRI

Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

Embed Size (px)

Citation preview

Page 1: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

Random Variables

Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find probabilities

Budhi SetiawanTeknik Sipil - UNSRI

Page 2: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

2

What is a Random Variable?

Random Variable: an outcome or event may be identified through the value(s) of a function, which usually denoted with a capital letter

Two different broad classes of random variables:

1. A continuous random variable can take any value in an interval or collection of intervals.

2. A discrete random variable can take one of a countable list of distinct values.

If the value of X represent flood above mean level, then X > 7 meter stand for the occurrence of floods above 7 meter

Page 3: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

3

Random factors that will determine how enjoyable the event is:

Temperature: continuous random variable (any value, integer or decimal)

Number of airplanes that fly overhead: discrete random variable (integer only)

Example: Random Variables at an Outdoor Graduation or Wedding

Page 4: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

4

• What is the probability that three tosses of a fair coin will result in three heads?

• Assuming boys and girls are equally likely, what is the probability that 3 births will result in 3 girls?

• Assuming probability is 1/2 that a randomly selected individual will be taller than median height of a population, what is the probability that 3 randomly selected individuals will all be taller than the median?

Example: Random Variables:Probability an Event Occurs 3 Times in 3 Tries

Answer to all three questions = 1/8.

Discrete Random Variable X = number of times the “outcome of interest” occurs in three independent tries.

Page 5: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

5

Discrete Random Variables

Discrete random variable: can only result in a countable set of possibilities –

often a finite number of outcomes, but can be infinite.

X the random variable.

k = a number the discrete r.v. could assume.

P(X = k) is the probability that X equals k.

Example: It’s Possible to Toss Forever

Repeatedly tossing a fair coin, and define:X = number of tosses until the first head occurs

Any number of flips is a possible outcome.

P(X = k) = (1/2)k

Page 6: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

6

Probability Distribution of a Discrete R.V.

Using the sample space to find probabilities:

Step 1: List all simple events in sample space.

Step 2: Find probability for each simple event.

Step 3: List possible values for random variable X and identify the value for each simple event.

Step 4: Find all simple events for which X = k, for each possible value k.

Step 5: P(X = k) is the sum of the probabilities for all simple events for which X = k.

Probability distribution function (pdf) X is a table or rule that assigns probabilities to possible values of X.

Page 7: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

7

Example:How Many Girls are Likely?

Family has 3 children. Probability of a girl is ?What are the probabilities of having 0, 1, 2, or 3 girls?

Sample Space: For each birth, write either B or G. There are eight possible arrangements of B and G for three births. These are the simple events.

Sample Space and Probabilities: The eight simple events are equally likely.

Random Variable X: number of girls in three births. For each simple event, the value of X is the number of G’s listed.

Page 8: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

8

Example: How Many Girls? (cont)

Probability distribution function for Number of Girls X:

Value of X for each simple event:

Graph of the pdf of X:

Page 9: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

9

Conditions for Probabilities for Discrete Random Variables

Condition 1

The sum of the probabilities over all possible values of a discrete random variable must equal 1.

Condition 2

The probability of any specific outcome for a discrete random

variable must be between 0 and 1.

Page 10: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

10

Cumulative Distribution Function of a Discrete Random Variable

Cumulative distribution function (cdf) for a random variable X is a rule or table that provides the probabilities P(X ≤ k) for any real number k.

Cumulative probability = probability that X is less than or equal to a particular value.

Example: Cumulative Distribution Function for the Number of Girls (cont)

Page 11: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

11

Finding Probabilities for Complex Events

Example: A Mixture of Children

pdf for Number of Girls X:

What is the probability that a family with 3 children will have at least one child of each sex?

If X = Number of Girls then either family has one girl and two boys (X = 1) or two girls and one boy (X = 2).

P(X = 1 or X = 2) = P(X = 1) + P(X = 2) = 3/8 + 3/8 = 6/8 = 3/4

Page 12: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

12

Expectations for Random Variables

The expected value of a random variable is the mean value of the variable X in the sample space, or population, of possible outcomes.

If X is a random variable with possible values x1, x2, x3, . . . , occurring with probabilities p1, p2, p3, . . . , then the expected value of X is calculated as

ii pxXE

Page 13: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

13

Standard Deviation for a Discrete Random Variable

The standard deviation of a random variable is essentially the average distance the random variable falls from its mean over the long run.

If X is a random variable with possible values x1, x2, x3, . . . , occurring with probabilities p1, p2, p3, . . . , and expected value E(X) = , then

ii

ii

pxX

pxXVX

2

22

ofDeviation Standard

of Variance

Page 14: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

14

Binomial Random Variables

1. There are n “trials” where n is determined in advance and is not a random value.

2. Two possible outcomes on each trial, called “success” and “failure” and denoted S and F.

3. Outcomes are independent from one trial to the next.

4. Probability of a “success”, denoted by p, remains same from one trial to the next. Probability of “failure” is 1 – p.

Class of discrete random variables = Binomial -- results from a binomial experiment.

Conditions for a binomial experiment:

Page 15: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

15

Examples of Binomial Random Variables

A binomial random variable is defined as X=number

of successes in the n trials of a binomial experiment.

Page 16: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

16

Finding Binomial Probabilities

p = probability win = 0.2; plays of game are independent.

X = number of wins in three plays.

What is P(X = 2)?

knk ppknk

nkXP

1

!!

!for k = 0, 1, 2, …, n

Example: Probability of Two Wins in Three Plays

096.0)8(.)2(.3

2.12.!23!2

!32

12

232

XP

Page 17: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

17

Binomial Probability Distribution

Binomial distribution is based on events in which there are only two possible outcomes on each occurrence.

Example: Flip a coin 3 times the possible outcomes are (heads = hits; tails =

misses):

HHH, HHT, HTT, TTT, TTH, THH, THT, AND HTH

Page 18: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

18

Binomial Probability Distribution

Example: Flip a coin 3 times the possible outcomes are (call heads = hits; tails = misses):

Possible Outcomes of Coin Flipped 3 times

Outcome No. Hits (x)

HHH

HHT

THH

HTH

HTT

THT

TTH

TTT

3

2

2

2

1

1

1

0

Frequency Dist of data

X f

3

2

1

0

1

3

3

1

Page 19: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

19

Binomial Probability Distribution

0

0.5

1

1.5

2

2.5

3

Frequency

Frequency Distribution

0 1 2 3

HITS

Page 20: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

20

Probability Associated with Hits

Hits Frequency Probability

3

2

1

0

1

3

3

1

.125

.375

.375

.125

Page 21: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

21

Binomial Probability Distribution

0

0.5

1

1.5

2

2.5

3

Frequency

Frequency Distribution

0 1 2 3

HITS

.125

.250

.375

.500

Page 22: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

22

Binomial Probability DistributionBinomial Probability Distribution

The preceding bar graph is symmetrical; this will always be true for the binomial distribution when p= 0.5.

Page 23: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

23

Expected Value and Standard Deviation for a Binomial Random Variable

For a binomial random variable X based on n trials and success probability p,

pnp

npXE

1 deviation Standard

Mean

Page 24: Random Variables Learn how to characterize the pattern of the distribution of values that a random variable may have, and how to use the pattern to find

24

Example: Extraterrestrial Life?

50% of large population would say “yes” if asked, “Do you believe there is extraterrestrial life?”

Sample of n = 100 is taken.

X = number in the sample who say “yes” is approximately a binomial random variable.

In repeated samples of n=100, on average 50 people would say “yes”. The amount by which that number would differ from

sample to sample is about 5.

55.)5(.100 deviation Standard

50)5(.100 Mean

XE