# this ppt by fionan

VIEWS: 54 PAGES: 19

• pg 1
									  Homework Database

Please show as many steps as
possible so you can get partial points
even if you don’t get the final answer.
Homework 1
• Suppose your prior distribution for the
proportion of Californians who support the
death penalty has mean 0.6 and standard
deviation 0.3. Use a beta distribution for
this prior. A random sample of 1000
californians is taken, 65% support the
death penalty. Plot the prior and posterior
on the same plot. (3pts) (Gelman book
2.9).
Homework 2
• Gelman book Exercise 2.1. θ is the
probability that a coin will yield a “head”.
Suppose the prior distribution on θ is
Beta(4,4). The coin is spun 10 times,
“heads” appeared fewer than 3 times.
Using a graphic software, plot prior and
posterior of θ on the same graph.(3pts)
Homework 3
• Gelman book Exercise 2.2 (Predictive
distributions) Two coins C1 and C2.
choose one coin randomly and spin it
repeatedly. The first two spins are tails, what is
the expectation of the number of additional spins
until a head shows up? (3pts)
• If you knew which coin was chosen, the two
spins are independent of each other. Show that
not knowing which one, the two spins are not
independent(1pt).
Homework 4
• We observed y female births out of a total
of n births. Prove that the posterior
predictive probability of the next two births
are not independent, i.e. the posterior
predictive probability of the next two births
are both female is not equal to the
posterior predictive probability of the next
birth being female -squared. (2pts)
Homework 5
• Find the conjugate prior for Poisson
distribution.(2pts)
Homework 6
• Gelman book 2.10 a) 2pts
Homework 7-10
• Gelman book 2.21 (a,b,c,d) 1pt each
Homework 11
A random sample of n students is drawn from a large
population. Their average weight is 150 pounds.
Assume that the weight in the population are normally
distributed with mean \theta and standard deviation
20. Suppose your prior for \theta is normal with mean
180 and standard deviation 40.
a) give your posterior distribution for \theta (as a function
of n) --2pts
b) If n=10, give 95% posterior interval for \theta.—1pt
c) Using a graphic software, plot the prior, the likelihood
(as a function of \theta) and posterior in the same
plot—1pt. Observe the relationship of the 3.
(Not required!) Re-Do b) c) with n=100
(Gelman book 2nd Ed. Ex 2.8)
Homework 12
• Assume a non-
informative improper
prior on the standard
deviation σ of a          p( )   1
normal distribution is

• Prove that the
corresponding prior
density for σ2 is        p( )  
2        2

• 2pts (Gelman 2.19a)
Homework 13
• Pre-post debate polling. ABC news polled 639 voters
before the 1988 presidential debate and different 639
voters after. Let α1 be the proportion who favored Bush
before the debate, and α2 after. Choose a
noninformative prior. Plot a histogram of α2-α1. What is
the posterior probability of a shift towards Bush (i.e. α2-
α1>0)?

Bush       Dukakis    Other
pre        294        307        38
Post       288        332        19
Problem 21
The length of a light bulb has an exponential
distribution with unknown rate θ.
a) Show that Gamma distribution is conjugate for
θ given an independent and identically
distributed sample of light bulb lifetimes.(2pts)
b) Suppose your prior for θ is a gamma
distribution with coefficient of variation 0.5 (that
is: sd/mean=0.5) A random sample of light
bulbs is to be tested to measure their lifetime. If
the coefficient of variation is to be reduced to
0.1, how many light bulbs should be tested?
(2pts) Gelman book 2.21 a) c)
Problem 22
data from course homepage.
a)Using a noninformative prior on σ2,determine the
posterior distribution for σ2 (2pts)
b)Suppose that we have prior belief we are 95%
sure that σ falls between 3 and 20 points. Find
an approximate conjugate prior that corresponds
to this belief (can do this by trial and error on the
computer) 2pts
Gelman 2.23.
Problem 23
• Assume that the number of fatal accidents
in each year are Poisson distributed with a
constant unknown rate θ and an exposure
proportional to the passenger miles flown
that year(see table on next page). Set a
prior distribution for θ and determine the
posterior distribution based on the data.
(4pts) Gelman 2.13. Table 2.2
Fatal accidents Passenger miles
(100million)
1976   24               3863
1977   25               4300
1978   31               5027
1979   31               5481
1980   22               5814
1981   21               6033
1982   26               5877
1983   20               6223
1984   16               7433
1985   22               7107
Problem 31
• Gelman 3.3 An experiment was performed on the effects of
magnetic fields on the flow of calcium out of chicken brains.
Measurements on an unexposed group of 32 chickens had a sample
mean of 1.013 and sample standard deviation of 0.24.
Measurements on exposed group of 36 chickens had sample mean
of 1.173 and sample sd of 0.20.
• A) assuming that the measurements in the control (unexposed)
group were from a normal distribution with mean μC and standard
deviation σC, what is the posterior distribution of μC? Similarly, what
is the posterior distribution of the treatment group μt? Assume a
uniform prior on (μc,μt,logσc,logσt) (1 pt for writing down the joint
prior for (μc,μt,σc2,σt2), 2 pt for deriving the posterior of μc, 1 pt for μt)
• What’s the posterior distribution of μt-μc? You can obtain
independent posterior samples of μt and μc then plot the histogram
of the difference. (2pts) Obtain an approximate 95% posterior
interval for μt-μc (1pts. Hint: use the quantile() function)
Problem 32
• Knowing the posterior of σ2 is IG((n-1)/2,
(n-1)S2/2 ) S2=(Sum of squares)/(n-1)
• Show that (n-1) S2/ σ2 is a chi-square with
n-1 degrees of freedom
(2pts. Hint: InverseChisquare is a different
parameter form of InverseGamma. The
inverse of an inverseChi-square is a Chi-
square)
Problem 41
• Gelman book 2nd Ed. 5.9 a) 3pts. b) 1pt
c) 1pt. Hint: choice of noninformative
priors are on pages 134 and 136.
Problem 42
• 5.13. Formulate the full model, clarify what
each parameter corresponds to (2pts)
• a) 2pt
• c) 2pts
• Describe what each graph is and the
corresponding algebra and code, if any.


To top