Bayesian inference
#1
Suppose we have 2 bags (one black, one white), the white bag has 10 red balls and 90 blue balls, and the black bag has 50 red balls and 50 blue balls. Without looking from which bag it came from, we get a red ball. I want to know, given I grabbed a red ball, what is the probability it came from the white bag?
Hint: think about the blue and red balls as data x, and the bags as parameter values under different hypotheses
#2
Suppose now that we mark a sample of 10 fish with radio tags, follow them for 1 year, and determine that 6 of the 10 survive. Using the Binomial-Beta model
1 - Take the sample of n=10, x=6 as the preliminary sample and compute an informative prior for p
2 - Take a second sample of n=20 and x = 9 as the updating sample and compute the posterior distribution of p
3 - Repeat the above steps but with a vague prior of Beta(1,1)
4 - Do the same thing (informative vs. vague prior) but for the second sample of n=200 and x = 89
5 - Compare the results (graphically, summary statistics) and discuss the relative influence of prior information versus current data under the 2 approaches.
#3
1 - Based on the previous example of fish survival, suppose the mean probability of fish survival mean(p)=0.6 is sd(p) = 0.2, use that information to form an informative prior for p
2- Take a second sample of n=20 and x = 9 as the updating sample and compute the posterior distribution of p
3 - Repeat the above steps but with an informative prior based on mean (p) =0.6 and sd(p) = 0.01
4- Do the same thing (contrasting informative vs. priors) but for the second sample of n=200 and x = 89
5 - Compare the results (graphically, summary statistics) and discuss the relative influence of prior information versus current
#4
Following the example of prediction under 4 alternative models, Normal likelihood with equal and known variances:
Take a case where we are harvesting a population and predicting its response under 4 alternative models of harvest impact. Given an initial population size of 125, the models produce predictions for next year’s population of 100, 150, 125, and 135. We will start with equal belief in the 4 alternative models (1/4 each). We will assume a Normal likelihood and a fixed sd of 25. Finally, next year comes and we observe that the population is 140.
- What are the posterior probabilities of each hypothesis, given that the observed abundance is 140?
- What are the posterior probabilities if the observed abundance is 140 but sd is 5?
#5
Using poisson_bugs.R example, modify and run the code for GLM and Bayesian analyses to:
1 – Incorporate the quadratic effect of year . This will work much better if you center the year data. Try the transformation
a<-max(data$year)
b<-min(data$year)
data$year<-data$year/(a-b)
2 – Repeat using a non-informative normal prior distribution in the Bayesian analyses, instead of the uniform (Hint: OpenBUGS code for a normal distribution y~dnorm(mu, 1/sd^2) ). Compare the results with the ones using uniform priors
#6
Using poisson_bugs_re.R example, modify and run the code for GLMM and Bayesian analyses to create an intercept only model. Compare with the models incorporating year effects: