1
$\begingroup$

We have two groups of people, members of each group have a chance of getting a disease $\theta_i$. The groups have $n_i$ members and $Y_i$ diseased members. Group 1: $n_1=100, Y_1=21$, Group 2: $n_2=200,Y_2=45$. We assume that $\theta_i$ has a $Beta(1,1)$ distribution. If I did this correctly, the posterior distribution for $\theta_i$ is given as $\theta_i^{x_i}(1-\theta_i)^{x_i} {n_i\choose Y_i}$. What I really want, though, is the posterior expectation of the odds ratio: $\frac{\theta_1(1-\theta_2)}{\theta_2(1-\theta_1)}$. It is suggested that I use R to employ Monte Carlo approximation, by generating samples from both posterior distributions. I am not sure how to do this. It's probably quite basic, but I haven't been properly introduced to R.

$\endgroup$
  • $\begingroup$ The question has nothing to do with R in the sense that you can solve it with any programming language: the posterior distribution on $\theta_1$ is standard, the posterior distribution on $\theta_2$ is standard, hence you can simulate samples from both and deduce a sample of$$\frac{\theta_1(1-\theta_2)}{\theta_2(1-\theta_1)}$$ $\endgroup$ – Xi'an Oct 3 '18 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.