Question
solve exercise 5.13 from Bayesian data Analysis from Andrew Gelman using stan and 'noninformative' hyperprior using stan? I don't know to the right way to
solve exercise 5.13 from Bayesian data Analysis from Andrew Gelman using stan and 'noninformative' hyperprior using stan? I don't know to the right way to create the stan model.
The 5.13 question is (keep in mind that I want to solve using Stan and noninformative hyperpriors - the book is free and available at: https://users.aalto.fi/~ave/BDA3.pdf) :
"Exercise 3.8 described a survey of bicycle traffic in Berkeley, California, with data displayed in Table 3.3. For this problem, restrict your attention to the first two rows of the table: residential streets labeled as 'bike routes,' which we will use to illustrate this computational exercise.
(a) Set up a model for the data in Table3.3so that, for j= 1,...,10, the observed number of bicycles at location j is binomial with unknown probability ?j and sample size equal to the total number of vehicles (bicycles included) in that block. The parameter ?j can be interpreted as the underlying or 'true' proportion of traffic at location j that is bicycles. (See Exercise3.8.) Assign a beta population distribution for the parameters ?j and a noninformative hyperprior distribution as in the rat tumor example of Section 5.3. Write down the joint posterior distribution.
(b) Compute the marginal posterior density of the hyperparameters and draw simulations from the joint posterior distribution of the parameters and hyperparameters, as in Section 5.3.
(c) Compare the posterior distributions of the parameters ?j to the raw proportions, (number of bicycles/total number of vehicles) in location j. How do the inferences from the posterior distribution differ from the raw proportions?
(d) Give a 95% posterior interval for the average underlying proportion of traffic that is bicycles.
(e) A new city block is sampled at random and is a residential street with a bike route. In an hour of observation, 100 vehicles of all kinds go by. Give a 95% posterior interval for the number of those vehicles that are bicycles. Discuss how much you trust this interval in application.
(f) Was the beta distribution for the ?j's reasonable?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started