Professional Documents
Culture Documents
Introduction To Statistical Inference: Floyd Bullard
Introduction To Statistical Inference: Floyd Bullard
Statistical
Inference
Floyd Bullard
Introduction
Example 1
Example 3
Example 4
23 May 2006
Parametric models Introduction to
Statistical
Inference
Floyd Bullard
Introduction
Example 2
data. There are a many contexts in which inference is
Example 3
desirable, and there are many approaches to performing
Example 4
inference.
Conclusion
Parametric models Introduction to
Statistical
Inference
Floyd Bullard
Introduction
Example 2
data. There are a many contexts in which inference is
Example 3
desirable, and there are many approaches to performing
Example 4
inference.
Conclusion
Floyd Bullard
Introduction
Example 2
data. There are a many contexts in which inference is
Example 3
desirable, and there are many approaches to performing
Example 4
inference.
Conclusion
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Example 4
Suppose a large bag contains a million marbles, some
Conclusion
fraction of which are red. Let’s call the fraction of red
marbles π. π is a constant, but its value is unknown to us.
We want to estimate the value of π.
Introduction to
Example 1 (continued) Statistical
Inference
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Obviously we’d be just guessing if we didn’t collect any data,
Example 4
so let’s suppose we draw 3 marbles out at random and find
Conclusion
that the first is white, the second is red, and the third is
white.
Introduction to
Example 1 (continued) Statistical
Inference
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Obviously we’d be just guessing if we didn’t collect any data,
Example 4
so let’s suppose we draw 3 marbles out at random and find
Conclusion
that the first is white, the second is red, and the third is
white.
Question: What would be the probability of that particular
sequence, WRW, if π were equal to, say, 0.2?
Introduction to
Example 1 (continued) Statistical
Inference
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Conclusion
WRW would be 0.8 × 0.2 × 0.8 = 0.128.
Introduction to
Example 1 (continued) Statistical
Inference
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Conclusion
WRW would be 0.8 × 0.2 × 0.8 = 0.128.
Question: What would be the probability of that particular
sequence, WRW, if π = 0.7?
Introduction to
Example 1 (continued) Statistical
Inference
Floyd Bullard
Introduction
Example 1
Example 2
If π = 0.7, then the probability of drawing out the sequence Example 3
WRW would be 0.3 × 0.7 × 0.3 = 0.063. Example 4
Conclusion
Notice that π = 0.7 is less likely to have produced the
observed sequence WRW that is π = 0.2.
Introduction to
Example 1 (continued) Statistical
Inference
Floyd Bullard
Introduction
Example 1
Example 2
If π = 0.7, then the probability of drawing out the sequence Example 3
WRW would be 0.3 × 0.7 × 0.3 = 0.063. Example 4
Conclusion
Notice that π = 0.7 is less likely to have produced the
observed sequence WRW that is π = 0.2.
Question: Of all possible values of π ∈ [0, 1], which one
would have had the greatest probability of producing the
sequence WRW?
Introduction to
Example 1 (continued) Statistical
Inference
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Example 4
Your gut feeling may be that π = 13 is the candidate value of Conclusion
π that would have had the greatest probability of producing
the sequence we observed, WRW. But can that be proven?
Introduction to
Example 1 (continued) Statistical
Inference
Floyd Bullard
Introduction
The probability of observing the sequence WRW for some
Example 1
unknown value of π is given by the equation Example 2
Example 3
L(π) = (1 − π)(π)(1 − π) = π · (1 − π)2 .
Example 4
Conclusion
Differentiating gives:
d
L(π) = π · 2(1 − π)(−1) + (1 − π)2 · 1
dπ
= 3π 2 − 4π + 1
= (3π − 1)(π − 1)
Introduction to
Example 1 (continued) Statistical
Inference
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Example 4
The function L(π) is called the likelihood function, and the
Conclusion
value of π that maximizes L(π) is called the maximum
likelihood estimate, or MLE. In this case we did indeed have
an MLE of 13 .
Introduction to
Example 1 (continued) Statistical
Inference
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Example 4
The MLE may be the “best guess” for π, at least based on Conclusion
the maximum likelihood criterion, but surely there are other
values of π that are also plausible. How should be find them?
Introduction to
Example 1 (continued) Statistical
Inference
Floyd Bullard
0.16 Introduction
Example 1
0.14
Example 2
0.12
Example 3
Likelihood L(π )
0.1
Example 4
0.08 Conclusion
0.06
0.04
0.02
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
π
Floyd Bullard
Introduction
Example 1
Here is the MATLAB code that generated the graph on the Example 2
Example 4
Conclusion
p = [0:0.01:1];
L = p.*((1-p).^2);
plot(p,L)
xlabel(’\pi’)
ylabel(’Likelihood L(\pi )’)
Example 2 Introduction to
Statistical
Inference
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Okay. Now suppose that you again have a bag with a million
Example 4
marbles, and again you want to estimate the proportion of
Conclusion
reds, π. This time you drew 50 marbles out at random and
observed 28 reds and 22 whites.
Come up with the MLE for π and also use MATLAB to give a
range of other plausible values for π.
Introduction to
Example 2 (continued) Statistical
Inference
Floyd Bullard
−15
x 10 Introduction
1.4
Example 1
1.2
Example 2
1 Example 3
Likelihood L(π )
Example 4
0.8
Conclusion
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
π
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Example 4
Floyd Bullard
Notice that in the second example the scale of the likelihood Introduction
function was much smaller than in the first example. (Why?) Example 1
Example 2
Some of you likely know some combinatorics, and perhaps Example 3
were inclined to include a binomial coefficient in the Example 4
likelihood function: Conclusion
50
L(π) = π 28 (1 − π)22 ,
28
instead of
L(π) = π 28 (1 − π)22 .
Floyd Bullard
Introduction
Example 1
Suppose now we have data that we will model as having
Example 2
come from a normal distribution with an unknown mean µ Example 3
and an unknown standard deviation σ. For example, these Example 4
five heights (in inches) of randomly selected MLB players: Conclusion
Floyd Bullard
Introduction
Example 1
Example 2
Recall that the normal distribution is a continuous Example 3
probability density function (pdf), so the probability of Example 4
observing any number exactly is, technically, 0. But these Conclusion
Floyd Bullard
Example 1
0.12
Example 2
0.1
Example 3
probability density
Example 4
0.08
Conclusion
0.06
0.04
0.02
0
73
height (inches)
Floyd Bullard
Introduction
So if f (h) is a probability density funtion with mean µ and Example 1
standard deviation σ, then the probability of observing the Example 2
heights h1 , h2 , h3 , h4 , and h5 is (approximately) proportional Example 3
to f (h1 ) · f (h2 ) · f (h3 ) · f (h4 ) · f (h5 ). Example 4
Conclusion
Let’s not forget what we’re trying to do: estimate µ and σ!
The likelihood function L is a function of both µ and σ, and
it is proportional to the product of the five normal densities:
Floyd Bullard
Example 2
Example 3
normpdf(X, mu, sigma) Example 4
Conclusion
Floyd Bullard
data = [73, 76, 74, 74, 73];
Introduction
Example 1
mu = [70:0.1:80]; Example 2
sigma = [0:0.1:5]; Example 3
Example 4
L = zeros(length(mu), length(sigma)); Conclusion
for i = 1:length(mu)
for j = 1:length(sigma)
L(i,j) = prod(normpdf(data, mu(i), sigma(j)));
end
end
Floyd Bullard
Introduction
−4
x 10
Example 1
6
Example 2
5
4
Example 3
3 Example 4
2 Conclusion
1
0
5
4 80
3 78
2 76
74
1
72
0 70
σ µ
Floyd Bullard
Introduction
MLB player heights, µ and σ
5
Example 1
4.5
Example 2
4
Example 3
3.5
Example 4
3
Conclusion
2.5
σ
1.5
0.5
0
70 71 72 73 74 75 76 77 78 79 80
µ
Floyd Bullard
1.5
0.5
0
70 71 72 73 74 75 76 77 78 79 80
µ
Floyd Bullard
Introduction
Example 1
Here are five randomly sampled MLB players’ annual salaries:
Example 2
Floyd Bullard
Example 2
Example 3
10000 Example 4
Conclusion
σ
5000
0
−6000 −4000 −2000 0 2000 4000 6000 8000 10000 12000
µ ($K)
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Example 4
Conclusion
Moral: If the model isn’t any good, then the inference won’t
be either.
Conclusion Introduction to
Statistical
Inference
Floyd Bullard
Introduction
Statistical inference means drawing conclusions based on Example 1
data. One context for inference is the parametric model, in Example 2
which data are supposed to come from a certain distribution Example 3
family, the members of which are distinguished by differing Example 4
parameter values. The normal distribution family is one Conclusion
example.
One tool of statistical inference is the likelihood ratio, in
which a parameter value is considered “consistent with the
data” if the ratio of its likelihood to the maximum likelihood
is at least some threshold value, such as 10% or 1%. While
more sophisticated inferential tools exist, this one may be
the most staightforward and obvious.
Conclusion Introduction to
Statistical
Inference
Floyd Bullard
Introduction
Example 1
Example 2
Example 3
Example 4
Enjoy the week here at NCSU! Conclusion