0% found this document useful (0 votes)
14 views

Sta360 Week10

week10

Uploaded by

陈佳浩
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Sta360 Week10

week10

Uploaded by

陈佳浩
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

STA360: Introduction to Bayesian Statistics

Al Nosedal

Fall 2022

Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 1 / 15


Student’s T distribution

Let

Z
T =p ,
W /r
where Z is a random variable that is N(0, 1), W is a random variable that
is 2 (r ), and Z and W are independent. Then T has a t distribution with
r degrees of freedom, for which the pdf is

((r + 1)/2) 1
f (t) = p , 1 < t < 1.
⇡r (r /2) (1 + t 2 /r )(r +1)/2

Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 2 / 15


Definition (t Distribution)

Let Z be a standard Normal random


variable and let W be a
2 -distributed variable with ⌫ df.

Then, if Z and W are independent,

Z
T =p
W /⌫
is said to have a t distribution with ⌫
df.

Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 3 / 15


t distributions
0.4

Z
df=5
0.3
f(y)

0.2
0.1
0.0

−4 −2 0 2 4

y
Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 4 / 15
t distributions
0.4

Z
df=10
0.3
f(y)

0.2
0.1
0.0

−4 −2 0 2 4

y
Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 5 / 15
t distributions
0.4

Z
df=30
0.3
f(y)

0.2
0.1
0.0

−4 −2 0 2 4

y
Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 6 / 15
BAYESIAN INFERENCE FOR NORMAL WITH UNKNOWN MEAN AND
VARIANCE

Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 7 / 15


The joint likelihood

2
f (y1 , y2 , · · · , yn |µ, ) / f (y1 |µ, 2 ) ⇥ · · · ⇥ f (yn |µ, 2
)
✓ ◆1/2
1 1 2
n
/ ⇡i=1 2
e 2 2 (yi µ)
✓ ◆n/2 P
1 1
(yi µ)2
/ 2
e 2 2

1 1
[n(ȳ µ)2 +SSy ]
/ e 2 2
( 2 )n/2

P
where SSy = (yi ȳ )2 .

Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 8 / 15


The joint prior

The joint prior for the two parameters when we are using independent
Je↵reys’ priors is their product which is given by

2 1
g (µ, )= 2

for 1 < µ < 1, 0 < 2 < 1.

Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 9 / 15


The joint posterior

The joint posterior will be proportional to the joint prior times the joint
likelihood given by

2 1 1 1
[n(ȳ µ)2 +SSy ]
g (µ, |y1 , y2 , · · · , yn ) / 2
⇥ e 2 2
( 2 )n/2
1 1 2
/ 2) (n/2)+1
e 2 2 [n(ȳ µ) +SSy ]
(

Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 10 / 15


Marginal posterior for µ

The joint posterior will be proportional to the joint prior times the joint
likelihood given by

Z 1
2 2
g (µ|y1 , y2 , · · · , yn ) / g (µ, |y1 , y2 , · · · , yn )d
0
n
/ [n(µ ȳ )2 + SSy ] 2

Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 11 / 15


Marginal posterior for µ (cont.)

qP
µ ȳ (yi ȳ )2
Let t = S , where Sy = n 1 .
py
n

g (µ|y1 , y2 , · · · , yn ) / g (t|y1 , y2 , · · · , yn )
 (n 1)+1
t2 2
/ 1+
n 1

Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 12 / 15


Example 1

Suppose you are an executive with a firm which has developed a new type
of battery designed for use in electric cars. The battery has been lab
tested and now you want to find out how it performs in tandem with lots
of others in a field test under driving conditions. Suppose that 10 cars are
to be tested. You take the basic random variable X to be the number of
miles a car can be driven between recharges with a set of these batteries.
Assume that a sequence of these Xs, one for each of a potentially very
large number of identical cars of a certain model, behave as if generated
by a Normal process with mean µ and variance 2 .

Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 13 / 15


Example 1 (cont.)

A sample of n = 10 gives an Sx = 20 and x̄ = 135. Suppose that your


prior beliefs about (µ, = 2 ) can be represented by a reference prior
p(µ, ) / 1/ and find
a) Posterior probability of µ < 130.
b) A central 95% posterior credible interval for µ.

Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 14 / 15


Example 2

Cola makers test new recipes for loss of sweetness during storage. Trained
tasters rate the sweetness before and after storage. Here are the sweetness
losses (sweetness before storage minus sweetness after storage) found by
10 tasters for one new cola recipe:
2.0, 0.4, 0.7, 2.0, -0.4, 2.2, -1.3, 1.2, 1.1 , 2.3.
Are these data good evidence that the cola lost sweetness? Carry out a
hypothesis test at the 5% significance level to answer this question. Use
independent Je↵reys’ priors for µ and 2 .

Al Nosedal STA360: Introduction to Bayesian Statistics Fall 2022 15 / 15

You might also like