Question
Consider a univariate normal model with mean mu and variance tau. Suppose we use a Beta(2, 2) prior for mu (somehow we know n is
Consider a univariate normal model with mean mu and variance tau. Suppose we use a Beta(2, 2) prior for mu (somehow we know n is between zero and one) and a log-normal(1, 10) prior for tau (recall that if a random variable X is log-normal(m, v) then log X is N(m, v)). Assume a priori that mu and tau are independent. Implement a Metropolis-Hastings algorithm to evaluate the posterior distribution of mu and tau. Remember that you have to jointly accept or reject mu and tau. Also compute the posterior probability that mu is bigger than 0.5. Here are the data: Attempt: (Heres to enter my data) mu <- rbeta(l, 2, 2) tau <- rlnorm(1, 1, 10) x <- c(2.3656491, 2.4952035, 1.0837817, 0.7586751, 0.8780483, 1.2765341, 1.4598699, 0.1801679, -1.0093589, 1.4870201, -0.1193149, 0.2578262)
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