Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
ST 370
Probability and Statistics for Engineers
Discrete Random Variables
A random variable is a numerical value associated with the outcome
of an experiment.
Discrete random variable
When we can enumerate the possible values of the variable (such as
0, 1, 2, . . . ), the random variable is discrete.
Example: acceptance sampling
Suppose that a sample of size 10 is drawn from a shipment of 200
items, of which some number are non-compliant; X is the number of
non-compliant items in the sample. The possible values of X are 0,
1, 2, . . . , 10, so X is a discrete random variable.
1 / 15
Discrete Random Variables
ST 370
Probability and Statistics for Engineers
Continuous random variable
When the variable takes values in an entire interval, the random
variable is continuous.
Example: flash unit recharge time
Suppose that a cell phone camera flash is chosen randomly from a
production line; the time X that it takes to recharge is a positive real
number; X is a continuous random variable.
Presumably, there is some lower bound a > 0 that is the shortest
possible recharge time, and similarly some upper bound b < ∞ that
is the longest possible recharge time; however, we usually do not
know these values, and we would just say that the possible values of
X are {x : 0 < x < ∞}.
2 / 15
Discrete Random Variables
ST 370
Probability and Statistics for Engineers
Probability distribution
The probability distribution of a random variable X is a description of
the probabilities associated with the possible values of X .
The representation of a probability distribution is different for discrete
and continuous random variables.
Probability mass function
For a discrete random variable, the simplest representation is the
probability mass function (pmf)
fX (x) = P(X = x)
where x is any possible value of X .
3 / 15
Discrete Random Variables
Probability distribution
ST 370
Probability and Statistics for Engineers
Example: acceptance sampling
Suppose one item is chosen at random from a shipment of 200 items,
of which 5 are non-compliant. Let
(
1 if the item is non-compliant,
X =
0 if the item is compliant.
We could say that X is the number of non-compliant items seen.
The probability mass function of X is
(
0.975
fX (x) =
0.025
x =0
x =1
A random variable like X that takes only the values 0 and 1 is called
a Bernoulli random variable.
4 / 15
Discrete Random Variables
Probability distribution
ST 370
Probability and Statistics for Engineers
Example: Dice
Suppose you roll a fair die, and the number of spots showing is X .
Then X is a discrete random variable with probability mass function
1
fX (x) = ,
6
x = 1, 2, 3, 4, 5, 6.
Because the probability is the same for all the possible values of X , it
is called the discrete uniform distribution.
Properties of the probability mass function
They are probabilities: fX (x) ≥ 0.
P
They cover all possibilities: x fX (x) = 1.
5 / 15
Discrete Random Variables
Probability distribution
ST 370
Probability and Statistics for Engineers
Cumulative distribution function
As an alternative to the probability mass function, the probability
distribution of a random variable X can be defined by its cumulative
distribution function (cdf)
FX (x) = P(X ≤ x),
−∞ < x < ∞.
In terms of the probability mass function:
X
fx (xi ), −∞ < x < ∞.
FX (x) =
xi ≤x
FX (·) has a jump at each possible value xi of X , and the jump equals
the corresponding probability fX (xi ), so the probability mass function
can be obtained from the cumulative distribution function.
6 / 15
Discrete Random Variables
Cumulative distribution function
ST 370
Probability and Statistics for Engineers
Example: acceptance sampling
x <0
0
FX (x) = 0.975 0 ≤ x < 1
1
x ≥1
curve(pbinom(x, 1, .025), from = -1, to = 2)
7 / 15
Discrete Random Variables
Cumulative distribution function
ST 370
Probability and Statistics for Engineers
Example: dice
0
1/6
FX (x) = 2/6
...
1
x <1
1≤x <2
2≤x <3
x ≥6
curve(pmax(0, pmin(1, floor(x)/6)), from = 0, to = 7)
8 / 15
Discrete Random Variables
Cumulative distribution function
ST 370
Probability and Statistics for Engineers
Mean and Variance
Mean value
The mean value, or expected value, of a discrete random variable
with probability mass function fX (·) is
X
µX = E (X ) =
xfX (x).
x
E (X ) is a weighted average of the possible values of X , each
weighted by the corresponding probability.
The expected value E (X ) is a typical value of the random variable X ,
in the same way that a sample mean x̄ is a typical value of the
sample x1 , x2 , . . . , xn .
9 / 15
Discrete Random Variables
Mean and Variance
ST 370
Probability and Statistics for Engineers
Example: acceptance sampling
One item is chosen at random from a shipment of 200 items, of
which 5 are non-compliant, and X is the number of non-compliant
items seen:
E (X ) = 0 × fX (0) + 1 × fX (1)
= 0.025.
For any Bernoulli random variable X ,
E (X ) = P(X = 1).
10 / 15
Discrete Random Variables
Mean and Variance
ST 370
Probability and Statistics for Engineers
Example: Dice
Suppose you roll a fair die, and the number of spots showing is X :
E (X ) = 1 × fX (1) + 2 × fX (2) + · · · + 6 × fX (6)
= (1 + 2 + 3 + 4 + 5 + 6)/6
= 3.5.
Note
In these examples and in many others, the “expected” value is not
one of the possible values of the random variable; this is not the
paradox that it is sometimes made out to be!
11 / 15
Discrete Random Variables
Mean and Variance
ST 370
Probability and Statistics for Engineers
Variance
Suppose that X is a random variable with expected value µX . Then
Y = (X − µX )2
is another random variable, and its expected value is
X
E (Y ) =
yfY (y )
y
X
=
(x − µX )2 fX (x).
x
12 / 15
Discrete Random Variables
Mean and Variance
ST 370
Probability and Statistics for Engineers
The variance of X is E (Y ) = E [(X − µX )2 ]:
σX2 = V (X ) = E (X − µX )2 .
The standard deviation of X is
q
σX = σX2 .
13 / 15
Discrete Random Variables
Mean and Variance
ST 370
Probability and Statistics for Engineers
Example: acceptance sampling
For any Bernoulli random variable X ,
µX = P(X = 1) = p, say,
so
σX2 = (0 − p)2 × P(X = 0) + (1 − p)2 × P(X = 1)
= p 2 (1 − p) + (1 − p)2 p
= p(1 − p)
and
σX =
14 / 15
p
p(1 − p).
Discrete Random Variables
Mean and Variance
ST 370
Probability and Statistics for Engineers
Example: Dice
x
x − 3.5
(x − 3.5)2
fX (x)
(x − 3.5)2 fX (x)
1
-2.5
6.25
1.0417
2
-1.5
2.25
3
-0.5
0.25
4
0.5
0.25
5
1.5
2.25
6
2.5
6.25
1
6
1
6
1
6
1
6
1
6
1
6
Total:
2.9168
0.3750
0.0417
0.0417
0.3750
1.0417
So σX2 = 2.917 and σX = 1.708.
15 / 15
Discrete Random Variables
Mean and Variance