4.1 - Discrete Models PDF
4.1 - Discrete Models PDF
1-1
FACT: Random variables can be used to define events that involve measurement!
Experiment 3a: Roll one fair die... Discrete random variable X = “value obtained”
Sample Space: S = {1, 2, 3, 4, 5, 6} #(S) = 6
Because the die is fair, each of the six faces has an equally likely probability of
occurring, i.e., 1/6. The probability distribution for X can be defined by a so-called
probability mass function (pmf) p(x), organized in a probability table, and
displayed via a corresponding probability histogram, as shown.
4 1/6
5 1/6
6 1/6
1 X
Comment on notation:
P( X 4 ) = 1/6
Event
Likewise for the other probabilities P(X = 1), P(X = 2),…, P(X = 6) in this example.
A mathematically succinct way to write such probabilities is by the notation P(X = x),
where x = 1, 2, 3, 4, 5, 6. In general therefore, since this depends on the value of x,
we can also express it as a mathematical function of x (specifically, the pmf; see
above), written p(x). Thus the two notations are synonymous and interchangeable.
The previous example could just as well have been written f(4) = 1/6.
Ismor Fischer, 5/26/2016 4.1-2
Experiment 3b: Roll two distinct, fair dice. Outcome = (Die 1, Die 2)
x p(x) = P(X = x)
2 1/36
3 2/36
4 3/36
6
5 4/36 36
5 5
6 5/36 36 36
7 6/36 4 4
36 36
8 5/36 3 3
9 4/36 36 36
2 2
10 3/36 1 36 36 1
11 2/36 36 36
12 1/36
3 5 7 9 11
1
P(5 X 8)
= P(X = 5 or X = 6 or X = 7 or X = 8)
= P(X = 5) + P(X = 6) + P(X = 7) + P(X = 8)
= 4/36 + 5/36 + 6/36 + 5/36
= 20/36
2 3 4 5 6 7 8 9 10 11 12
Definition: p(x) is a probability mass function for the discrete random variable X if,
for all x,
p(x) 0 AND p( x) = 1.
all x
In this case, p(x) = P(X = x), the probability that the value x occurs in the population.
The cumulative distribution function (cdf) is defined as, for all x,
F(x) = P(X x) = p( xi ) = p(x1) + p(x2) + … + p(x).
all xi x
Total Area = 1
Exercise: Sketch the cdf F(x)
for Experiments 3a and 3b above.
1
F(x3)
p(x2)
p(x3) F(x2)
p(x1)
… F(x1)
p(x)
…
| | | | X | | | | X
0
x1 x2 x3 … x … x1 x2 x3 … x …
Ismor Fischer, 5/26/2016 4.1-5
Compare this with the relative frequency definition of sample mean given in §2.3.
Compare the first with the definition of sample variance given in §2.3.
(The second is the analogue of the alternate computational formula.) Of course,
the population standard deviation σ is defined as the square root of the variance.
*Exercise: Algebraically expand the expression (X )2, and use the properties of expectation given above.
Ismor Fischer, 5/26/2016 4.1-6
Population 1
10%
0.4
2300
40% 20% 0.3
2600 2400
0.2
2500
0.1
30%
Probability Table
x p1(x)
Mean(X1) = µ1 = (2300)(0.1) + (2400)(0.2) +
2300 0.1
(2500)(0.3) + (2600)(0.4) = 2500 cals
2400 0.2
2500 0.3 Var(X1) = σ12 = (–200)2(0.1) + (–100)2(0.2) +
(0)2(0.3) + (+100)2(0.4) = 10000 cals2
2600 0.4
Population 2
20%
2200 0.5
50% 2400
2300 0.3
30% 0.2
Probability Table
x p2(x)
2200 0.2 Mean(X2) = µ2 = (2200)(0.2) + (2300)(0.3) + (2400)(0.5) = 2330 cals
2300 0.3
Var(X2) = σ22 = (–130)2(0.2) + (–30)2(0.3) + (70)2(0.5) = 6100 cals2
2400 0.5
Ismor Fischer, 5/26/2016 4.1-7
Summary (Also refer back to 2.4 - Summary)
POPULATION
Discrete random variable X
x p(x) = P(X = x)
x1 f(x1)
x2 f(x2)
. .
. .
X
. .
= E[X] = x p(x)
Parameters
1
E[(X )2] = (x )2 p(x)
2
= or
E[X2] 2
= x2 p(x) 2
SAMPLE, size n
xk p(xk) E S2 2
.
n
(x x )2 p(x) (In fact, they
n 1 are MVUE.)
1 s2 = or
n
n 1
[ x2 p(x) x 2
]
Ismor Fischer, 5/26/2016 4.1-8
or equivalently,* = E ˆ 2 E[ ˆ] 2 .
c ˆ Vector interpretation
c = a+b
b E[ ˆ]
E[c2 ] E[a2 ] E[b 2 ]
a ˆ E[ ˆ]
*
using the basic properties of mathematical expectation given earlier
Ismor Fischer, 5/26/2016 4.1-9
Related (but not identical) to this is the idea that of all linear combinations
c1x1 c2 x2 cn xn of the data {x1, x2 , , xn} (such as X , with c1 c2 cn 1/ n )
which are also unbiased, the one that minimizes MSE is called BLUE (Best Linear
Unbiased Estimator). It can be shown that, in addition to being MVUE (as stated
above), X is also BLUE. To summarize,
Minimum Minimum
Variance MSE
MVUE
Unbiased Linear
Population 1 Population 2
10%
20%
2300
2200
40% 20%
2600 2400
50% 2400
2300
2500
30%
30%
x p1(x) x p2(x)
2300 0.1
2200 0.2
2400 0.2
2300 0.3
2500 0.3
2600 0.4 2400 0.5
Mean(X1) = µ1 = 2500 cals; Mean(X2) = µ2 = 2330 cals;
Var(X1) = σ12 = 10000 cals2 Var(X2) = σ22 = 6100 cals2
Case 1: First suppose that X1 and X2 are statistically independent, as shown in the joint probability
distribution given in the table below. That is, each cell probability is equal to the product of the
corresponding row and column marginal probabilities. For example, P(X1 = 2300 ∩ X2 = 2200) = .02,
but this is equal to the product of the column marginal P(X1 = 2300) = .1 with the row marginal
P(X2 = 2200) = .2. Note that the marginal distributions for X1 and X2 remain the same as above, as can
be seen from the single-underlined values for X1, and respectively, the double-underlined values for X2.
Now imagine that we wish to compare the two populations, by considering the
probability distribution of the calorie difference D = X1 – X2 between them. (The sum
S = X1 + X2 is similar, and left as an exercise.)
As an example, there are two possible ways that D = 300 can occur, i.e., two possible
outcomes corresponding to the event D = 300: Either A = “X1 = 2500 and X2 = 2200”
or B = “X1 = 2600 and X2 = 2300,” that is, A ⋃ B. For its probability, recall that
P( A B) P( A) P( B) P( A B). However, events A and B are disjoint, for they
cannot both occur simultaneously, so that the last term is P(A ⋂ B) = 0. Thus,
P( A B) P( A) P( B) with P(A) = .06 and P(B) = .12 from the joint distribution.
Mean(D) = µD =
(–100)(.05) + (0)(.13) + (100)(.23) +
(200)(.33) + (300)(.18) + (400)(.08)
.33
= 170 cals
i.e., µD = µ1 – µ2 (Check this!)
.23
.18
Var(D) = σD2 =
.13
.08 (–270)2(.05) + (–170)2(.13) + (–70)2(.23)
.05
+ (30)2(.33) + (130)2(.18) + (230)2(.08)
= 16100 cals2
i.e., σD2 = σ12 + σ22 (Check this!)
Ismor Fischer, 5/26/2016 4.1-12
Case 2: Now assume that X1 and X2 are not statistically independent, as given in the
joint probability distribution table below.
The events “D = d” and the corresponding sample space of outcomes remain unchanged,
but the last column of probabilities has to be recalculated, as shown. This results in a
slightly different probability histogram (Exercise) and parameter values.
It seems that “the mean of the difference is equal to the difference in the means” still
holds, even when the two populations are dependent. But the variance of the difference
is no longer necessarily equal the sum of the variances, as with independent populations.
Ismor Fischer, 5/26/2016 4.1-13
These examples illustrate a general principle that can be rigorously proved with mathematics.
GENERAL FACT ~
Comments:
These formulas actually apply to both discrete and continuous variables (next section).
The difference relations will play a crucial role in 6.2 - Two Samples inference.
If X and Y are dependent, then the two bottom relations regarding the variance also
involve an additional term, Cov(X, Y), the population covariance between X and Y.
See problems 4.3/29 and 4.3/30 for details.
The variance relation can be interpreted visually via the Pythagorean Theorem,
which illustrates an important geometric connection, expanded in the Appendix.]
Certain discrete distributions (or discrete models) occur so frequently in practice, that
their properties have been well-studied and applied in many different scenarios. For
instance, suppose it is known that a certain population consists of 45% males (and thus
55% females). If a random sample of 250 individuals is to be selected, then what is the
probability of obtaining exactly 100 males? At most 100 males? At least 100 males?
What is the “expected” number of males? This is the subject of the next topic:
Ismor Fischer, 5/26/2016 4.1-14
Questions:
How can we model the probability
distribution of X, and under what
assumptions?
Probabilities of events, such as
P( X 0), P( X 20), P( X 20),
etc.?
Full article available online at this link.
Mean # BCIS cases = ?
Standard deviation of # BCIS cases = ?
Ismor Fischer, 5/26/2016 4.1-15
n
Recall: For x = 0, 1, 2, …, n, the combinatorial symbol x – read “n-choose-x” – is
n!
defined as the value , and counts the number of ways of rearranging x objects
x! (n x)!
among n objects. See Appendix > Basic Reviews > Perms & Combos for details.
n
r is computed via the mathematical function “nCr” on most calculators.
Note:
Ismor Fischer, 5/26/2016 4.1-16
Probabilities:
First assume the coin is fair ( = 0.5 1 = 0.5), i.e., equally likely elementary
outcomes H and T on a single trial. In this case, the probability of any event A above
can thus be easily calculated via P(A) = #(A) / #(S).
1 5
x P(X = x) =
25 x Total Area = 1
0 1/32 = 0.03125
1 5/32 = 0.15625
2 10/32 = 0.312500
3 10/32 = 0.312500
4 5/32 = 0.15625
5 1/32 = 0.03125
Now consider the case where the coin is biased (e.g., = 0.7 1 = 0.3).
Calculating P(X = x) for x = 0, 1, 2, 3, 4, 5 means summing P(all its outcomes).
Example: P(X = 3) =
5 Total Area = 1
x P(X = x) = (0.7)x (0.3)5 x
x
5
0 (0.7)0 (0.3)5 = 0.00243
0
5
1 (0.7)1 (0.3)4 = 0.02835
1
5
2 (0.7)2 (0.3)3 = 0.13230
2
5
3 (0.7)3 (0.3)2 = 0.30870
3
5
4 (0.7)4 (0.3)1 = 0.36015
4
5
5 (0.7)5 (0.3)0 = 0.16807
5
This makes perfect sense for n = 5 patients with a = 0.7 recovery probability, i.e.,
their product. In the probability histogram above, the “balance point” fulcrum
indicates the mean value of 3.5.
Ismor Fischer, 5/26/2016 4.1-18
General formulation:
Example: Suppose that a certain spontaneous medical condition affects 1% (i.e., = 0.01)
of the population. Let X = “number of affected individuals in a random sample of n = 300.”
Then X ~ Bin(300, 0.01), i.e., the probability of obtaining any specified number x = 0, 1, 2,
…, 300 of affected individuals is:
300
P(X = x) = x (0.01)x (0.99)300 x .
n x
x p(x) = (1 )n x
x
n 0 Exercise: In order to be a valid distribution,
0 (1 )n 0
0 the sum of these probabilities must = 1. Prove it.
n 1 Hint: First recall the Binomial Theorem:
1 (1 )n 1
1 How do you expand the algebraic expression
n (a b) n for any n = 0, 1, 2, 3, …? Then replace
2
2 (1 )n 2
a with , and b with 1 – . Voilà!
2
etc. etc.
n n
n (1 )n n
n
1
Ismor Fischer, 5/26/2016 4.1-19
Comments:
The assumption of independence of the trials is absolutely critical! If not satisfied – i.e.,
if the “success” probability of one trial influences that of another – then the Binomial
Distribution model can fail miserably. (Example: X = “number of children in a particular
school infected with the flu”) The investigator must decide whether or not independence
is appropriate, which is often problematic. If violated, then the correlation structure
between the trials may have to be considered in the model.
As in the preceding example, if the sample size n is very large, then the computation of
n
for x = 0, 1, 2, …, n, can be intensive and impractical. An approximation to the
x
Binomial Distribution exists, when n is large and is small, via the Poisson Distribution
(coming up…).
POPULATION
Binary random variable
1, Success with probability
Y =
0, Failure with probability 1
SAMPLE
0/1 0/1 0/1 0/1 0/1 0/1 … 0/1
(y1, y2, y3, y4, y5, y6, …, yn)
y1 + y2 + y3 + y4 + y5 + … + yn
Therefore, dividing by n…
X
n = proportion of Successes in n trials
ˆ = p ( = y , as well)
and hence…
q = 1 p = proportion of Failures in n trials.
0 T
Assume:
1. All the occurrences of E are independent in the interval.
2. The mean number of expected occurrences of E in the interval is proportional
to T, i.e., = T. This constant of proportionality is called the rate of the
resulting Poisson process.
Then…
Examples: # bee-sting fatalities per year, # spontaneous cancer remissions per year,
# accidental needle-stick HIV cases per year, hemocytometer cell counts
Ismor Fischer, 5/26/2016 4.1-22
Example (see above): Again suppose that a certain spontaneous medical condition E
affects 1% (i.e., = 0.01) of the population. Let X = “number of affected individuals
in a random sample of T = 300.” As before, the mean number of expected occurrences
of E in the sample is = T = (0.01)(300) = 3 cases. Hence X ~ Poisson(3), and the
probability that any number x = 0, 1, 2, … of individuals are affected is given by:
e 3 3x
P(X = x) =
x!
which is a much easier formula to work with than the previous one. This fact is
sometimes referred to as the Poisson approximation to the Binomial Distribution,
when T (respectively, n) is large, and (respectively, ) is small. Note that in this
example, the variance is also 2 = 3, so that the standard deviation is = 3 = 1.732,
very close to the exact Binomial value.
Binomial Poisson
3
x 300 e 3x
P(X = x) = x (0.01)x (0.99)300 x
P(X = x) =
x!
0 0.04904 0.04979
1 0.14861 0.14936
2 0.22441 0.22404
3 0.22517 0.22404
4 0.16888 0.16803
5 0.10099 0.10082
6 0.05015 0.05041
7 0.02128 0.02160
8 0.00787 0.00810
9 0.00258 0.00270
10 0.00076 0.00081
etc. 0 0
Area = 1
Area = 1
Ismor Fischer, 5/26/2016 4.1-23
n x
pBin(x) = x (1 )n x
n! x
= (1 ) n (1 ) x
Siméon Poisson
x! (n x)!
(1781 - 1840)
1 n
x x
= n (n 1) (n 2) ... (n x + 1) 1 (1 )
x! n
1 n (n 1) (n 2) ... (n x + 1) n
x x x
= n 1 (1 )
x! nx n
1 n n 1 n 2 n x+1 n
= … (n )x 1 (1 ) x
x! n n n n n
1 1 2 x 1 n
x x
= 1 1 1 … 1 1 (1 )
x! n n n n
As n ,
0,
1 x x
1(1)(1) … (1) = 1 e 1 =1
x!
x
e
= = pPoisson(x). QED
x!
Ismor Fischer, 5/26/2016 4.1-24
n x
p(x) = P(X = x) = x
(1 )n x
, x = 0, 1, 2, …, n
x 1 k
p(x) = P(X = x) = k 1
(1 )x k
, x = k, k + 1, k + 2, …
p(x) = P(X = x) = (1 )x 1
, x = 1, 2, 3, …
Hypergeometric (modification of Binomial to sampling without replacement from “small” finite populations, relative to n.)
N
X = # successes in n random trials taken from a population of size N containing d successes, n >
10
d N d
x n x
p(x) = P(X = x) = N
, x = 0, 1, 2, …, d
n
xi = 0, 1, 2, …, n with x1 + x2 + … + xk = n