Random Variable

Download Report

Transcript Random Variable

Random Variables
Budhi Setiawan
Teknik Sipil - UNSRI
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
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
If the value of X represent flood above mean level, then X > 7 meter
stand for the occurrence of floods above 7 meter
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.
2
Example: Random Variables at an Outdoor
Graduation or Wedding
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)
3
Example: Random Variables:Probability an
Event Occurs 3 Times in 3 Tries
• 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?
Answer to all three questions = 1/8.
Discrete Random Variable X = number of times the
“outcome of interest” occurs in three independent tries.
4
Discrete Random Variables
X the random variable.
k = a number the discrete r.v. could assume.
P(X = k) is the probability that X equals k.
Discrete random variable: can only result in a countable set of possibilities –
often a finite number of outcomes, but can be infinite.
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
5
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.
6
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.
7
Example: How Many Girls? (cont)
Value of X for each simple event:
Probability distribution function for Number of Girls X:
Graph of the pdf of X:
8
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.
9
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)
10
Finding Probabilities for Complex Events
Example: A Mixture of Children
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
pdf for Number of Girls X:
11
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
  E X    xi pi
12
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
Variance of X  V  X    2    xi    pi
2
Standard Deviation of X   
2


x


pi
 i
13
Binomial Random Variables
Class of discrete random variables =
Binomial -- results from a binomial experiment.
Conditions for a binomial experiment:
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.
14
Examples of Binomial Random Variables
A binomial random variable is defined as X=number
of successes in the n trials of a binomial experiment.
15
Finding Binomial Probabilities
n!
nk
k
P X  k  
p 1  p 
k!n  k !
for k = 0, 1, 2, …, n
Example: Probability of Two Wins in Three Plays
p = probability win = 0.2; plays of game are independent.
X = number of wins in three plays.
What is P(X = 2)?
3!
3 2
P X  2 
.2 2 1  .2 
2!3  2 !
 3(.2) 2 (.8)1  0.096
16
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
17
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
3
2
1
0
f
1
3
3
1
18
Binomial Probability Distribution
Frequency Distribution
3
2.5
2
Frequency 1.5
1
0.5
0
0
1
2
3
HITS
19
Probability Associated with Hits
Hits
Frequency
Probability
3
2
1
0
1
3
3
1
.125
.375
.375
.125
20
Binomial Probability Distribution
Frequency Distribution
.500
.375
3
2.5
.250
2
Frequency 1.5
.125
1
0.5
0
0
1
HITS
2
3
21
Binomial Probability Distribution
The preceding bar graph is
symmetrical; this will always
be true for the binomial
distribution when p= 0.5.
22
Expected Value and Standard Deviation
for a Binomial Random Variable
For a binomial random variable X based
on n trials and success probability p,
Mean
  E  X   np
Standard deviation   np1  p 
23
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.
Mean
  E  X   100(.5)  50
Standard deviation   100(.5).5  5
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.
24