Sta360 Week10
Sta360 Week10
Al Nosedal
Fall 2022
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
Z
T =p
W /⌫
is said to have a t distribution with ⌫
df.
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
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 .
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
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 ]
(
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
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
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 .
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 .