Sie sind auf Seite 1von 101

Statistical Theory

Prof. Gesine Reinert


November 23, 2009
Aim: To review and extend the main ideas in Statistical Inference, both
from a frequentist viewpoint and from a Bayesian viewpoint. This course
serves not only as background to other courses, but also it will provide a
basis for developing novel inference methods when faced with a new situation
which includes uncertainty. Inference here includes estimating parameters
and testing hypotheses.
Overview
Part 1: Frequentist Statistics
Chapter 1: Likelihood, suciency and ancillarity. The Factoriza-
tion Theorem. Exponential family models.
Chapter 2: Point estimation. When is an estimator a good estima-
tor? Covering bias and variance, information, eciency. Methods
of estimation: Maximum likelihood estimation, nuisance parame-
ters and prole likelihood; method of moments estimation. Bias
and variance approximations via the delta method.
Chapter 3: Hypothesis testing. Pure signicance tests, signi-
cance level. Simple hypotheses, Neyman-Pearson Lemma. Tests
for composite hypotheses. Sample size calculation. Uniformly
most powerful tests, Wald tests, score tests, generalised likelihood
ratio tests. Multiple tests, combining independent tests.
Chapter 4: Interval estimation. Condence sets and their con-
nection with hypothesis tests. Approximate condence intervals.
Prediction sets.
Chapter 5: Asymptotic theory. Consistency. Asymptotic nor-
mality of maximum likelihood estimates, score tests. Chi-square
approximation for generalised likelihood ratio tests. Likelihood
condence regions. Pseudo-likelihood tests.
Part 2: Bayesian Statistics
Chapter 6: Background. Interpretations of probability; the Bayesian
paradigm: prior distribution, posterior distribution, predictive
distribution, credible intervals. Nuisance parameters are easy.
1
Chapter 7: Bayesian models. Suciency, exchangeability. De
Finettis Theorem and its intepretation in Bayesian statistics.
Chapter 8: Prior distributions. Conjugate priors. Noninformative
priors; Jereys priors, maximum entropy priors posterior sum-
maries. If there is time: Bayesian robustness.
Chapter 9: Posterior distributions. Interval estimates, asymp-
totics (very short).
Part 3: Decision-theoretic approach:
Chapter 10: Bayesian inference as a decision problem. Deci-
sion theoretic framework: point estimation, loss function, deci-
sion rules. Bayes estimators, Bayes risk. Bayesian testing, Bayes
factor. Lindleys paradox. Least favourable Bayesian answers.
Comparison with classical hypothesis testing.
Chapter 11: Hierarchical and empirical Bayes methods. Hierar-
chical Bayes, empirical Bayes, James-Stein estimators, Bayesian
computation.
Part 4: Principles of inference. The likelihood principle. The condi-
tionality principle. The stopping rule principle.
Books
1. Bernardo, J.M. and Smith, A.F.M. (2000) Bayesian Theory. Wiley.
2. Casella, G. and Berger, R.L. (2002) Statistical Inference. Second Edi-
tion. Thomson Learning.
3. Cox, D.R. and Hinkley, D.V. (1974) Theoretical Statistics. Chapman
and Hall.
4. Garthwaite, P.H., Jolie, I.T. and Jones, B. (2002) Statistical Inference.
Second Edition. Oxford University Press.
5. Leonard, T. and Hsu, J.S.J. (2001) Bayesian Methods. Cambridge
University Press.
2
6. Lindgren, B.W. (1993) Statistical Theory. 4th edition. Chapman and
Hall.
7. OHagan, A. (1994) Kendalls Advanced Theory of Statistics. Vol 2B,
Bayesian Inference. Edward Arnold.
8. Young, G.A. and Smith, R.L. (2005) Essential of Statistical Inference.
Cambridge University Press.
Lecture take place Mondays 11-12 and Wednesdays 9-10. There will be
four problem sheets. Examples classes are held Thursdays 12-1 in weeks 3,
4, 6, and 8.
While the examples classes will cover problems from the problem sheets,
there may not be enough time to cover all the problems. You will benet
most from the examples classes if you (attempt to) solve the problems on the
sheet ahead of the examples classes.
You are invited to hand in your work on the respective problem sheets
on Tuesdays at 5 pm in weeks 3, 4, 6, and 8. Your marker is Eleni Frangou;
there will be a folder at the departmental pigeon holes.
Additional material may be published at http://stats.ox.ac.uk/
~
reinert/
stattheory/stattheory.htm.
The lecture notes may cover more material than the lectures.
3
Part I
Frequentist Statistics
4
Chapter 1
Likelihood, suciency and
ancillarity
We start with data x
1
, x
2
, . . . , x
n
, which we would like to use to draw inference
about a parameter .
Model: We assume that x
1
, x
2
, . . . , x
n
are realisations of some random vari-
ables X
1
, X
2
, . . . , X
n
, from a distribution which depends on the parameter
.
Often we use the model that X
1
, X
2
, . . . , X
n
independent, identically dis-
tributed (i.i.d.) from some f
X
(x, ) (probability density or probability mass
function). We then say x
1
, x
2
, . . . , x
n
is a random sample of size n from
f
X
(x, ) (or, shorter, from f(x, )).
1.1 Likelihood
If X
1
, X
2
, . . . , X
n
i.i.d. f(x, ), then the joint density at x = (x
1
, . . . , x
n
)
is
f(x, ) =
n

i=1
f(x
i
, ).
Inference about given the data is based on the Likelihood function
L(, x) = f(x, ); often abbreviated by L(). In the i.i.d. model, L(, x) =

n
i=1
f(x
i
, ). Often it is more convenient to use the log likelihood (, x) =
log L(, x) (or, shorter, ()). Here and in future, the log denotes the natural
logarithm; e
log x
= x.
5
Example: Normal distribution. Assume that x
1
, . . . , x
n
is a random
sample from N(,
2
), where both and
2
are unknown parameters,
R,
2
> 0. With = (,
2
), the likelihood is
L() =

n
i=1
(2
2
)
1/2
exp
_

1
2
2
(x
i
)
2
_
= (2
2
)
n/2
exp
_

1
2
2

n
i=1
(x
i
)
2
_
and the log-likelihood is
() =
n
2
log(2) nlog
1
2
2
n

i=1
(x
i
)
2
.
Example: Poisson distribution. Assume that x
1
, . . . , x
n
is a random
sample from Poisson(), with unknown > 0; then the likelihood is
L() =
n

i=1
_
e

x
i
x
i
!
_
= e
n

n
i=1
x
i
n

i=1
(x
i
!)
1
and the log-likelihood is
() = n + log()
n

i=1
x
i

i=1
log(x
i
!).
1.2 Suciency
Any function of X is a statistic. We often write T = t(X), where t is a
function. Some examples are the sample mean, the sample median, and the
actual data. Usually we would think of a statistic as being some summary
of the data, so smaller in dimension than the original data.
A statistic is sucient for the parameter if it contains all information about
that is available from the data: L(X|T), the conditional distribution of X
given T, does not depend on .
Factorisation Theorem (Casella + Berger, p.250) A statistic T = t(X)
is sucient for if and only if there exists functions g(t, ) and h(x) such
that for all x and
f(x, ) = g(t(x), )h(x).
6
Example: Bernoulli distribution. Assume that X
1
, . . . , X
n
are i.i.d.
Bernoulli trials, Be(), so f(x, ) =
x
(1 )
1x
; let T =

n
i=1
X
i
denote
number of successes. Recall that T Bin(n, ), and so
P(T = t) =
_
n
t
_

t
(1 )
nt
, t = 0, 1, . . . , n.
Then
P(X
1
= x
1
, . . . , X
n
= x
n
|T = t) = 0 for
n

i=1
x
i
= t,
and for

n
i=1
x
i
= t,
P(X
1
= x
1
, . . . , X
n
= x
n
|T = t) =
P(X
1
= x
1
, . . . , X
n
= x
n
)
P(T = t)
=

n
i=1
_

x
i
(1 )
(1x
i
)
_
_
n
t
_

t
(1 )
nt
=

t
(1 )
nt
_
n
t
_

t
(1 )
nt
=
_
n
t
_
1
.
This expression is independent of , so T is sucient for .
Alternatively, the Factorisation Theorem gives
f(x, ) =
n

i=1
_

x
i
(1 )
(1x
i
)
_
=

n
i=1
x
i
(1 )
n

n
i=1
x
i
= g(t(x), )h(x)
with t =

n
i=1
x
i
; g(t, ) =
t
(1)
nt
and h(x) = 1, so T = t(X) is sucient
for .
Example: Normal distribution. Assume that X
1
, . . . , X
n
are i.i.d.
N(,
2
); put x =
1
n

n
i=1
x
i
and s
2
=
1
n1

n
i=1
(x
i
x)
2
, then
f(x, ) = (2
2
)
n/2
exp
_

1
2
2
n

i=1
(x
i
)
2
_
= exp
_

n(x )
2
2
2
_
(2
2
)

n
2
exp
_

(n 1)s
2
2
2
_
.
7
If
2
is known: = , t(x) = x, and g(t, ) = exp
_

n(x)
2
2
2
_
, so X is
sucient.
If
2
is unknown: = (,
2
), and f(x, ) = g(x, s
2
, ), so (X, S
2
) is sucient.
Example: Poisson distribution. Assume that x
1
, . . . , x
n
are a random
sample from Poisson(), with unknown > 0. Then
L() = e
n

n
i=1
x
i
n

i=1
(x
i
!)
1
.
and (exercise)
t(x) =
g(t, ) =
h(x) =
Example: order statistics. Let X
1
, . . . , X
n
be i.i.d.; the order statis-
tics are the ordered observations X
(1)
X
(2)
X
(n)
. Then T =
(X
(1)
, X
(2)
, , X
(n)
) is sucient.
1.2.1 Exponential families
Any probability density function f(x|) which is written in the form
f(x, ) = exp
_
k

i=1
c
i

i
()h
i
(x) +c() +d(x),
_
, x X,
where c() is chosen such that
_
f(x, ) dx = 1, is said to be in the k-
parameter exponential family. The family is called regular if X does not
depend on ; otherwise it is called non-regular.
Examples include the binomial distribution, Poisson distributions, normal
distributions, gamma (including exponential) distributions, and many more.
Example: Binomial (n, ). For x = 0, 1, ..., n,
f(x; ) =
_
n
x
_

x
(1 )
nx
= exp
_
x log
_

1
_
+ log
__
n
x
__
+nlog(1 )
_
.
8
Choose k = 1 and
c
1
= 1

1
() = log
_

1
_
h
1
(x) = x
c() = nlog(1 )
d(x) = log
__
n
x
__
X = {0, . . . , n}.
Fact: In k-parameter exponential family models,
t(x) = (n,
n

j=1
h
1
(x
j
), . . . ,
n

j=1
h
k
(x
j
))
is sucient.
1.2.2 Minimal suciency
A statistic T which is sucient for is minimal sucient for is if can be
expressed as a function of any other sucient statistic. To nd a minimal
sucient statistic: Suppose
f(x,)
f(y,)
is constant in if and only if
t(x) = t(y),
then T = t(X) is minimal sucient (see Casella + Berger p.255).
In order to avoid issues when the density could be zero, it is the case that
if for any possible values for x and y, we have that the equation
f(x, ) = (x, y)f(y, ) for all
implies that t(x) = t(y), where is a function which does not depend on ,
then T = t(X) is minimal sucent for .
Example: Poisson distribution. Suppose that X
1
, . . . , X
n
are i.i.d.
Po(), then f(x, ) = e
n

n
i=1
x
i

n
i=1
(x
i
!)
1
and
f(x, )
f(y, )
=

n
i=1
x
i

n
i=1
y
i
n

i=1
y
i
!
x
i
!
,
9
which is constant in if and only if
n

i=1
x
i
=
n

i=1
y
i
;
so T =

n
i=1
X
i
is minimal sucient (as is X). Note: T =

n
i=1
X
(i)
is a
function of the order statistic.
1.3 Ancillary statistic
If a(X) is a statistics whose distribution does not depend on , it is called
an ancillary statistic.
Example: Normal distribution. Let X
1
, . . . , X
n
be i.i.d. N(, 1).
Then T = X
2
X
1
N(0, 2) has a distribution which does not depend on
; it is ancillary.
When a minimal sucient statistic T is of larger dimension than , then
there will often be a component of T whose distribution is independent of .
Example: some uniform distribution (Exercise). Let X
1
, . . . , X
n
be
i.i.d. U[
1
2
, +
1
2
] then
_
X
(1)
, X
(n)
_
is minimal sucient for , as is
(S, A) =
_
1
2
(X
(1)
+X
(n)
), X
(n)
X
(1)
_
,
and the distribution of A is independent of , so A is an ancillary statistic.
Indeed, A measures the accuracy of S; for example, if A = 1 then S = with
certainty.
10
Chapter 2
Point Estimation
Recall that we assume our data x
1
, x
2
, . . . , x
n
to be realisations of random
variables X
1
, X
2
, . . . , X
n
from f(x, ). Denote the expectation with respect
to f(x, ) by E

, and the variance by Var

.
When we estimate by a function t(x
1
, . . . , x
n
) of the data, this is called
a point estimate; T = t(X
1
, . . . , X
n
) = t(X) is called an estimator (random).
For example, the sample mean is an estimator of the mean.
2.1 Properties of estimators
T is unbiased for if E

(T) = for all ; otherwise T is biased. The bias of


T is
Bias(T) = Bias

(T) = E

(T) .
Example: Sample mean, sample variance. Suppose that X
1
, . . . , X
n
are i.i.d. with unknown mean ; unknown variance
2
. Consider the estimate
of given by the sample mean
T = X =
1
n
n

i=1
X
i
.
Then
E
,
2(T) =
1
n
n

i=1
= ,
11
so the sample mean is unbiased. Recall that
V ar
,
2(T) = V ar
,
2(X) = E
,
2{(X )
2
)} =

2
n
.
If we estimate
2
by
S
2
=
1
n 1
n

i=1
(X
i
X)
2
,
then
E
,
2(S
2
)
=
1
n 1
n

i=1
E
,
2{(X
i
+ X)
2
}
=
1
n 1
n

i=1
_
E
,
2{(X
i
)
2
} + 2E
,
2(X
i
)( X)
+E
,
2{(X )
2
}
_
=
1
n 1
n

i=1

2
2
n
n 1
E
,
2{(X )
2
} +
n
n 1
E
,
2{(X )
2
}
=
2
_
n
n 1

2
n 1
+
1
n 1
_
=
2
,
so S
2
is an unbiased estimator of
2
. Note: the estimator
2
=
1
n

n
i=1
(X
i

X)
2
is not unbiased.
Another criterion for estimation is a small mean square error (MSE);
the MSE of an estimator T is dened as
MSE(T) = MSE

(T) = E

{(T )
2
} = V ar

(T) + (Bias

(T))
2
.
Note: MSE(T) is a function of .
Example:
2
has smaller MSE than S
2
(see Casella and Berger, p.304)
but is biased.
If one has two estimators at hand, one being slightly biased but having
a smaller MSE than the second one, which is, say, unbiased, then one may
12
well prefer the slightly biased estimator. Exception: If the estimate is to be
combined linearly with other estimates from independent data.
The eciency of an estimator T is dened as
Efficiency

(T) =
Var

(T
0
)
Var

(T)
,
where T
0
has minimum possible variance.
Theorem: Cramer-Rao Inequality, Cramer-Rao lower bound:
Under regularity conditions on f(x, ), it holds that for any unbiased T,
Var

(T) (I
n
())
1
,
where
I
n
() = E

_
_
(, X)

_
2
_
is the expected Fisher information of the sample.
Thus, for any unbiased estimator T,
Efficiency

(T) =
1
I
n
()Var

(T)
.
Assume that T is unbiased. T is called ecient (or a minimum variance
unbiased estimator) if it has the minimum possible variance. An unbiased
estimator T is ecient if Var

(T) = (I
n
())
1
.
Often T = T(X
1
, . . . , X
n
) is ecient as n : then it is called asymp-
totically ecient.
The regularity conditions are conditions on the partial derivatives of
f(x, ) with respect to ; and the domain may not depend on ; for example
U[0, ] violates the regularity conditions.
Under more regularity: the rst three partial derivatives of f(x, ) with
respect to are integrable with respect to x; and again the domain may not
depend on ; then
I
n
() = E

2
(, X)

2
_
.
13
Notation: We shall often omit the subscript in I
n
(), when it is clear
whether we refer to a sample of size 1 or of size n. For a random sample,
I
n
() = nI
1
().
Calculation of the expected Fisher information:
I
n
() = E

_
_
(, X)

_
2
_
=
_
f(x, )
_
_
log f(x, )

_
2
_
dx
=
_
f(x, )
_
1
f(x, )
_
f(x, )

__
2
dx
=
_
1
f(x, )
_
_
f(x, )

_
2
_
dx.
Example: Normal distribution, known variance For a random sam-
ple X from N(,
2
), where
2
is known, and = ,
() =
n
2
log(2) nlog
1
2
2
n

i=1
(x
i
)
2
;

=
1

2
n

i=1
(x
i
) =
n

2
(x )
and
I
n
() = E

_
_
(, X

_
2
_
=
n
2

4
E

(X )
2
=
n

2
.
Note: Var

(X) =

2
n
, so X is an ecient estimator for . Also note that

2
=
n

2
;
14
a quicker method yielding the expected Fisher information.
In future we shall often omit the subscript in the expectation and in
the variance.
Example: Exponential family models in canonical form
Recall that one-parameter (i.e., scalar ) exponential family density has the
form
f(x; ) = exp {()h(x) +c() +d(x)} , x X.
Choosing and x to make () = and h(x) = x is called the canonical
form;
f(x; ) = exp{x +c() +d(x)}.
For the canonical form
EX = () = c

(), and Var X =


2
() = c

().
Exercise: Prove the mean and variance results by calculating the moment-
generating function Eexp(tX) = exp{c() c(t +)}. Recall that you obtain
mean and variance by dierentiating the moment-generating function (how
exactly?)
Example: Binomial (n, p). Above we derived the exponential family
form with
c
1
= 1

1
(p) = log
_
p
1 p
_
h
1
(x) = x
c(p) = nlog(1 p)
d(x) = log
__
n
x
__
X = {0, . . . , n}.
To write the density in canonical form we put
= log
_
p
1 p
_
15
(this transformation is called the logit transformation); then
p =
e

1 +e

and
() =
h(x) = x
c() = nlog
_
1 +e

_
d(x) = log
__
n
x
__
X = {0, . . . , n}
gives the canonical form. We calculate the mean
c

() = n
e

1 +e

= () = np
and the variance
c

() = n
_
e

1 +e


e
2
(1 +e

)
2
_
=
2
() = np(1 p).
Now suppose X
1
, . . . , X
n
are i.i.d., from the canonical density. Then
() =

x
i
+nc() +

d(x
i
),

() =

x
i
+nc

() = n(x +c

()).
Since

() = nc

(), we have that I


n
() = E(

()) = nc

().
Example: Binomial (n, p) and
= log
_
p
1 p
_
then (exercise)
I
1
() =
16
2.2 Maximum Likelihood Estimation
Now may be a vector. A maximum likelihood estimate, denoted

(x), is a
value of at which the likelihood L(, x) is maximal. The estimator

(X)
is called MLE (also,

(x) is sometimes called mle). An mle is a parameter
value at which the observed sample is most likely.
Often it is easier to maximise log likelihood: if derivatives exist, then
set rst (partial) derivative(s) with respect to to zero, check that second
(partial) derivative(s) with respect to less than zero.
An mle is a function of a sucient statistic:
L(, x) = f(x, ) = g(t(x), )h(x)
by the factorisation theorem, and maximizing in depends on x only through
t(x).
An mle is usually ecient as n .
Invariance property: An mle of a function () is (

) (Casella + Berger
p.294). That is, if we dene the likelihood induced by as
L

(, x) = sup
:()=
L(, x),
then one can calculate that for

= (

),
L

, x) = L(

, x).
Examples: Uniforms, normal
1. X
1
, . . . , X
n
i.i.d. U[0, ]:
L() =
n
1
[x
(n)
,)
(),
where x
(n)
= max
1in
x
i
; so

= X
(n)
2. X
1
, . . . , X
n
i.i.d. U[
1
2
, +
1
2
], then any [x
(n)

1
2
, x
(1)
+
1
2
]
maximises the likelihood (Exercise)
3. X
1
, . . . , X
n
i.i.d. N(,
2
), then (Exercise) = X,
2
=
1
n

n
i=1
(X
i

X)
2
. So
2
is biased, but Bias(
2
) 0 as n .
17
Iterative computation of MLEs
Sometimes the likelihood equations are dicult to solve. Suppose

(1)
is
an initial approximation for

. Using Taylor expansion gives
0 =

(1)
) + (

(1)
)

(1)
),
so that

(1)

(1)
)

(1)
)
.
Iterate this procedure (this is called the Newton-Raphson method) to get

(k+1)
=

(k)
(

(k)
))
1

(k)
), k = 2, 3, . . . ;
continue the iteration until |

(k+1)

(k)
| < for some small .
As E
_

(1)
)
_
= I
n
(

(1)
) we could instead iterate

(k+1)
=

(k)
+I
1
n
(

(k)
)

(k)
), k = 2, 3, . . .
until |

(k+1)

(k)
| < for some small . This is Fishers modication of the
Newton-Raphson method.
Repeat with dierent starting values to reduce the risk of nding just a
local maximum.
Example: Suppose that we observe x from the distribution
Binomial(n, ). Then
() = x ln() + (n x) ln(1 ) + log
_
n
x
_

() =
x


n x
1
=
x n
(1 )

() =
x

2

n x
(1 )
2
I
1
() =
n
(1 )
18
Assume that n = 5, x = 2, = 0.01 (in practice rather = 10
5
); and
start with an initial guess

(1)
= 0.55. Then Newton-Raphson gives

(1)
) 3.03

(2)

(1)
(

(1)
))
1

(1)
) 0.40857

(2)
) 0.1774

(3)

(2)
(

(2)
))
1
(

(2)
) 0.39994.
Now |

(3)

(2)
| < 0.01 so we stop.
Using instead Fisher scoring gives
I
1
1
()

() =
x n
n
=
x
n

and so
+I
1
1
()

() =
x
n
for all . To compare: analytically,

=
x
n
= 0.4.
2.3 Prole likelihood
Often = (, ), where contains the parameters of interest and contains
the other unknown parameters: nuisance parameters. Let

be the MLE
for for a given value of . Then the prole likelihood for is
L
P
() = L(,

)
(in L(, ) replace by

); the prole log-likelihood is


P
() = log[L
P
()].
For point estimation, maximizing L
P
() with respect to gives the same
estimator

as maximizing L(, ) with respect to both and (but possibly
dierent variances)
Example: Normal distribution. Suppose that X
1
, . . . , X
n
are i.i.d.
from N(,
2
) with and
2
unknown. Given ,
2

= (1/n)

(x
i
)
2
,
and given
2
,

2 = x. Hence the prole likelihood for is


L
P
() = (2
2

)
n/2
exp
_

1
2
2

i=1
(x
i
)
2
_
=
_
2e
n

(x
i
)
2
_
n/2
,
19
which gives = x; and the prole likelihood for
2
is
L
P
(
2
) = (2
2
)
n/2
exp
_

1
2
2

(x
i
x)
2
_
,
gives (Exercise)

2

=
2.4 Method of Moments (M.O.M)
The idea is to match population moments to sample moments in order to
obtain estimators. Suppose that X
1
, . . . , X
n
are i.i.d. f(x;
1
, . . . ,
p
).
Denote by

k
=
k
() = E(X
k
)
the k
th
moment and by
M
k
=
1
n

(X
i
)
k
the k
th
sample moment. In general,
k
=
k
(
1
, . . . ,
p
). Solve the equation

k
() = M
k
for k = 1, 2, . . . , until there are sucient equations to solve for
1
, . . . ,
p
(usually p equations for the p unknowns). The solutions

1
, . . . ,

p
are the
method of moments estimators.
They are often not as ecient as MLEs, but may be easier to calculate.
They could be used as initial estimates in an iterative calculation of MLEs.
Example: Normal distribution. Suppose that X
1
, . . . , X
n
are i.i.d.
N(,
2
); and
2
are unknown. Then

1
= ; M
1
= X
Solve
= X
so
= X.
Furthermore

2
=
2
+
2
; M
2
=
1
n
n

i=1
X
2
i
20
so solve

2
+
2
=
1
n
n

i=1
X
2
i
,
which gives

2
= M
2
M
2
1
=
1
n
n

i=1
(X
i
X)
2
(which is not unbiased for
2
).
Example: Gamma distribution. Suppose that X
1
, . . . , X
n
are i.i.d.
(, );
f(x; , ) =
1
()

x
1
e
x
for x 0.
Then
1
= EX = / and

2
= EX
2
= /
2
+ (/)
2
.
Solving
M
1
= /, M
2
= /
2
+ (/)
2
for and gives

= X
2
_
[n
1
n

i=1
(X
i
X)
2
], and

= X
_
[n
1
n

i=1
(X
i
X)
2
].
2.5 Bias and variance approximations: the
delta method
Sometimes T is a function of one or more averages whose means and variances
can be calculated exactly; then we may be able to use the following simple
approximations for mean and variance of T:
Suppose T = g(S) where ES = and Var S = V . Taylor expansion gives
T = g(S) g() + (S )g

().
21
Taking the mean and variance of the r.h.s.:
ET g(), Var T [g

()]
2
V.
If S is an average so that the central limit theorem (CLT) applies to it,
i.e., S N(, V ), then
T N(g(), [g

()]
2
V )
for large n.
If V = v(), then it is possible to choose g so that T has approximately
constant variance in : solve [g

()]
2
v() = constant.
Example: Exponential distribution. X
1
, . . . , X
n
i.i.d. exp(
1

),
mean . Then S = X has mean and variance
2
/n. If T = log X then
g() = log(), g

() =
1
, and so Var T n
1
, which is independent of :
this is called a variance stabilization.
If the Taylor expansion is carried to the second-derivative term, we obtain
ET g() +
1
2
V g

().
In practice we use numerical estimates for and V if unknown.
When S, are vectors (V a matrix), with T still a scalar: Let
_
g

()
_
i
=
g/
i
and let g

() be the matrix of second derivatives, then Taylor expan-


sion gives
Var T [g

()]
T
V g

()
and
ET g() +
1
2
trace[g

()V ].
2.5.1 Exponential family models in canonical form and
asymptotic normality of the MLE
Recall that a one-parameter (i.e., scalar ) exponential family density in
canonical form can be written as
f(x; ) = exp{x +c() +d(x)},
22
and EX = () = c

(), as well as Var X =


2
() = c

(). Suppose
X
1
, . . . , X
n
are i.i.d., from the canonical density. Then

() =

x
i
+nc

() = n(x +c

()).
Since () = c

(),

() = 0 x = (

),
and we have already calculated that I
n
() = E(

()) = nc

(). If is
invertible, then

=
1
(x).
The CLT applies to X so, for large n,
X N((), c

()/n).
With the delta-method, S N(a, b) implies that
g(S) N
_
g(a), b[g

(a)]
2
_
for continuous g, and small b. For S = X, with g() =
1
() we have
g

() = (

(
1
())
1
, thus

N
_
, I
1
n
()
_
:
the M.L.E. is asymptotically normal.
Note: The approximate variance equals the Cramer-Rao lower bound:
quite generally the MLE is asymptotically ecient.
Example: Binomial(n, p). With = log
_
p
1p
_
we have () = n
e

1+e

,
and we calculate

1
(t) = log
_
t
n
1
t
n
_
.
Note that here we have a sample, x, of size 1. This gives

= log
_
x
n
1
x
n
_
,
as expected from the invariance of mles. We hence know that

is approxi-
mately normally distributed.
23
2.6 Excursions
2.6.1 Minimum Variance Unbiased Estimation
There is a pretty theory about how to construct minimum variance unbiased
estimators (MVUE) based on sucient statistics. The key underlying result
is the Rao-Blackwell Theorem (Casella+Berger p.316). We do not have time
to go into detail during lectures, but you may like to read up on it.
2.6.2 A more general method of moments
Consider statistics of the form
1
n

n
i=1
h(X
i
). Find the expected value as a
function of
1
n
n

i=1
Eh(X
i
) = r().
Now obtain an estimate for by solving r() =
1
n

n
i=1
h(X
i
) for .
2.6.3 The delta method and logistic regresstion
For logistic regression, the outcome of an experiment is 0 or 1, and the
outcome may depend on some explanatory variables. We are interested in
P(Y
i
= 1|x) = (x|).
The outcome for each experiment is in [0, 1]; in order to apply some normal
regression model we use the logit transform,
logit(p) = log
_
p
1 p
_
which is now spread over the whole real line. The ratio
p
1p
is also called the
odds. A (Generalised linear) model then relates the logit to the regressors in
a linear fashion;
logit((x|)) = log
_
(x|)
1 (x|)
_
= x
T
.
The coecients describe how the odds for change with change in the
explanatory variables. The model can now be treated like an ordinary linear
24
regression, X is the design matrix, is the vector of coecients. Transform-
ing back,
P(Y
i
= 1|x) = exp(x
T
)
_
_
1 + exp(x
T
)
_
.
The invariance property gives that the MLE of (x|), for any x, is (x|

),
where

is the MLE obtained in the ordinary linear regression from a sample
of responses y
1
, . . . , y
n
with associated covariate vectors x
1
, . . . , x
n
. We know
that

is approximately normally distributed, and we would like to infer
asymptotic normality of (x|

).
(i) If is scalar: Calculate that

(x
i
|) =

exp(x
i
)
_
(1 + exp(x
i
))
= x
i
e
x
i

(1 + exp(x
i
))
1
(1 + exp(x
i
))
2
x
i
e
x
i

e
x
i

= x
i
(x
i
|) x
i
((x
i
|))
2
= x
i
(x
i
|)(1 (x
i
|))
and the likelihood is
L() =
n

i=1
(x
i
|) =
n

i=1
exp(x
i
)
_
(1 + exp(x
i
)) .
Hence the log likelihood has derivative

() =
n

i=1
1
(x
i
|)
x
i
(x
i
|)(1 (x
i
|))
=
n

i=1
x
i
(1 (x
i
|))
so that

() =
n

i=1
x
2
i
(x
i
|))(1 (x
i
|)).
Thus

N(, I
1
n
_
)
_
where I
n
() =

x
2
i

i
(1
i
) with
i
= (x
i
|).
25
So now we know the parameters of the normal distribution which approx-
imates the distribution of

. The delta method with g() = e
x
/(1 + e
x
),
gives
g

() = xg()(1 g())
and hence we conclude that = (x|

) N
_
,
2
(1 )
2
x
2
I
1
()
_
.
(ii) If is vector: Similarly it is possible to calculate that

N
_
, I
1
n
()
_
where [I
n
()]
kl
= E (
2
/
k

l
). The vector version of the delta method
then gives
(x|

) N
_
,
2
(1 )
2
x
T
I
1
()x
_
with = (x|) and I
n
() = X
T
RX. Here X is the design matrix, and
R = Diag (
i
(1
i
), i = 1, . . . , n)
where
i
= (x
i
|). Note that this normal approximation is likely to be poor
for near zero or one.
26
Chapter 3
Hypothesis Testing
3.1 Pure signicance tests
We have data x = (x
1
, . . . , x
n
) from f(x, ), and a hypothesis H
0
which
restricts f(x, ). We would like to know: Are the data consistent with H
0
?
H
0
is called the null hypothesis. It is called simple if it completely species
the density of x; it is called composite otherwise.
A pure signicance test is a means of examining whether the data are
consistent with H
0
where the only distribution of the data that is explicitly
formulated is that under H
0
. Suppose that for a test statistic T = t(X),
the larger t(x), the more inconsistent the data with H
0
. For simple H
0
, the
p-value of x is then
p = P(T t(x)|H
0
).
Small p indicate more inconsistency with H
0
.
For composite H
0
: If S is sucient for then the distribution of X
conditional on S is independent of ; when S = s, the p-value of x is
p = P(T t(x)|H
0
; S = s).
Example: Dispersion of Poisson distribution. Let H
0
: X
1
, . . . , X
n
i.i.d. Poisson(), with unknown . Under H
0
, Var(X
i
) = E(X
i
) = and
so we would expect T = t(X) = S
2
/X to be close to 1. The statistic T is
also called the dispersion index.
27
We suspect that the X
i
s may be over-dispersed, that is, Var(X
i
) > EX
i
:
discrepancy with H
0
would then correspond to large T. Recall that X is suf-
cient for the Poisson distribution; the p-value under the Poisson hypothesis
is then p = P(S
2
/X t(x)|X = x; H
0
), which makes p independent of the
unknown . Given X = x and H
0
we have that
S
2
/X
2
n1
/(n 1)
(see Chapter 5 later) and so the p-value of the test satises
p P(
2
n1
/(n 1) t(x)).
Possible alternatives to H
0
guide the choice and interpretation of T. What
is a best test?
3.2 Simple null and alternative hypotheses:
The Neyman-Pearson Lemma
The general setting here is as follows: we have a random sample X
1
, . . . , X
n
from f(x; ), and two hypotheses:
a null hypothesis H
0
:
0
an alternative hypothesis H
1
:
1
where
1
= \
0
; denotes the whole parameter space. We want to
choose a rejection region or critical region R such that
reject H
0
X R.
Now suppose that H
0
: =
0
, and H
1
: =
1
are both simple. The
Type I error is: reject H
0
when it is true;
= P(reject H
0
|H
0
),
this is also known as size of the test. The Type II error is: accept H
0
when
it is false;
= P(accept H
0
|H
1
).
28
The power of the test is 1 = P(accept H
1
|H
1
).
Usually we x (e.g., = 0.05, 0.01, etc.), and we look for a test which
minimizes : this is called a most powerful or best test of size .
Intuitively: we reject H
0
in favour of H
1
if likelihood of
1
is much larger
than likelihood of
0
, given the data.
Neyman-Pearson Lemma: (see, e.g., Casella and Berger, p.366). The
most powerful test at level of H
0
versus H
1
has rejection region
R =
_
x :
L(
1
; x)
L(
0
; x)
k

_
where the constant k

is chosen so that
P(X R|H
0
) = .
This test is called the the likelihood ratio (LR) test.
Often we simplify the condition L(
1
; x)/L(
0
; x) k

to
t(x) c

,
for some constant c

and some statistic t(x); determine c

from the equation


P(T c

|H
0
) = ,
where T = t(X); then the test is reject H
0
if and only if T c

. For data
x the p-value is p = P(T t(x)|H
0
).
Example: Normal means, one-sided. Suppose that we have a ran-
dom sample X
1
, . . . , X
n
N(,
2
), wioth
2
known; let
0
and
1
be given,
and assume that
1
>
0
. We would like to test H
0
: =
0
against H
1
:
=
1
. Using the Neyman-Pearson Lemma, the best test is a likelihood ratio
test. To calculate the test, we note that
L(
1
; x)
L(
0
; x)
k (
1
; x) (
0
; x) log k

_
(x
i

1
)
2
(x
i

0
)
2

2
2
log k
(
1

0
)x k

x c (since
1
>
0
),
29
where k

, c are constants, independent of x. Hence we choose t(x) = x, and


for size test we choose c so that P(X c|H
0
) = ; equivalently, such that
P
_
X
0
/

n

c
0
/

H
0
_
= .
Hence we want
(c
0
)/(/

n) = z
1
,
(where (z
1
) = 1 with being standard normal c.d.f.), i.e.
c =
0
+z
1
/

n.
So the most powerful test of H
0
versus H
1
at level becomes reject H
0
if
and only if X
0
+z
1
/

n.
Recall the notation for standard normal quantiles: If Z N(0, 1) then
P(Z z

) = and P(Z z()) = ,


and note that z() = z
1
. Thus
P(Z z
1
) = 1 (1 ) = .
Example: Bernoulli, probability of success, one-sided. Assume
that X
1
, . . . , X
n
are i.i.d. Bernoulli() then L() =
r
(1 )
nr
where r =

x
i
. We would like to test H
0
: =
0
against H
1
: =
1
, where
0
and
1
are known, and
1
>
0
. Now
1
/
0
> 1, (1
1
)/(1
0
) < 1, and
L(
1
; x)
L(
0
; x)
=
_

0
_
r
_
1
1
1
0
_
nr
and so L(
1
; x)/L(
0
; x) k

r r

.
So the best test rejects H
0
for large r. For any given critical value r
c
,
=
n

j=r
c
_
n
j
_

j
0
(1
0
)
nj
gives the p-value if we set r
c
= r(x) =

x
i
, the observed value.
30
Note: The distribution is discrete, so we may not be able to achieve a
level test exactly (unless we use additional randomization). For example,
if R Binomial(10, 0.5), then P(R 9) = 0.011, and P(R 8) = 0.055,
so there is no c such that P(R c) = 0.05. A solution is to randomize: If
R 9 reject the null hypothesis, if R 7 accept the null hypothesis, and if
R = 8 ip a (biased) coin to achieve the exact level of 0.05.
3.3 Composite alternative hypotheses
Suppose that scalar, H
0
: =
0
is simple, and we test against a composite
alternative hypotheses; this could be one-sided:
H

1
: <
0
or H
+
1
: >
0
;
or a two-sided alternative H
1
: =
0
. The power function of a test depends
on the true parameter , and is dened as
power() = P(X R|);
the probability of rejecting H
0
as a function of the true value of the param-
eter ; it depends on , the size of the test. Its main uses are comparing
alternative tests, and choosing sample size.
3.3.1 Uniformly most powerful tests
A test of size is uniformly most powerful (UMP) if its power function is
such that
power() power

()
for all
1
, where power

() is the power function of any other size- test.


Consider testing H
0
against H
+
1
. For exponential family problems, usually
for any
1
>
0
the rejection region of the LR test is independent of
1
. At
the same time, the test is most powerful for every single
1
which is larger
than
0
. Hence the test derived for one such value of
1
is UMP for H
0
versus
H
+
1
.
Example: normal mean, composite one-sided alternative. Sup-
pose that X
1
, . . . , X
n
N(,
2
) are i.i.d., with
2
known. We want to test
31
H
0
: =
0
against H
+
1
: >
0
. First pick an arbitrary
1
>
0
. We have
seen that the most powerful test of =
0
versus =
1
has a rejection
region of the form
X
0
+z
1
/

n
for a test of size . This rejection region is independent of
1
, hence the test
which rejects H
0
when X
0
+z
1
/

n is UMP for H
0
versus H
+
1
. The
power of the test is
power() = P
_
X
0
+z
1
/

_
= P
_
X
0
+z
1
/

X N(,
2
/n)
_
= P
_
X
/

n


0

n
+z
1

X N(,
2
/n)
_
= P
_
Z z
1


0
/

Z N(0, 1)
_
= 1
_
z
1
(
0
)

n/
_
.
The power increases from 0 up to at =
0
and then to 1 as increases.
The power increases as increases.
Sample size calculation in the Normal example
Suppose want to be near-certain to reject H
0
when =
0
+, say, and have
size 0.05. Suppose we want to x n to force power() = 0.99 at =
0
+:
0.99 = 1 (1.645

n/)
so that 0.01 = (1.645

n/). Solving this equation (use tables) gives


2.326 = 1.645

n/, i.e.
n =
2
(1.645 + 2.326)
2
/
2
is the required sample size.
UMP tests are not always available. If not, options include a
1. Wald test
2. locally most powerful test (score test)
3. generalised likelihood ratio test.
32
3.3.2 Wald tests
The Wald test is directly based on the asymptotic normality of the m.l.e.

n
, often

N
_
, I
1
n
()
_
if is the true parameter. Also it is often
true that asymptotically, we may replace by

in the Fisher information,

N
_
, I
1
n
(

)
_
.
So we can construct a test based on
W =
_
I
n
(

)(


0
) N(0, 1).
If is scalar, squaring gives
W
2

2
1
,
so equivalently we could use a chi-square test.
For higher-dimensional we can base a test on the quadratic form
(


0
)
T
I
n
(

)(


0
)
which is approximately chi-square distributed in large samples.
If we would like to test H
0
: g() = 0, where g is a (scalar) dierentiable
function, then the delta method gives as test statistic
W = g(

){G(

)(I
n
(

))
1
G(

)
T
}
1
g(

),
where G() =
g()

T
.
An advantage of the Wald test is that we do not need to evaluate the
likelihood under the null hypothesis, which can be awkward if the null hy-
pothesis contains a number of restrictions on a multidimensional parameter.
All we need is (an approximation) of

, the maximum-likelihood-estimator.
But there is also a disadvantage:
Example: Non-invariance of the Wald test
Suppose that

is scalar and approximately N(, I
n
()
1
)-distributed,
then for testing H
0
: = 0 the Wald statistic becomes

_
I
n
(

),
33
which would be approximately standard normal. If instead we tested H
0
:

3
= 0, then the delta method with g() =
3
, so that g

() = 3
2
, gives
V ar(g(

)) 9

4
(I
n
(

))
1
and as Wald statistic

3
_
I
n
(

).
3.3.3 Locally most powerful test (Score test)
We consider rst the problem to test H
0
: =
0
against H
1
: =
0
+. for
some small > 0. We have seen that the most powerful test has a rejection
region of the form
(
0
+) (
0
) k.
Taylor expansion gives
(
0
+) (
0
) +
(
0
)

i.e.
(
0
+) (
0
)
(
0
)

.
So a locally most powerful (LMP) test has as rejection region
R =
_
x :
(
0
)

_
.
This is also called the score test: / is known as the score function.
Under certain regularity conditions,
E

_
= 0, Var

_
= I
n
().
As is usually a sum of independent components, so is (
0
)/, and the
CLT (Central Limit Theorem) can be applied.
Example: Cauchy parameter. Suppose that X
1
, . . . , X
n
is a random
sample from Cauchy (), having density
f(x; ) =
_

_
1 + (x )
2
_
1
for < x < .
34
Test H
0
: =
0
against H
+
1
: >
0
. Then
(
0
; x)

= 2

_
x
i

0
1 + (x
i

0
)
2
_
.
Fact: Under H
0
, the expression (
0
; X)/ has mean 0, variance I
n
(
0
) =
n/2. The CLT applies, (
0
; X)/ N(0, n/2) under H
0
, so for the LMP
test,
P(N(0, n/2) k

) = P
_
N(0, 1) k

_
2
n
_
.
This gives k

z
1
_
n/2, and as rejection region with approximate size
R =
_
x : 2

_
x
i

0
1 + (x
i

0
)
2
_
>
_
n
2
z
1
_
.
The score test has the advantage that we only need the likelihood under
the null hypothesis. It is also not generally invariant under reparametrisation.
The multidimensional version of the score test is as follows: Let U =
/ be the score function, then the score statistic is
U
T
I
n
(
0
)
1
U.
Compare with a chi-square distribution.
3.3.4 Generalised likelihood ratio (LR) test
For testing H
0
: =
0
against H
+
1
: >
0
, the generalised likelihood ratio
test uses as rejection region
R =
_
x :
max

0
L(; x)
L(
0
; x)
k

_
.
If L has one mode, at the m.l.e.

, then the likelihood ratio in the denition
of R is either 1, if


0
, or L(

; x)/L(
0
; x), if

>
0
(and similarly for
H

1
, with fairly obvious changes of signs and directions of inequalities).
The generalised LRT is invariant to a change in parametrisation.
35
3.4 Two-sided tests
Test H
0
: =
0
against H
1
: =
0
. If the one-sided tests of size have
symmetric rejection regions
R
+
= {x : t > c} and R

= {x : t < c},
then a two-sided test (of size 2) is to take the rejection region to
R = {x : |t| > c};
this test has as p-value p = P(|t(X)| t|H
0
).
The two-sided (generalised) LR test uses
T = 2 log
_
max

L(; X)
L(
0
; X)
_
= 2 log
_
L(

; X)
L(
0
; X)
_
and rejects H
0
for large T.
Fact: T
2
1
under H
0
(to be seen in Chapter 5).
Where possible, the exact distribution of T or of a statistic equivalent
to T should be used.
If is a vector: there is no such thing as a one-sided alternative hypoth-
esis. For the alternative =
0
we use a LR test based on
T = 2 log
_
L(

; X)
L(
0
; X)
_
.
Under H
0
, T
2
p
where p = dimension of (see Chapter 5).
For the score test we use as statistic

(
0
)
T
[I
n
(
0
)]
1

(
0
),
where I
n
() is the expected Fisher information matrix:
[I
n
()]
jk
= E[
2
/
j

k
].
36
If the CLT applies to the score function, then this quadratic form is again
approximately
2
p
under H
0
(see Chapter 5).
Example: Pearsons Chi-square statistic. We have a random sample
of size n, with p categories; P(X
j
= i) =
i
, for i = 1, . . . , p, j = 1, . . . , n. As

i
= 1, we take = (
1
, . . . ,
p1
). The likelihood function is then

n
i
i
where n
i
= # observations in category i (so

n
i
= n). We think of
n
1
, . . . , n
p
as realisations of random counts N
1
, . . . , N
p
. The m.l.e. is

=
n
1
(n
1
, . . . , n
p1
). Test H
0
: =
0
, where
0
= (
1,0
, . . . ,
p1,0
), against
H
1
: =
0
.
The score vector is vector of partial derivatives of
() =
p1

i=1
n
i
log
i
+n
p
log
_
1
p1

k=1

k
_
with respect to
1
, . . . ,
p1
:

i
=
n
i

n
p
1

p1
k=1

k
.
The matrix of second derivatives has entries

k
=
n
i

ik

2
i

n
p
(1

p1
i=1

i
)
2
,
where
ik
= 1 if i = k, and
ik
= 0 if i = k. Minus the expectation of this,
using E

0
(N
i
) = n
i
, gives
I
n
() = nDiag(
1
1
, . . . ,
1
p1
) +n11
T

1
p
,
where 1 is a (p 1)-dimensional vector of ones.
Compute

(
0
)
T
[I
n
(
0
)]
1

(
0
) =
p

i=1
(n
i
n
i,0
)
2
n
i,0
;
this statistic is called the chi-squared statistic, T say. The CLT for the score
vector gives that T
2
p1
under H
0
.
37
Note: the form of the chi-squared statistic is

(O
i
E
i
)
2
/E
i
where O
i
and E
i
refer to observed and expected frequencies in category i:
This is known as Pearsons chi-square statistic.
3.5 Composite null hypotheses
Let = (, ), where is a nuisance parameter. We want a test which
does not depend on the unknown value of . Extending two of the previous
methods:
3.5.1 Generalised likelihood ratio test: Composite null
hypothesis
Suppose that we want to test H
0
:
0
against H
1
:
1
= \
0
. The
(generalised) LR test uses the likelihood ratio statistic
T =
max

L(; X)
max

0
L(; X)
and rejects H
0
for large values of T.
Now = (, ). Assuming that is scalar, test H
0
: =
0
against
H
+
1
: >
0
. The LR statistic T is
T =
max

0
,
L(, )
max

L(
0
, )
=
max

0
L
P
()
L
P
(
0
)
,
where L
P
() is the prole likelihood for . For H
0
against H
1
: =
0
,
T =
max
,
L(, )
max

L(
0
, )
=
L(

)
L
P
(
0
)
.
Often (see Chapter 5):
2 log T
2
p
38
where p is the dimension of .
An important requirement for this approach is that the dimension of
does not depend on n.
Example: Normal distribution and Student t-test. Suppose that
X is a random sample of size n, from N(,
2
), where both and are
unknown; we would like to test H
0
: =
0
. Ignoring an irrelevant additive
constant,
() = nlog
n(x )
2
+ (n 1)s
2
2
2
.
Maximizing this w.r.t. with xed gives

P
() =
n
2
log
_
(n 1)s
2
+n(x )
2
n
_
.
If our alternative is H
+
1
: >
0
then we maximize
P
() over
0
:
if x
0
then the maximum is at =
0
; if x >
0
then the maximum is at
= x. So log T = 0 when x
0
and is

n
2
log
_
(n 1)s
2
n
_
+
n
2
log
_
(n 1)s
2
+n(x
0
)
2
n
_
=
n
2
log
_
1 +
n(x
0
)
2
(n 1)s
2
_
when x >
0
. Thus the LR rejection region is of the form
R = {x : t(x) c

},
where
t(x) =

n(x
0
)
s
.
This statistic is called Student-t statistic. Under H
0
, t(X) t
n1
, and for a
size test set c

= t
n1,1
; the p-value is p = P(t
n1
t(x)). Here we use
the quantile notation P(t
n1
t
n1,1
) = .
The two-sided test of H
0
against H
1
: =
0
is easier, as unconstrained
maxima are used. The size test has rejection region
R = {x : |t(x)| t
n1,1/2
}.
39
3.5.2 Score test: Composite null hypothesis
Now = (, ) with scalar, test H
0
: =
0
against H
+
1
: >
0
or
H

1
: <
0
. The score test statistic is
T =
(
0
,

0
; X)

,
where

0
is the MLE for when H
0
is true. Large positive values of T
indicate H
+
1
, and large negative values indicate H

1
. Thus the rejection
regions are of the form T k
+

when testing against H


+
1
, and T k

when
testing against H

1
.
Recall the derivation of the score test,
(
0
+) (
0
)
(
0
)

= T.
If > 0, i.e. for H
+
1
, we reject if T is large; if < 0, i.e. for H

1
, we reject if
T is small.
Sometimes the exact null distribution of T is available; more often we
use that T normal (by CLT, see Chapter 5), zero mean. To nd the
approximate variance:
1. compute I
n
(
0
, )
2. invert to I
1
n
3. take the diagonal element corresponding to
4. invert this element
5. replace by the null hypothesis MLE

0
.
Denote the result by v, then Z = T/

v N(0, 1) under H
0
.
A considerable advantage is that the unconstrained MLE

is not re-
quired.
Example: linear or non-linear model? We can extend the linear
model Y
j
= (x
T
j
) +
j
, where
1
, . . . ,
n
i.i.d. N(0,
2
), to a non-linear model
Y
j
= (x
T
j
)

+
j
40
with the same s. Test H
0
: = 1: usual linear model, against, say,
H

1
: < 1. Here our nuisance parameters are
T
= (
T
,
2
).
Write
j
= x
T
j
, and denote the usual linear model tted values by
j0
=
x
T
j

0
, where the estimates are obtained under H
0
. As Y
j
N(
j
,
2
), we
have up to an irrelevant additive constant,
(, , ) = nlog
1
2
2

(y
j

j
)
2
,
and so

=
1

(y
j

j
)

j
log
j
,
yielding that the null MLEs are the usual LSEs (least-square estimates),
which are

0
= (X
T
X)
1
X
T
Y,
2
= n
1

(Y
j
x
T
j

0
)
2
.
So the score test statistic becomes
T =
1

2

(Y
j

j0
)(
j0
log
j0
).
We reject H
0
for large negative values of T.
Compute the approximate null variance (see below):
I
n
(
0
, , ) =
1

2
_
_

u
2
j

u
j
x
T
j
0

u
j
x
j

x
j
x
T
j
0
0 0 2n
_
_
where u
j
=
j
log
j
. The (1, 1) element of the inverse of I
n
has reciprocal
_
u
T
u u
T
X(X
T
X)
1
X
T
u
_ _

2
,
where u
T
= (u
1
, . . . , u
n
). Substitute
j0
for
j
and
2
for
2
to get v. For
the approximate p-value calculate z = t/

v and set p = (z).


Calculation trick: To compute the (1, 1) element of the inverse of I
n
above:
if
A =
_
a x
T
x B
_
41
where a is a scalar, x is an (n 1) 1 vector and B is an (n 1) (n 1)
matrix, then (A
1
)
11
= 1/(a x
T
B
1
x).
Recall also:

e
ln
= ln e
ln
=

ln .
For the (1, 1)-entry of the information matrix, we calculate

2
=
1

_
(

j
log
j
)

j
log
j
+ (y
j

j
)

j
(log
j
)
2
_
,
and as Y
j
N(
j
,
2
) we have
E
_

2
_
=
1

j
log
j

j
log
j
=
1

u
2
j
,
as required. The o-diagonal terms in the information matrix can be calcu-
lated in a similar way, using that

= x
T
j
.
3.6 Multiple tests
When many tests applied to the same data, there is a tendency for some
p-values to be small: Suppose P
1
, . . . , P
m
are the random P-values for m
independent tests at level (before seeing the data); for each i, suppose that
P(P
i
) = if the null hypothesis is true. But then the probability that at
least one of the null hypothesis is rejected if m independent tests are carried
out is
1 P( none rejected) = 1 (1 )
m
.
Example: If = 0.05 and m = 10, then
P( at least one rejected |H
0
true ) = 0.4012.
Thus with high probability at least one signicant result will be found
even when all the null hypotheses are true.
42
Bonferroni: The Bonferroni inequality gives that
P(min P
i
|H
0
)
m

i=1
P(P
i
|H
0
) m.
A cautious approach for an overall level is therefore to declare the most
signicant of m test results as signicant at level p only if min p
i
p/m.
Example: If = 0.05 and m = 10, then reject only if the p-value is less
than 0.005.
3.7 Combining independent tests
Suppose we have k independent experiments/studies for the same null hy-
pothesis. If only the p-values are reported, and if we have continuous distribu-
tion, we may use that under H
0
each p-value is U[0, 1] uniformly distributed
(Exercise). This gives that
2
k

i=1
log P
i

2
2k
(exactly) under H
0
, so
p
comb
= P(
2
2k
2

log p
i
).
If each test is based on a statistic T such that T
i
N(0, v
i
), then the
best combination statistic is
Z =

(T
i
/v
i
)/
_

v
1
i
.
If H
0
is a hypothesis about a common parameter , then the best com-
bination of evidence is

P,i
(),
and the combined test would be derived from this (e.g., an LR or score test).
43
Advice
Even though a test may initially be focussed on departures in one direc-
tion, it is usually a good idea not to totally disregard departures in the other
direction, even if they are unexpected.
Warning:
Not rejecting the null hypothesis does not mean that the null hypothesis
is true! Rather it means that there is not enough evidence to reject the null
hypothesis; the data are consistent with the null hypothesis.
The p-value is not the probability that the null hypothesis is true.
3.8 Nonparametric tests
Sometimes we do not have a parametric model available, and the null hy-
pothesis is phrased in terms of arbitrary distributions, for example concerning
only the median of the underlying distribution. Such tests are called non-
parametric or distribution-free; treating these would go beyond the scope of
these lectures.
44
Chapter 4
Interval estimation
The goal for interval estimation is to specify the accurary of an estimate. A
1 condence set for a parameter is a set C(X) in the parameter space
, depending only on X, such that
P

_
C(X)
_
= 1 .
Note: it is not that is random, but the set C(X) is.
For a scalar we would usually like to nd an interval
C(X) = [l(X), u(X)]
so that P

_
[l(X), u(X)]
_
= 1 . Then [l(X), u(X)] is an interval esti-
mator or condence interval for ; and the observed interval [l(x), u(x)] is
an interval estimate. If l is or if u is +, then we have a one-sided
estimator/estimate. If l is , we have an upper condence interval, if u is
+, we have an lower condence interval.
Example: Normal, unknown mean and variance. Let X
1
, . . . , X
n
be a random sample from N(,
2
), where both and
2
are unknown. Then
(X )/(S/

n) t
n1
and so
1 = P
,
2
_

X
S/

t
n1,1/2
_
= P
,
2(X t
n1,1/2
S/

n X +t
n1,1/2
S/

n),
and so the (familiar) interval with end points
X t
n1,1/2
S/

n
is a 1 condence interval for .
45
4.1 Construction of condence sets
4.1.1 Pivotal quantities
A pivotal quantity (or pivot) is a random variable t(X, ) whose distribution
is independent of all parameters, and so it has the same distribution for all .
Example: (X )/(S/

n) in the example above has t


n1
-distribution if
the random sample comes from N(,
2
).
We use pivotal quantities to construct condence sets, as follows. Suppose
is a scalar. Choose a, b such that
P

(a t(X, ) b) = 1 .
Manipulate this equation to give P

_
l(X) u(X)
_
= 1 (if t is a
monotonic function of ); then [l(X), u(X)] is a 1 condence interval for
.
Example: Exponential random sample. Let X
1
, . . . , X
n
be a ran-
dom sample from an exponential distribution with unknown mean . Then
we know that nX/ Gamma(n, 1). If the -quantile of Gamma(n, 1) is
denoted by g
n,
then
1 = P

(nX/ g
n,
) = P

( nX/g
n,
).
Hence [0, nX/g
n,
] is a 1 condence interval for . Alternatively, we say
that nX/g
n,
is the upper 1 condence limit for .
4.1.2 Condence sets derived from point estimators
Suppose

(X) is an estimator for a scalar , from a known distribution. Then
we can take our condence interval as
[

a
1
,

+b
1
]
where a
1
and b
1
are chosen suitably.
If

N(, v), perhaps approximately, then for a symmetric interval
choose
a
1
= b
1
= z
1/2

v.
46
Note: [

a
1
,

+ b
1
] is not immediately a condence interval for
if v depends on : in that case replace v() by v(

), which is a further
approximation.
4.1.3 Approximate condence intervals
Sometimes we do not have an exact distribution available, but normal ap-
proximation is known to hold.
Example: asymptotic normality of m.l.e. . We have seen that,
under regularity,

N
_
, I
1
()
_
. If is scalar, then (under regularity)

z
1/2
/
_
I
n
(

)
is an approximate 1 condence interval for .
Sometimes we can improve the accuracy by applying (monotone) trans-
formation of the estimator, using the delta method, and inverting the trans-
formation to get the nal result.
As a guide line for transformations, in general a normal approximation
should be used on a scale where a quantity ranges over (, ).
Example: Bivariate normal distribution. Let (X
i
, Y
i
), i = 1, . . . , n,
be a random sample from a bivariate normal distribution, with unknown
mean vector and covariance matrix. The parameter of interest is , the
bivariate normal correlation. The MLE for is the sample correlation
R =

n
i=1
(X
i
X)(Y
i
Y )
_

n
i=1
(X
i
X)
2

n
i=1
(Y
i
Y )
2
,
whose range is [1, 1]. For large n,
R N(, (1
2
)
2
/n),
using the expected Fisher information matrix to obtain an approximate vari-
ance (see the section on asymptotic theory).
But the distribution of R is very skewed, the approximation is poor un-
less n is very large. For a variable whose range is (, ), we use the
tranformation
Z =
1
2
log[(1 +R)/(1 R)];
47
this transformation is called the Fisher z transformation. By the delta
method,
Z N(, 1/n)
where =
1
2
log[(1 + )/(1 )]. So a 1 condence interval for can
be calculated as follows: for compute the interval limits Z z
1/2
/

n,
then transform these to the scale using the inverse transformation =
(e
2
1)/(e
2
+ 1).
4.1.4 Condence intervals derived from hypothesis tests
Dene C(X) to be the set of values of
0
for which H
0
would not be rejected
in size- tests of H
0
: =
0
. Here the form of the 1 condence set
obtained depends on the alternative hypotheses.
Example: to produce an interval with nite upper and lower limits use H
1
:
=
0
; to nd an upper condence limit use H

1
: <
0
.
Example: Normal, known variance, unknown mean. Let X
1
, . . . , X
n
be i.i.d. N(,
2
), where
2
known. For H
0
: =
0
versus H
1
: =
0
the
usual test has an acceptance region of the form

X
0
/

z
1/2
.
So the values of
0
for which H
0
is accepted are those in the interval
[X z
1/2
/

n, X +z
1/2
/

n];
this interval is a 100(1 )% condence interval for .
For H
0
: =
0
versus H

1
: <
0
the UMP test accepts H
0
if
X
0
z
1
/

n
i.e., if

0
X +z
1
/

n.
So an upper 1 condence limit for is X +z
1
/

n.
48
4.2 Hypothesis test from condence regions
Conversely, we can also construct tests based on condence interval:
For H
0
: =
0
against H
1
: =
0
, if C(X) is 100(1 )% two-sided
condence region for , then for a size test reject H
0
if
0
= C(X): The
condence region is the acceptance region for the test.
If is a scalar: For H
0
: =
0
against H

1
: <
0
, if C(X) is 100(1)%
upper condence region for , then for a size test reject H
0
if
0
= C(X).
Example: Normal, known variance. Let X
1
, . . . , X
n
N(,
2
) be
i.i.d., where
2
is known. For H
0
: =
0
versus H
1
: =
0
the usual
100(1 )% condence region is
[X z
1/2
/

n, X +z
1/2
/

n],
so reject H
0
if

X
0
/

> z
1/2
.
To test H
0
: =
0
versus H

1
: <
0
: an upper 100(1)% condence
region is X +z
1/2
/

n, so reject H
0
if

0
> X +z
1
/

n
i.e. if
X <
0
z
1
/

n.
We can also construct approximate hypothesis test based on approximate
condence intervals. For example, we use the asymptotic normality of m.l.e.
to derive a Wald test.
4.3 Prediction Sets
What is a set of plausible values for a future data value? A 1 prediction
set for an unobserved random variable X
n+1
based on the observed data
X = (X
1
, . . . , X
n
) is a random set P(X) for which
P(X
n+1
P(X)) = 1 .
49
Sometimes such a set can be derived by nding a prediction pivot t(X, X
n+1
)
whose distribution does not depend on . If a set R is such that P(t(X, X
n+1
)
R) = 1 , then a 1 prediction set is
P(X) = {X
n+1
: t(X, X
n+1
) R}.
Example: Normal, unknown mean and variance. Let X
1
, . . . , X
n

N(,
2
) be i.i.d., where both and
2
are unknown. A possible prediction
pivot is
t(X, X
n+1
) =
X
n+1
X
S
_
1 +
1
n
.
As X N(,

2
n
) and X
n+1
N(,
2
) is independent of X, it follows that
X
n+1
X N(0,
2
(1 + 1/n)), and so t(X, X
n+1
) has t
n1
distribution.
Hence a 1 prediction interval is
{X
n+1
: |t(X, X
n+1
)| t
n1,1/2
}
=
_
X
n+1
: X S
_
1 +
1
n
t
n1,1/2
X
n+1
X +S
_
1 +
1
n
t
n1,1/2
_
.
50
Chapter 5
Asymptotic Theory
What happens as n ?
Let = (
1
, . . . ,
p
) be the parameter of interest, let () be the log-
likelihood. Then

() is a vector, with jth component /


j
, and I
n
() is
the Fisher information matrix, whose (j, k) entry is E

(
2
/
j

k
).
5.1 Consistency
A sequence of estimators T
n
for , where T
n
= t
n
(X
1
, . . . , X
n
), is said to be
consistent if, for any > 0,
P

(|T
n
| > ) 0 as n .
In that case we also say that T
n
converges to in probability.
Example: the sample mean. Let X
n
be and i.i.d. sample of size n,
with nite variance, mean then, by the weak law of large numbers, X
n
is
consistent for .
Recall: The weak law of large numbers states: Let X
1
, X
2
, . . . be a se-
quence of independent random variables with E(X
i
) = and V ar(X
i
) =
2
,
and let X
n
=
1
n

n
i=1
X
i
. Then, for any > 0,
P(|X
n
| > ) 0 as n .
51
A sucient condition for consistency is that Bias(T
n
) 0 and Var(T
n
)
0 as n . (Use the Chebyshev inequality to show this fact).
Subject to regularity conditions, MLEs are consistent.
5.2 Distribution of MLEs
Assume that X
1
, . . . , X
n
are i.i.d. where scalar, and

=

(X) is the m.l.e.;
assume that

exists and is unique. In regular problems,

is solution to the
likelihood equation

() = 0. Then Taylor expansion gives


0 =

() + (

()
and so

()
I
n
()
(

()
I
n
()
. (5.1)
For the left hand side of (5.1):

()/I
n
() =

Y
i
/(n)
where
Y
i
=
2
/
2
{log f(X
i
; )}
and = E(Y
i
). The weak law of large numbers gives that

()/I
n
() 1
in probability, as n . So

()
I
n
()
.
For the right hand side of (5.1),

() =

/{log f(X
i
; )}
is the sum of i.i.d. random variables. By the CLT,

() is approximately
normal with mean E[

()] = 0 and variance Var(

()) = I
n
(), and hence

() N(0, I
n
()) or

()/I() N(0, [I
n
()]
1
). (5.2)
52
Combining:

N(0, [I
n
()]
1
).
Result:

N(, [I
n
()]
1
) (5.3)
is the approximate distribution of the MLE.
The above argument generalises immediately to being a vector: if
has p components, say, then

is approximately multivariate normal in p-
dimensions with mean vector and covariance matrix [I
n
()]
1
.
In practice we often use I
n
(

) in place of I
n
().
A corresponding normal approximation applies to any monotone trans-
formation of

by the delta method, as seen before.
Back to our tests:
1. Wald test
2. Score test (LMP test)
3. Generalised LR test.
A normal approximation for the Wald test follows immediately from (5.3).
5.3 Normal approximation for the LMP/score
test
Test H
0
: =
0
against H
+
1
: >
0
(where is a scalar:) We reject H
0
if

() is large (in contrast, for H


0
versus H

1
: <
0
, small values of

()
would indicate H

1
). The score test statistic is

()/
_
I
n
(). From (5.2) we
obtain immediately that

()/
_
I
n
() N(0, 1).
To nd an (approximate) rejection region for the test: use the normal ap-
proximation at =
0
, since the rejection region is calculated under the
assumption that H
0
is true.
53
5.4 Chi-square approximation for the gener-
alised likelihood ratio test
Test H
0
: =
0
against H
1
: =
0
, where is scalar. Reject H
0
if
L(

; X)/L(; X) is large; equivalently, reject for large


2 log LR = 2[(

) ()].
We use Taylor expansion around

:
(

) () (

)
1
2
(

)
2

).
Setting

) = 0, we obtain
(

) ()
1
2
(

)
2

).
By the consistency of

, we may approximate

) I
n
()
to get
2[(

) ()] (

)
2
I
n
() =
_

_
I
1
n
()
_
2
.
From (5.2), the asymptotic normality of

, and as
2
1
variable is the square
of a N(0, 1) variable, we obtain that
2 log LR = 2[(

) ()]
2
1
.
We can calculate a rejection region for the test of H
0
versus H
1
under this
approximation.
For = (
1
, . . . ,
p
), testing H
0
: =
0
versus H
1
: =
0
, the dimension
of the normal limit for

is p, hence the degrees of freedom of the related
chi-squared variables are also p:

()
T
[I
n
()]
1

()
2
p
and
2 log LR = 2[(

) ()]
2
p
.
54
5.5 Prole likelihood
Now = (, ), and

is the MLE of when xed. Recall that the prole


log-likelihood is given by
P
() = (,

).
5.5.1 One-sided score test
We test H
0
: =
0
against H
+
1
: >
0
; we reject H
0
based on large values
of the score function T =

(,

). Again T has approximate mean zero.


For the approximate variance of T, we expand
T

(, ) + (

,
(, ).
From (5.1),

I
1
n

.
We write this as
_

_
I
,
I
,
I
,
I
,
_
1
_

_
.
Here

= /,

= /,

,
=
2
/, I
,
= E[

,
] etc. Now
substitute

I
1
,

and put

,
I
,
.
Calculate
V (T) I
,
+ (I
1
,
)
2
I
2
,
I
,
2I
1
,
I
,
I
,
to get
T

I
1
,
I
,

N(0, 1/I
,
n
),
where I
,
n
= (I
,
I
2
,
I
1
,
)
1
is the top left element of I
1
n
. Estimate
the Fisher information by substituting the null hypothesis values. Finally
calculate the practical standardized form of T as
Z =
T
_
Var(T)

(,

)[I
,
n
(,

)]
1/2
N(0, 1).
Similar results for vector-valued and vector-valued hold, with obvious
modications, provided that the dimension of is xed (i.e., independent of
the sample size n).
55
5.5.2 Two-sided likelihood ratio tests
Assume that and are scalars. We use similar arguments as above, in-
cluding Taylor expansion, for
2 log LR = 2
_
(

) (,

)
_
to obtain
2 log LR (

)
2
/I
,
n

2
1
, (5.4)
where I
,
n
= (I
,
I
2
,
I
1
,
)
1
is the top left element of I
1
n
. The chi-squared
approximation above follows from

normal.
(Details can be found in the additional material at the end of this section.)
In general, if is p-dimensional, then 2 log LR
2
p
.
Note: This result applies to the comparison of nested models, i.e., where
one model is a special case of the other, but it does not apply to the com-
parison of non-nested models.
5.6 Connections with deviance
In GLMs, the deviance is usually 2 log LR for two nested models, one the
saturated model with a separate parameter for every response and the other
the GLM (linear regression, log-linear model, etc.) For normal linear models
the deviance equals the RSS. The general chi-squared result above need not
apply to the deviance, because has dimension np where p is the dimension
of the GLM.
But the result does apply to deviance dierences: Compare the GLM t
with p parameters (comprising = (, )) to a special case with only q (< p)
parameters (i.e., with omitted), then 2 log LR for that comparison is the
deviance dierence, and in the null case (special case correct)
2
pq
.
56
5.7 Condence regions
We can construct condence regions based on the asymptotic normal distri-
butions of the score statistic and the MLE, or on the chi-square approxima-
tion to the likelihood ratio statistic, or to the prole likelihood ratio statistic.
These are equivalent in the limit n , but they may display slightly dif-
ferent behaviour for nite samples.
Example: Wald-type interval. Based on the asymptotic normality
of a p-dimensional

, an approximate 1 condence region is
{ : (

)
T
I
n
(

)(

)
2
p,1
}.
As an alternative to using I
n
(

) we could use J
n
(

), the observed information


or observed precision evaluated at

, where [J
n
()]
jk
=
2
/
j

k
.
An advantage of the rst type of region is that all values of inside
the condence region have higher likelihood than all values of outside the
region.
Example: normal sample, known variance. Let X
1
, . . . , X
n

N(,
2
) be i.i.d, with
2
known. The log LR dierence is
( ; x) (; x) =
1
2
2
_

(x
i
x)
2

(x
i
)
2
_
=
n(x )
2
2
2
,
so an approximate condence interval is given by the values of satisfying
n(X )
2
2
2

1
2

2
1,1
or

X
/

z
1/2
,
which gives the same interval as in Chapter 4. In this case the approximate

2
result is, in fact, exact.
5.8 Additional material: Derivation of (5.4)
Assume and scalars, then
_

_
I
,
I
,
I
,
I
,
_
1
_

_
.
57
Similarly we have that

I
1
,

.
As

I
,
(

) +I
,
(

),
we obtain



+I
,
I
1
,
(

).
Taylor expansion gives
2 log LR = 2
_
(

) (,

)
_
= 2
_
(

) (, )
_
2
_
(,

) (, )
_
(

,

)I
n
(

,

)
T
(0,

)I
n
(0,

)
T
.
Substituting for

gives
2 log LR (

)
2
/I
,
n

2
1
,
where I
,
n
= (I
,
I
2
,
I
1
,
)
1
is the top left element of I
1
n
. This is what
we wanted to show.
58
Part II
Bayesian Statistics
59
Chapter 6
Bayesian Statistics:
Background
Frequency interpretation of probability
In the frequency interpretation of probability, the probability of an event
is limiting proportion of times the event occurs in an innite sequence of
independent repetitions of the experiment. This interpretation assumes that
an experiment can be repeated!
Problems with this interpretation:
Independence is dened in terms of probabilities; if probabilities are de-
ned in terms of independent events, this leads to a circular denition.
How can we check whether experiments were independent, without doing
more experiments?
In practice we have only ever a nite number of experiments.
Subjective probability
Let P(A) denote your personal probability of an event A; this is a nu-
merical measure of the strength of your degree of belief that A will occur, in
the light of available information.
Your personal probabilities may be associated with a much wider class
of events than those to which the frequency interpretation pertains. For
example:
60
- non-repeatable experiments (e.g. that England will win the World Cup
next time)
- propositions about nature (e.g. that this surgical procedure results in
increased life expectancy) .
All subjective probabilities are conditional, and may be revised in the
light of additional information. Subjective probabilities are assessments in
the light of incomplete information; they may even refer to events in the past.
Axiomatic development
Coherence:
Coherence states that a system of beliefs should avoid internal inconsis-
tencies. Basically, a quantitative, coherent belief system must behave as if
it was governed by a subjective probability distribution. In particular this
assumes that all events of interest can be compared.
Note: dierent individuals may assign dierent probabilities to the same
event, even if they have identical background information.
(See Chapters 2 and 3 in Bernardo and Smith for fuller treatment of
foundational issues.)
Bayes Theorem
Let B
1
, B
2
, . . . , B
k
be a set of mutually exclusive and exhaustive events.
For any event A with P(A) > 0,
P(B
i
|A) =
P(B
i
A)
P(A)
=
P(A|B
i
)P(B
i
)

k
j=1
P(A|B
j
)P(B
j
)
.
Equivalently we write
P(B
i
|A) P(A|B
i
)P(B
i
).
Terminology
P(B
i
) is the prior probability of B
i
;
P(A|B
i
) is the likelihood of A given B
i
;
61
P(B
i
|A) is the posterior probability of B
i
;
P(A) is the predictive probability of A implied by the likelihoods and the
prior probabilities.
Example: Two events. Assume we have two events B
1
, B
2
, then
P(B
1
|A)
P(B
2
|A)
=
P(B
1
)
P(B
2
)

P(A|B
1
)
P(A|B
2
)
.
If the data is relatively more probable under B
1
than under B
2
, our belief in
B
1
compared to B
2
is increased, and conversely.
If B
2
= B
c
1
:
P(B
1
|A)
P(B
c
1
|A)
=
P(B
1
)
P(B
c
1
)

P(A|B
1
)
P(A|B
c
1
)
.
It follows that: posterior odds = prior odds likelihood ratio.
Parametric models
A Bayesian statistical model consists of
1.) A parametric statistical model f(x|) for the data x, where a
parameter; x may be multidimensional. - Note that we write f(x|) instead
of f(x, ) do emphasise the conditional character of the model. 2.) A prior
distribution () on the parameter.
Note: The parameter is now treated as random!
The posterior distribution of given x is
(|x) =
f(x|)()
_
f(x|)()d
Shorter, we write: (|x) f(x|)() or posterior prior likeli-
hood .
Nuisance parameters
Let = (, ), where is a nuisance parameter. Then (|x) = ((, )|x).
We calculate the marginal posterior of :
(|x) =
_
(, |x)d
62
and continue inference with this marginal posterior. Thus we just integrate
out the nuisance parameter.
Prediction
The (prior) predictive distribution of x on the basis is
p(x) =
_
f(x|)()d.
Suppose data x
1
is available, and we want to predict additional data:
p(x
2
|x
1
) =
p(x
2
, x
1
)
p(x
1
)
=
_
f(x
2
, x
1
|)()d
_
f(x
1
|)()d
=
_
f(x
2
|, x
1
)
f(x
1
|)()
_
f(x
1
|)()d
d
=
_
f(x
2
|)
f(x
1
|)()
_
f(x
1
|)()d
d
=
_
f(x
2
|)(|x
1
)d.
Note that x
2
and x
1
are assumed conditionally independent given . They
are not, in general, unconditionally independent.
Example
(Bayes) A billard ball W is rolled from left to right on a line of length 1
with a uniform probability of stopping anywhere on the line. It stops at p.
A second ball O is then rolled n times under the same assumptions, and X
denotes the number of times that the ball O stopped on the left of W. Given
X, what can be said about p?
Our prior is (p) = 1 for 0 p 1; our model is
P(X = x|p) =
_
n
x
_
p
x
(1 p)
nx
for x = 0, . . . , n
63
We calculate the predictive distribution, for x = 0, . . . , n
P(X = x) =
_
1
0
_
n
x
_
p
x
(1 p)
nx
dp
=
_
n
x
_
B(x + 1, n x + 1)
=
_
n
x
_
x!(n x)!
(n + 1)!
=
1
n + 1
,
where B is the beta function,
B(, ) =
_
1
0
p
1
(1 p)
1
dp =
()()
( +)
.
We calculate the posterior distribution:
(p|x) 1
_
n
x
_
p
x
(1 p)
nx
p
x
(1 p)
nx
,
so
(p|x) =
p
x
(1 p)
nx
B(x + 1, n x + 1)
;
this is the Beta(x + 1, n x + 1)-distribution.
In particular the posterior mean is
E(p|x) =
_
1
0
p
p
x
(1 p)
nx
B(x + 1, n x + 1)
dp
=
B(x + 2, n x + 1)
B(x + 1, n x + 1)
=
x + 1
n + 2
.
(For comparison: the mle is
x
n
.)
Further, P(O stops to the left of W on the next roll |x) is Bernoulli-
distributed with probability of success E(p|x) =
x+1
n+2
.
64
Example: exponential model, exponential prior
Let X
1
, . . . , X
n
be a random sample with density f(x|) = e
x
for
x 0, and assume () = e

for 0; and some known . Then


f(x
1
, . . . , x
n
|) =
n
e

n
i=1
x
i
and hence the posterior distribution is
(|x)
n
e

n
i=1
x
i
e


n
e
(

n
i=1
x
i
+)
,
which we recognize as Gamma(n + 1, +

n
i=1
x
i
).
Example: normal model, normal prior
Let X
1
, . . . , X
n
be a random sample from N(,
2
), where
2
is known,
and assume that the prior is normal, () N(,
2
), where ,
2
is known.
Then
f(x
1
, . . . , x
n
|) = (2
2
)

n
2
exp
_

1
2
n

i=1
(x
i
)
2

2
_
,
so we calculate for the posterior that
(|x) exp
_

1
2
_
n

i=1
(x
i
)
2

2
+
( )
2

2
__
=: e

1
2
M
.
We can calculate (Exercise)
M = a
_

b
a
_
2

b
2
a
+c,
a =
n

2
+
1

2
,
b =
1

x
i
+

2
,
c =
1

x
2
i
+

2

2
.
65
So it follows that the posterior is normal,
(|x) N
_
b
a
,
1
a
_
Exercise: the predictive distribution for x is N(,
2
+
2
).
Note: The posterior mean for is

1
=
1

x
i
+

2
n

2
+
1

2
.
If
2
is very large compared to
2
, then the posterior mean is approximately x.
If
2
/n is very large compared to
2
, then the posterior mean is approximately
.
The posterior variance for is
=
1
n

2
+
1

2
< min
_

2
n
,
2
_
,
which is smaller than the original variances.
Credible intervals
A (1 ) (posterior) credible interval is an interval of values within
which 1 of the posterior probability lies. In the above example:
P
_
z
/2
<

1

< z
/2
_
= 1
is a (1 ) (posterior) credible interval for .
The equality is correct conditionally on x, but the rhs does not depend
on x, so the equality is also unconditionally correct.
If
2
then

2
n
0, and
1
x 0, and
P
_
x z
/2

n
< < x +z
/2

n
_
= 1 ,
which gives the usual 100(1)% condence interval in frequentist statistics.
Note: The interpretation of credible intervals is dierent to condence
intervals: In frequentist statistics, xz
/2

n
applies before x is observed; the
randomness relates to the distribution of x, whereas in Bayesian statistics,
the credible interval is conditional on the observed x; the randomness relates
to the distribution of .
66
Chapter 7
Bayesian Models
Suciency
A sucient statistic captures all the useful information in the data.
Denition: A statistic t = t(x
1
, . . . , x
n
) is parametric sucient for if
(|x) = (|t(x)).
Note: then we also have
p(x
new
|x) = p(x
new
|t(x)).
Factorization Theorem: t(x) is parametric sucient if and only if
(|x) =
h(t(x), )()
_
h(t(x), )()d
for some function h.
Recall: For classical suency, the factorization theorem gave as necessary
and sucient condition that
f(x, ) = h(t(x), )g(x).
Theorem: Classical suciency is equivalent to parametric suciency.
67
To see this: assume classical suciency, then
(|x) =
f(x|)()
_
f(x|)()d
=
h(t(x), )g(x)()
_
h(t(x), )g(x)()d
=
h(t(x), )()
_
h(t(x), )()d
depends on x only through t(x), so (|x) = (|t(x)).
Conversely, assume parametric suciency, then
f(x|)()
f(x)
= (|x) = (|t(x)) =
f(t(x)|)()
f(t(x))
and so
f(x|) =
f(t(x)|)
f(t(x))
f(x)
which implies classical suciency.
Example: A k-parameter exponential family is given by
f(x|) = exp
_
k

i=1
c
i

i
()h
i
(x) +c() +d(x)
_
, x X
where
e
c()
=
_
exp
_
k

i=1
c
i

i
()h
i
(x) +d(x)
_
dx < .
The family is called regular if X does not depend on ; otherwise it is called
non-regular.
Fact: In k-parameter exponential family models,
t(x) = (n,
n

j=1
h
1
(x
j
), . . . ,
n

j=1
h
k
(x
j
))
is sucient.
68
Exchangeability
X
1
, . . . , X
n
are (nitely) exchangeable if
P(X
1
E
1
, . . . , X
n
E
n
) = P(X
(i)
E
1
, . . . , X
(n)
E
n
)
for any permutation of {1, 2, . . . , n}, and any (measureable) sets E
1
, . . . , E
n
.
An innite sequence X
1
, X
2
, . . . is exchangeable if every nite sequence is
(nitely) exchangeable
Intuitively: a random sequence is exchangeable if the random quantities
do not arise, for example, in a time ordered way.
Every independent sequence is exchangeable, but NOT every exchange-
able sequence is independent.
Example: A simple random sample from a nite population (sampling
without replacement) is exchangeable, but not independent.
Theorem (de Finetti). If X
1
, X
2
, . . . is exchangeable, with probability
measure P, then there exists a prior measure Q on the set of all distributions
(on the real line) such that, for any n, the joint distribution function of
X
1
, . . . X
n
has the form
_
n

i=1
F(x
i
)dQ(F),
where F
1
, . . . , F
n
are distributions, and
Q(E) = lim
n
P(F
n
E),
where F
n
(x) =
1
n

n
i=1
1(X
i
x) is the empirical c.d.f..
Thus each exchangeable sequence arises from a 2-stage randomization:
(a) pick F according to Q;
(b) conditional on F, the observations are i.i.d. .
De Finettis Theorem tells us that subjective beliefs which are consistent
with (innite) exchangeability must be of the form
(a) There are beliefs (a priori) on the parameter F; representing your
expectations for the behaviour of X
1
, X
2
, . . .;
69
(b) conditional on F the observations are i.i.d. .
In Bayesian statistics, we can think of the prior distribution on the pa-
rameter as such an F. If a sample is i.i.d. given , then the sample is
exchangeable.
Example. Suppose X
1
, X
2
, . . . are exchangeable 0-1 variables. Then
the distribution of X
i
is uniquely dened by p = P(X
i
= 1); the set of all
probability distributions on {0, 1} is equivalent to the interval [0, 1]. The
measure Q puts a probability on [0, 1]; de Finetti gives
p(x
1
, . . . , x
n
) =
_
p

n
i=1
x
i
(1 p)
n

n
i=1
x
i
dQ(p).
Not all nitely exchangeable sequences can be imbedded in an innite
exchangeable sequence.
Exercise: X
1
, X
2
such that
P(X
i
= 1, X
2
= 0) = P(X
1
= 0, X
2
= 1) =
1
2
cannot be embedded in an exchangeable sequence X
1
, X
2
, X
3
.
For further reading on de Finettis Theorem, see Steen Lauritzens grad-
uate lecture at www.stats.ox.ac.uk/
~
steffen/teaching/grad/definetti.
pdf.
70
Chapter 8
Prior Distributions
Let be a parameter space. How do we assign prior probabilities on ?
Recall: we need a coherent belief system.
In a discrete parameter space we assign subjective probabilities to each
element of the parameter space, which is in principle straightforward.
In a continuous parameter space:
1. Histogram approach:
Say, is an interval of R. We can discretize , assess the total mass
assigned to each subinterval, and smoothen the histogram.
2. Relative likelihood approach:
Again, say, is an interval of R. We assess the relative likelihood that
will take specic values. This relative likelihood is proportional to the prior
density. If is unbounded, normalization can be an issue.
3. Particular functional forms: conjugate priors. A family F of
prior distributions for is closed under sampling from a model f(x|) if for
every prior distribution () F, the posterior (|x) is also in F.
When this happens, the common parametric form of the prior and pos-
terior are called a conjugate prior family for the problem. Then we also say
that the family F of prior distributions is conjugate to this class of models
{f(x|), }.
Often we abuse notation and call an element in the family of conjugate
priors a conjugate prior itself.
71
Example: We have seen already: if X N(,
2
) with
2
known; and
if N(,
2
), then the posterior for is also normal. Thus the family of
normal distributions forms a conjugate prior family for this normal model.
Example: Regular k-parameter exponential family. If
f(x|) = exp{
k

i=1
c
i

i
()h
i
(x) +c() +d(x)}, x X
then the family of priors of the form
(|) = (K())
1
exp{
k

i=1
c
i

i
() +
0
c()},
where = (
0
, . . . ,
k
) is such that
K() =
_

0
c()
exp{
k

i=1
c
i

i
()}d < ,
is a conjugate prior family. The parameters are called hyperparameters.
Example: Bernoulli distribution: Beta prior
f(x|) =
x
(1 )
1x
= (1 )exp
_
x log
_

1
__
so k = 1 and
d(x) = 0, c() = log(1 ), h
1
(x) = x,

1
() = log
_

1
_
,
(|) (1 )

0
exp
_

1
log
_

1
__
=
1
K(
0
,
1
)

1
(1 )

1
.
This density will have a nite integral if and only if
1
> 1 and
0

1
>
1, in which case it is the Beta(
1
+ 1,
0

1
+ 1)-distribution. Thus the
family of Beta distributions forms a conjugate prior family for the Bernoulli
distribution.
72
Example: Poisson distribution: Gamma prior. Here again k = 1,
d(x) = log((x!)), c() =
h
1
(x) = x,
1
() = log ,
and an element of the family of conjugate priors is given by
(|) =
1
K(
0
,
1
)

1
e

0
.
The density will have a nite integral if and only if
1
> 1 and
0
> 0, in
which case it is the Gamma(
1
+ 1,
0
) distribution.
Example: Normal, unknown variance: normal-gamma prior. For
the normal distribution with mean , we let the precision be =
2
, then
= (, )
d(x) =
1
2
log(2), c(, ) =

2
2
+ log(

)
(h
1
(x), h
2
(x)) = (x, x
2
), (
1
(, ),
2
(, )) = (,
1
2
)
and an element of the family of conjugate priors is given by
(, |
0
,
1
,
2
)

0
2
exp
_

1
2

0
+
1

1
2

2
_

0
+1
2
1
exp
_

1
2
_


2
1

0
_

1
2
exp
_

0
2
_


1

0
_
2
_
.
The density can be interpreted as follows: Use a Gamma((
0
+ 1)/2, (
2

2
1
/
0
)/2) prior for . Conditional on , we have a normal N(
1
/
0
, 1/(
0
))
for . This is called a normal-gamma distribution for (, ); it will have a
nite integral if and only if
2
>
2
1
/
0
and
0
> 0.
Fact: In regular k-parameter exponential family models, the fam-
ily of conjugate priors is closed under sampling. Moreover, if (|
0
, . . . ,
k
)
is in the above conjugate prior family, then
(|x
1
, . . . , x
n
,
0
, . . . ,
k
) = (|
0
+n,
1
+H
1
(x), . . . ,
k
+H
k
(x)),
73
where
H
i
(x) =
n

j=1
h
i
(x
j
).
Recall that (n, H
1
(x), . . . , H
k
(x)) is a sucient statistic. Note that indeed
the posterior is of the same parametric form as the prior.
The predictive density for future observations y = y
1
, . . . , y
m
is
p(y|x
1
, . . . , x
n
,
0
, . . . ,
k
)
= p(y|
0
+n,
1
+H
1
(x), . . . ,
k
+H
k
(x))
=
K(
0
+n +m,
1
+H
1
(x, y), . . . ,
k
+H
k
(x, y))
K(
0
+n,
1
+H
1
(x), . . . ,
k
+H
k
(x))
e

m
1
d(y

)
,
where
H
i
(x, y) =
n

j=1
h
i
(x
j
) +
m

=1
h
i
(y

).
This form is particularly helpful for inference: The eect of the data
x
1
, . . . , x
n
is that the labelling parameters of the posterior are changed from
those of the prior, (
0
, . . . ,
k
) by simply adding the sucient statistics
(t
0
, . . . , t
k
) = (n,
n

i=1
h
1
(x
j
), . . . ,
n

i=1
h
k
(x
j
))
to give the parameters (
0
+t
0
, . . . ,
k
+t
k
) for the posterior.
Mixtures of priors from this conjugate prior family also lead to a simple
analysis (Exercise).
Noninformative priors
Often we would like a prior that favours no particular values of the pa-
rameter over others. If nite with || = n, then we just put mass
1
n
at
each parameter value. If is innite, there are several ways in which one
may seek a noninformative prior.
Improper priors are priors which do not integrate to 1. They are inter-
preted in the sense that posterior prior likelihood. Often they arise as
74
natural limits of proper priors. They have to be handled carefully in order
not to create paradoxes!
Example: Binomial, Haldanes prior. Let X Bin(n, p), with n
xed, and let be a prior on p. Haldanes prior is
(p)
1
p(1 p)
;
we have that
_
1
0
(p) dp = . This prior gives as marginal density
p(x)
_
1
0
(p(1 p))
1
_
n
x
_
p
x
(1 p)
nx
dp,
which is not dened for x = 0 or x = n. For all other values of x we obtain
the Beta(x, n x)-distribution. The posterior mean is
x
x +n x
=
x
n
.
For x = 0, n: we could think of

,
Beta(, ),
where , > 0 are small. Then the posterior is Beta( + x, + n x).
Now let , 0: then
,
converges to . Note that the posterior mean
converges to x/n for all values of x.
Noninformative priors for location parameters
Let , X be subsets of Euclidean space. Suppose that f(x|) is of the
form f(x): this is called a location density, is called location parameter.
For a noninformative prior for : suppose that we observe y = x + c,
where c xed. If = + c then y has density f(y|) = f(y ), and so a
noninformative priors should be the same (as we assume that we have the
same parameter space).
Call the prior for the (x, )-problem, and

the prior for the (y, )-


problem. Then we want that for any (measureable) set A
_
A
()d =
_
A

()d =
_
Ac
()d =
_
A
( c)d,
75
yielding
() = ( c)
for all . Hence () = (0) constant; usually we choose () = 1 for all .
This is an improper prior.
Noninformative priors for scale parameters
A (one-dimensional) scale density is a density of the form
f(x|) =
1

f
_
x

_
for > 0; is called scale parameter. Consider y = cx, for c > 0; put
= c, then y has density f(y|) =
1

f
_
x

_
. Noninformative priors for and
should be the same (assuming the same parameter space), so we want that
for any (measureable) set A
_
A
()d =
_
c
1
A
()d =
_
A
(c
1
)c
1
d,
yielding
() = c
1
(c
1
)
for all > 0; (c) = c
1
(1); hence ()
1

. Usually we choose () =
1

.
This is an improper prior.
Jereys Priors
Example: Binomial model. Let X Bin(n, p).A plausible noninfor-
mative prior would be p U[0, 1], but then

p has higher density near 1
than near 0. Thus ignorance about p seems to lead to knowledge about

p, which is paradoxical. We would like the prior to be invariant under


reparametrization.
Recall: under regularity conditions, the Fisher information equals
I() E

2
logf(x|)

_
.
Under the same regularity assumptions, we dene the Jereys prior as
() I()
1
2
.
76
Here I() = I
1
(). This prior may or may not be improper.
Reparametrization: Let h be monotone and dierentiable. The chain rule
gives
I() = I(h())
_
h

_
2
.
For the Jereys prior (), we have
(h()) = ()

1
I()
1
2

1
= I(h())
1
2
;
thus the prior is indeed invariant under reparametrization.
The Jereys prior favours values of for which I() is large. Hence
minimizes the eect of the prior distribution relative to the information in
the data.
Exercise: The above non-informative priors for scale and location corre-
spond to Jereys priors.
Example: Binomial model, Jereys prior. Let X Bin(n, p);
where n is known, so that f(x|p) =
_
n
x
_
p
x
(1 p)
nx
. Then

2
logf(x|p)

2
p
=
x
p
2

n x
(1 p)
2
.
Take expectation and multiply by minus 1: I(p) =
n
p
+
n
(1p)
=
n
p(1p)
Thus
the Jereys prior is
(p) (p(1 p))

1
2
,
which we recognize as the Beta(1/2, 1/2)-distribution. This is a proper prior.
If is multivariate, the Jereys prior is
() [detI()]
1
2
,
which is still invariant under reparametrization.
Example: Normal model, Jereys prior. Let X N(,
2
), where
= (, ). We abbreviate
(x, , ) = log
(x )
2
2
2
;
77
then
I() = E

_

2

2
(x, , )

2

(x, , )

(x, , )

2

2
(x, , )
_
= E

_

1

2

2(x)

2(x)

3
1

2

3(x)
2

4
_
=
_
1

2
0
0
2

2
_
.
So
()
_
1

2

2

2
_1
2

2
is the Jereys prior.
Note: N(,
2
) is a location-scale density, so we could take a uniform
prior for , 1/-prior for ; this would yield
() =
1

.
Thie prior is *not* equal to the Jereys prior.
Maximum Entropy Priors
Assume rst that is discrete. The entropy of is dened as
E() =

(
i
)log((
i
))
(where 0log(0) = 0). It measures the amount of uncertainty in an observa-
tion.
If is nite, with n elements, then E() is largest for the uniform distri-
bution, and smallest if (
i
) = 1 for some
i
.
Suppose we are looking for a prior , taking partial information in terms
of functions g
1
, . . . , g
m
into account, where this partial information can be
written as
E

g
k
() =
k
, k = 1, . . . , m.
We would like to choose the distribution with the maximum entropy under
these constraints: This distribution is
(
i
) =
exp (

m
k=1

k
g
k
(
i
))

i
exp (

m
k=1

k
g
k
(
i
))
,
78
where the
i
are determined by the constraints.
Example: prior information on the mean. Let = {0, 1, 2, . . .}.
The prior mean of is thought to be 5. We write this as a constraint:
m = 1, g
1
() = ,
1
= 5. So
() =
e

j=0
e

1
j
=
_
e

1
_

_
1 e

1
_
is the maximum-entropy prior. We recognize it as the distribution of (ge-
ometric - 1). Its mean is e

1
1, so setting the mean equal to 5 yields
e

1
=
1
6
, and
1
= log 6.
If is continuous, then () is a density. The entropy of relative to a
particular reference distribution with density
0
is dened as
E() = E

_
log
()

0
()
_
=
_

()log
()

0
()
d.
The case that is discrete corresponds to
0
being discrete uniform.
How do we choose
0
? We would like to choose the natural invariant
noninformative prior. Assume that we have partial information in terms of
functions g
1
, . . . , g
m
:
_
g
k
()()d =
k
, k = 1, . . . , m.
We choose the distribution with the maximum entropy under these con-
straints (when it exists):
() =

0
()exp (

m
k=1

k
g
k
())
_

0
()exp (

m
k=1

k
g
k
()) d
,
where the
i
are determined by the constraints.
Example: location parameter, known mean, known variance.
Let = R, and let be location parameter; we choose as reference prior

0
() = 1. Suppose that mean and variance are known:
g
1
() = ,
1
= ; g
2
() = ( )
2
,
2
=
2
.
79
Then we choose
() =
exp (
1
+
2
( )
2
)
_

exp (
1
+
2
( )
2
) d
exp(
1
+
2

2
) exp(
2
( )
2
),
for a suitable (here the s may not be the same). So is normal; the
constraints give is N(,
2
).
Example: location parameter, known mean. Suppose that in the
previous example only the prior mean, not the prior variance, is specied; so
() =
exp (
1
)
_

exp (
1
) d
,
and the integral is innite, so the distribution does not exist.
Additional Material: Bayesian Robustness
To check how much the conclusions change for dierent priors, we can
carry out a sensitivity analysis.
Example: Normal or Cauchy?
Suppose = R, and X N(, 1), where is known to be either standard
normal or standard Cauchy. We calculate the posterior means under both
models:
obs. x post. mean (N) post. mean (C)
0 0 0
1 0.69 0.55
2 1.37 1.28
4.5 3.09 4.01
10 6.87 9.80
For small x the posterior mean does not change very much, but for large
x it does.
Example: Normal model; normal or contaminated class of pri-
ors. Assume that X N(,
2
), where
2
known, and
0
N(,
2
). An
alternative class of priors is , constructed as follows: Let
Q = {q
k
; q
k
U|( k, +k)},
80
then put
= { : = (1 )
0
+q, some q Q}.
The is called an -contamination class of priors. Let C = (c
1
, c
2
) be an
interval. Put P
0
= P( C|x,
0
) and Q
k
= P( C|x, q
k
). Then (by
Bayes rule) for we have
P( C|x) =
k
(x)P
0
+ (1
k
(x))Q
k
,
where

k
(x) =
_
1 +

1

p(x|q
k
)
p(x|
0
)
_
1
,
and p(x|q) is the predictive density of x when the prior is q.
The predictive density p(x|
0
) is N(,
2
+
2
),
p(x|q
k
) =
_
+k
k
1

_
x

_
1
2k
d
and
Q
k
=
1
p(x|q
k
)
_
c

_
x

_
1
2k
d
where c

= max{c, k} and c

= min{c
2
, +k} ( is the standard normal
density).
Numerical example: Let = 0.1,
2
= 1,
2
= 2, = 0, x = 1, and
C = (0.93, 2.27) is the 95% credible region for
0
. Then we calculate
inf

P( C|x, ) = 0.945,
achieved at k = 3.4, and
sup

P( C|x, ) = 0.956,
achieved at k = 0.93. So in this sense the inference is very robust.
81
Chapter 9
Posterior Distributions
Point estimates
Some natural summaries of distributions are the mean, the median, and
the mode. The mode is most likely value of , so it is the maximum Bayesian
likelihood estimator.
For summarizing spread, we use the inter-quartile range (IQR), the vari-
ance, etc.
Interval estimates
If is the density for a parameter , then a region C such that
_
C
()d = 1
is called a 100(1 )% credible region for with respect to .
If C is an interval: it is called a credible interval. Here we take credible
regions with respect to the posterior distribution; we abbreviate the posterior
by , abusing notation.
A 100(1 )% credible region is not unique. Often it is natural to give
the smallest 100(1 )% credible region, especially when the region is an
interval. We say that C is a 100(1 )% highest probability density
region (HPD) with respect to if
(i)
_
C
()d = 1 ; and
(ii) (
1
) (
2
) for all
1
C,
2
C except possibly for a subset of
having -probability 0.
82
A 100(1 )% HPD has minimum volume over all 100(1 )% credible
regions.
The full posterior distribution itself is often more informative than cred-
ible regions, unless the problem is very complex.
Asymptotics
When n is large, then under suitable regularity conditions, the posterior
is approximately normal, with mean the m.l.e.

, and variance (nI
1
(

))
1
.
This asymptotics requires that the prior is non-zero in a region surround-
ing the m.l.e..
Since, under regularity, the m.l.e. is consistent; if the data are i.i.d. from
f(x|
0
) and if the prior is non-zero around
0
, then the posterior will become
more and more concentrated around
0
. In this sense Bayesian estimation is
automatically consistent.
83
Part III
A Decision-Theoretic Approach
and Bayesian testing
84
Chapter 10
Bayesian Inference as a
Decision Problem
10.1 The decision-theoretic set-up
In Decision Theory we choose between various possible actions after observ-
ing data. We denote by the set of all possible states of nature (values of
parameter); D is the set of all possible decisions (actions). With a decision
and a state of nature comes an associated loss. A loss function is any function
L : D [0, )
L(, d) gives the cost (penalty) associated with decision d if the true state
of the world is . We use the notation f(x, ) for the sampling distribution,
for a sample x X; () denotes a prior distribution, and L(, d) a loss
function. Often the decision d is to evaluate or estimate a function h() as
accurately as possible.
For Point estimation: h() = and D = ; nally L(, d) loss in report-
ing d when is true.
For Hypothesis testing: for testing H
0
:
0
, the decision set it
D = {accept H
0
, reject H
0
},
and
h() =
_
1 if
0
0 otherwise .
85
The general loss function is
L(, accept H
0
) =
_

00
if
0

01
otherwise
L(, reject H
0
) =
_

10
if
0

11
otherwise .
Note:
01
is the Type II-error, (accept H
0
although false),
10
is the Type
I-error (reject H
0
although true).
A Decision rule: : X D maps observations to decisions. We aim to
choose such that the incurred loss is small. In general there is no that
uniformly mimimizes L(, (x)).
Bayesian setting
For a prior and data x X, the posterior expected loss of a decision is
(, d|x) =
_

L(, d)(|x)d,
which is a function of x. For a prior , the integrated risk of a decision rule
is
r(, ) =
_

_
X
L(, (x)f(x|)dx()d,
which is a real number. We prefer
1
to
2
if and only if r(,
1
) < r(,
2
).
Proposition. An estimator minimizing r(, ) can be obtained by se-
lecting, for every x X, the value (x) that minimizes (, |x).
Proof (additional material)
r(, ) =
_

_
X
L(, (x))f(x|)dx()d
=
_
X
_

L(, (x))(|x)p(x)ddx
=
_
X
(, |x)p(x)dx
(Recall that p(x) =
_

f(x|)()d.)
86
A Bayes estimator associated with prior , loss L, is any estimator

which minimizes r(, ): For every x X it is

= arg min
d
(, d|x);
then r() = r(,

) is called Bayes risk. This is valid for proper priors, and


for improper priors if r() < . If r() = one can dene a generalised
Bayes estimator as the minimizer, for every x, of (, d|x).
Fact: For strictly convex loss functions, Bayes estimators are unique.
Some common loss functions
Loss functions are part of the problem specication. The Squared error
loss: L(, d) = ( d)
2
is convex, and penalises large deviations heavily.
Proposition The Bayes estimator

associated with prior under squared


error loss is the posterior mean,

(x) = E

(|x) =
_

f(x|)()d
_

f(x|)()d
.
Reason: for any random variable Y , E((Y a)
2
) is minimized by a = EY .
The Absolute error loss is L(, d) = | d|.
Proposition: The posterior median is a Bayes estimator under absolute
error loss.
10.2 Bayesian testing
Suppose that we want to H
0
:
0
, so that
D = {accept H
0
, reject H
0
} = {1, 0},
where 1 stands for acceptance. We choose as loss function
L(, ) =
_

_
0 if
0
, = 1
a
0
if
0
, = 0
0 if
0
, = 0
a
1
if
0
, = 1.
87
Proposition Under this loss function, the Bayes decision rule associated
with a prior distribution is

(x) =
_
1 if P

(
0
|x) >
a
1
a
0
+a
1
0 otherwise .
Note the special case: If a
0
= a
1
, then we accept H
0
if P

(
0
|x) >
1
2
.
Proof (additional material) The posterior expected loss is
(, |x) = a
0
P

(
0
|x)1((x) = 0)
+a
1
P

(
0
|x)1((x) = 1)
= a
0
P

(
0
|x) +1((x) = 1)
(a
1
(a
0
+a
1
)P

(
0
|x)) ,
and a
1
(a
0
+a
1
)P

(
0
|x) < 0 if and only if P

(
0
|x) >
a
1
a
0
+a
1
.
Example: X Bin(n, ),
0
= [0, 1/2), () = 1
P

_
<
1
2
|x
_
=
_ 1
2
0

x
(1 )
nx
d
_
1
0

x
(1 )
nx
d
=
_
1
2
_
n+1
B(x + 1, n x + 1)
_
1
x + 1
+. . . +
(n x)!x!
(n + 1)!
_
This expression can be evaluated for particular n and x, and compared with
the acceptance level
a
1
a
0
+a
1
.
Example: X N(,
2
), with
2
known, and N(,
2
). Then we
have already calculated that (|x) N((x), w
2
) with
(x) =

2
+
2
x

2
+
2
and w
2
=

2

2
+
2
.
For testing H
0
: < 0 we calculate
P

( < 0|x) = P

_
(x)
w
<
(x)
w
_
=
_

(x)
w
_
.
88
Let z
a
0
,a
1
be the
a
1
a
0
+a
1
quantile: then we accept H
0
if (x) > z
a
0
,a
1
w, or,
equivalently, if
x <

2

_
1 +

2

2
_
z
a
0
,a
1
w.
For
2
= 1, = 0,
2
: we accept H
0
if x < z
a
0
,a
1
Compare to the frequentist test: Accept H
0
if x < z
1
= z

. This
corresponds to
a
0
a
1
=
1

1.
So
a
0
a
1
= 19 for = 0.05; and
a
0
a
1
= 99 for = 0.01.
Note:
1) If the prior probability of H
0
is 0, then so will be posterior probability.
2) Testing H
0
: =
0
against H
1
: >
0
often really means testing
H
0
:
0
against H
1
: >
0
, which is natural to test in a Bayesian
setting.
Denition: The Bayes factor for testing H
0
:
0
against H
1
:
1
is
B

(x) =
P

(
0
|x)/P

(
1
|x)
P

(
0
)/P

(
1
)
.
The Bayes factor measures the extent to which the data x will change
the odds of
0
relative to
1
. If B

(x) > 1 the data adds support to H


0
.
If B

(x) < 1 the data adds support to H


1
. If B

(x) = 1 the data does not


help to distinguish between H
0
and H
1
.
Note: the Bayes factor still depends on the prior .
Special case: H
0
: =
0
, H
1
: =
1
, then
B

(x) =
f(x|
0
)
f(x|
1
)
which is the likelihood ratio.
89
More generally,
B

(x) =
_

0
()f(x|)d
_

1
()f(x|)d
__

0
()d
_

1
()d
=
_

0
()f(x|)/P

(
0
)d
_

1
()f(x|))/P

(
1
)d
=
p(x|
0
)
p(x|
1
)
is the ratio of how likely the data is under H
0
and how likely the data is
under H
1
.
Compare: the frequentist likelihood ratio is
(x) =
sup

0
f(x|)
sup

1
f(x|)
.
Note: with

from the Proposition, and


0
= P

(
0
),
1
= P

1
), we obtain
B

(x) =
P

(
0
|x)/(1 P

(
0
|x))

0
/
1
and so

(x) = 1 B

(x) >
a
1
a
0
_

1
.
Also, by inverting the equality it follows that
P

(
0
|x) =
_
1 +

1

0
(B

(x))
1
_
1
.
Example: X Bin(n, p), H
0
: p = 1/2, H
1
: p = 1/2 Choose as prior
an atom of size
0
at 1/2, otherwise uniform on [0, 1]. Then
B

(x) =
p(x|p = 1/2)
p(x|p
1
)
=
_
n
x
_
2
n
_
n
x
_
B(x + 1, n x + 1)
.
90
So
P
_
p =
1
2
|x
_
=
_
1 +
(1
0
)

0
x!(n x)!
(n 1)!
2
n
_
1
.
If
0
= 1/2, n = 5, x = 3, then B

(x) =
15
8
> 1, and
P
_
p =
1
2
|x
_
=
_
1 +
2
120
2
5
_
1
=
15
23
.
The data adds support to H
0
, the posterior probability of H
0
is 15/23 > 1/2.
Alternatively had we chosen as prior an atom of size
0
at 1/2, otherwise
Beta(1/2, 1/2), then this prior favours 0 and 1; for n=10 we would obtain
x P(p =
1
2
|x)
0 0.005
1 0.095
2 0.374
3 0.642
4 0.769
5 0.803
Example: X N(,
2
),
2
known, H
0
: = 0 Choose as prior: mass

0
at = 0, otherwise N(0,
2
). Then
(B

)
1
=
p(x| = 0)
p(x| = 0)
=
(
2
+
2
)
1/2
exp{x
2
/(2(
2
+
2
))}

1
exp{x
2
/(2
2
)}
and
P( = 0|x) =
_
1 +
1
0

0
_

2

2
+
2
exp
_

2
x
2
2
2
(
2
+
2
)
_
_
1
.
Example:
0
= 1/2, = , put z = x/
x P( = 0|z)
0 0.586
0.68 0.557
1.28 0.484
1.96 0.351
91
For = 10 (a more diusive prior)
x P( = 0|z)
0 0.768
0.68 0.729
1.28 0.612
1.96 0.366
so x gives stronger support for H
0
than under tighter prior.
Note: For x xed,
2
,
0
> 0, we have
P( = 0|x) 1.
For a noninformative prior () 1 we have that
p(x|() =
_
(2
2
)
1/2
e

(x)
2
2
2
d = (2
2
)
1/2
_
e

(x)
2
2
2
d = 1
and so
P( = 0|x) =
_
1 +
1
0

2 exp(x
2
/2)
_
1
which is not equal to 1.
Lindleys paradox: Suppose that X N(,
2
/n), H
0
: = 0, n is xed.
If
x
(/

n)
is large enough to reject H
0
in classical test, then for large enough

2
the Bayes factor will be larger than 1, indicating support for H
0
.
If
2
,
2
are xed, n such that
x
(/

n)
= k

xed, is just signicant


at level in classical test, then B

(x) .
Results which are just signicant at some xed level in the classical test
will, for large n, actually be much more likely under H
0
than under H
1
.
A very diusive prior proclaims great scepticism, which may overwhelm
the contrary evidence of the observations.
10.3 Least favourable Bayesian answers
Suppose that we want to test H
0
: =
0
, H
1
: =
0
, and the prior
probability on H
0
is
0
= 1/2. What is the prior g in H
1
, which is, after
92
observing x, least favourable to H
0
? Let G be a family of priors on H
1
; put
B(x, G) = inf
gG
f(x|
0
)
_

f(x|)g()d
and
P(x, G) =
f(x|
0
)
f(x|
0
) + sup
gG
_

f(x|)g()d
=
_
1 +
1
B(x, G)
_
1
A Bayesian prior g G on H
0
will then have posterior probability at least
P(x, G) on H
0
(for
0
= 1/2). If

is the m.l.e. of , G
A
the set of all prior
distributions, then
B(x, G
A
) =
f(x|
0
)
f(x|

(x))
and
P(x, G
A
) =
_
1 +
f(x|

(x))
f(x|
0
_
1
.
Other natural families are G
S
, the set of distributions symmetric around
0
,
and G
SU
, the set of unimodal distributions symmetric around
0
.
Example: Normal, unit variance. Let X N(, 1), H
0
: =
0
,
H
1
: =
0
. Then
p-value P(x, G
A
) P(x, G
SU
)
0.1 0.205 0.392
0.01 0.035 0.109
The Bayesian approach will typically reject H
0
less frequently.
10.4 Comparison with frequentist hypothesis
testing
In frequentist hypothesis setting, there is an asymmetry between H
0
, H
1
:
we x type I error, then minimize the type II error. UMP tests do not
93
always exist. Furthermore the concept of p-values can be confusing: they
have no intrinsic optimality, the space of p-values lacks a decision-theoretic
foundation, They are routinely misinterpreted, and they do not take the type
II error into account. Condence regions are a pre-data measure, and can
often have very dierent post data coverage probabilities.
Example. Consider testing H
0
: =
0
against H
1
: =
1
. Consider
repetitions in which one uses the most powerful test with level = 0.01. In
frequentist tests: only 1% of the true H
0
will be rejected. But this does not
say anything about the proportion of errors made when rejecting!
Example. Suppose in a test probability of type II error is 0.99, and
0
and
1
occur equally often, then about half of the rejections of H
0
will be in
error.
Example: X N(, 1/2), H
0
: = 1, H
1
: = 1. We observe x = 0:
the UMP test has p-value 0.072, but the p-value for the test of H
1
against
H
0
takes exactly the same value.
Example: X
1
, . . . , X
n
i.i.d. N(,
2
), both ,
2
are unknown. The
interval
C =
_
x t
/2
s

n
, x +t
/2
s

n
_
for n = 2, = 0.5: has pre-data coverage probability 0.5. However, Brown
(Ann.Math.Stat. 38, 1967, 1068-1071) showed that
P( C||x|/s < 1 +

2) > 2/3.
The Bayesian approach compares the probability of the actual data
under the two hypotheses.
94
Chapter 11
Hierarchical and empirical
Bayesian methods
A hierarchical Bayesian model consists of modelling a parameter through
randomness at dierent levels; for example,
|
1
(|), where
2
();
so that then () =
_

1
(|)
2
()d.
When dealing with complicated posterior distributions, rather than eval-
uating the integrals, we might use simulation to approximate the integrals.
For simulation in hierarchical models, we simulate rst from , then, given
, we simulate from . We hope that the distribution of is easy to simulate,
and also that the conditional distribution of given is easy to simulate.
This approach is particularly useful for MCMC (Markov chain Monte Carlo)
methods, e.g.: see next term.
Let x f(x|). The empirical Bayes method chooses a convenient prior
family (|) (typically conjugate), where is a hyperparameter, so that
p(x|) =
_
f(x|)(|)d.
Rather than specifying , we estimate by

, for example by frequentist
methods, based on p(x|), and we substitute

for ;
(|x,

)
95
is called a pseudo-posterior. We plug it into Bayes Theorem for inference.
The empirical Bayes approach is neither fully Bayesian nor fully frequentist.
It depends on

; dierent

will lead to dierent procedures. If

is consistent,
then asymptotically it will lead to a coherent Bayesian analysis. It often
outperforms classical estimators in empirical terms.
Example: James-Stein estimators Let X
i
N(
i
, 1) be independent
given
i
, i = 1, . . . , p,where p 3. In vector notation: X N(, I
p
). Here
the vector is random; assume that we have realizations
i
, i = 1, . . . , p.
The obvious estimate for
i
is

i
= x
i
, leading to

= X.
Assume that
i
N(0,
2
), then p(x|
2
) = N(0, (1+
2
)I
p
), and the posterior
for given the data is
|x N
_

2
1 +
2
x,
1
1 +
2
I
p
_
.
Under quadratic loss, the Bayes estimator (x) of is the posterior mean

2
1 +
2
x.
In the empirical Bayes approach, we would use the m.l.e. for
2
, which is

2
=
_
x
2
p
1
_
1( x
2
> p),
where x
2
=

i
x
2
i
. The empirical Bayes estimator is the estimated poste-
rior mean,

EB
(x) =

2
1 +
2
x =
_
1
p
x
2
_
+
x
is the truncated James-Stein estimator. It can can be shown to outperform
the estimator (x) = x.
Alternatively, the best unbiased estimator of 1/(1 +
2
) is
p2
x
2
, giving

EB
(x) =
_
1
p
x
2
_
x.
96
This is the James-Stein estimator. It can be shown that under quadratic loss
function the James-Stein estimator outperforms (x) = x.
Note: both estimators tend to shrink towards 0. It is now known to be
a very general phenomenon that when comparing three or more populations,
the sample mean is not the best estimator. Shrinkage estimators are an active
area of research.
Bayesian computation of posterior probabilities can be very computer-
intensive; see the MCMC and Applied Bayesian Statistics course.
97
Part IV
Principles of Inference
98
The Likelihood Principle
The Likelihood Principle states that the information brought by an ob-
servation x about is entirely contained in the likelihood function L(|x).
From this follows that, if if x
1
and x
2
are two observations with likelihoods
L
1
(|x) and L
2
(|x), and if
L
1
(|x) = c(x
1
, x
2
)L
2
(|x)
then x
1
and x
2
must lead to identical inferences.
Example. We know that (|x) f(x|)(). If f
1
(x|) f
2
(x|) as a
function of , then they have the same posterior, so they lead to the same
Bayesian inference.
Example: Binomial versus negative binomial. (a) Let X Bin(n, )
be the number of successes in n independent trials, with p.m.f.
f
1
(x|) =
_
n
x
_

x
(1 )
nx
then
(|x)
_
n
x
_

x
(1 )
nx
()
x
(1 )
nx
().
(b) Let N NegBin(x, ) be the number of independent trials until x
successes, with p.m.f.
f
2
(n|) =
_
n 1
x 1
_

x
(1 )
nx
and
(|x)
x
(1 )
nx
().
Bayesian inference about does not depend on whether a binomial or a
negative binomial sampling scheme was used.
M.l.e.s satisfy the likelihood principle, but many frequentist procedures
do not!
Example: Bin(n, )-sampling. We observe (x
1
, . . . , x
n
) = (0, . . . , 0, 1).
An unbiased estimate for is

= 1/n. If instead we view n as geometric(),
then the only unbiased estimator for is

= 1(n = 1).
99
Unbiasedness typically violates the likelihood principle: it involves inte-
grals over the sample space, so it depends on the value of f(x|) for values
of x other than the observed value.
Example: (a) We observe a Binomial randome variable, n=12; we ob-
serve 9 heads, 3 tails. Suppose that we want to test H
0
: = 1/2 against
H
1
: > 1/2. We can calculate that the UMP test has P(X 9) = 0.075.
(b) If instead we continue tossing until 3 tails recorded, and observe that
N = 12 tosses are needed, then the underlying distribution is negative bino-
mial, and P(N 12) = 0.0325.
The conditionality perspective
Example (Cox 1958). A scientist wants to measure a physical quantity .
Machine 1 gives measurements X
1
N(, 1), but is often busy. Machine 2
gives measurements X
1
N(, 100). The availability of machine 1 is beyond
the scientists control, independent of object to be measured. Assume that
on any given occasion machine 1 is available with probability 1/2; if available,
the scientist chooses machine 1. A standard 95% condence interval is about
(x 16.4, x + 16.4) because of the possibility that machine 2 was used.
Conditionality Principle: If two experiments on the parameter are avail-
able, and if one of these two experiments is selected with probability 1/2, then
the resulting inference on should only depend on the selected experiment.
The conditionality principle is satised in Bayesian analysis. In the fre-
quentist approach, we could condition on an ancillary statistic, but such
statistic is not always available.
A related principle is the Stopping rule principle (SRP): A it stopping
rule is a random variable that tells when to stop the experiment; this random
variable depends only on the outcome of the rst n experiments (does not
look into the future). The stopping rule principle states that if a sequence of
experiments is directed by a stopping rule, then, given the resulting sample,
the inference about should not depend on the nature of the stopping rule.
The likelihood principle implies the SRP. The SRP is satised in Bayesian
inference, but it is not always satised in frequentist analysis.
100

Das könnte Ihnen auch gefallen