I have the following Poisson mass function:

$$p(y| \theta) = \frac{\theta^y e^{\theta}}{y!} $$

Which has a corresponding likelihood for n independent realizations of y as follows:


Now I have that the prior is $1/\theta$, so I think that the posterior would be: $$p(\theta| y)=\frac{e^{-n\theta}\theta^{(\sum^n_{i=1}{y_i})-1}}{\prod_{i=1}^ny_i!}$$ a. Can you please tell me if this is correct?

I am also supposed to simulate 1000 observations from that posterior in R, but what I don't understand is how to do that. I mean, the posterior is giving me a probability, not an observation, so how I am supposed to create observations from that posterior? I can't use rpois() because because the posterior is not exactly a poisson, is it?

Thank you.

  • $\begingroup$ Is this a question from a course or textbook? If so, please add the [self-study] tag & read its wiki. $\endgroup$ – gung - Reinstate Monica Feb 16 '16 at 1:04

thats not quite correct. Bayes rule gives you $$p(θ|y)=p(y|θ)p(θ)/p(y)$$ so your result is proportional to the posterior (it doesn't have the right normalizing constant). It looks like the posterior will be $$Gamma(\alpha=\sum y_i,\beta=n)$$ See conjugate prior for Poisson

| cite | improve this answer | |
  • $\begingroup$ Thank you. So what you're saying is: $p(\theta| y)\propto\frac{e^{-n\theta}\theta^{(\sum^n_{i=1}{y_i})-1}}{\prod_{i=1}^ny_i!}$. Just curious, since the denominator does not depend of $\theta$, can I drop it and still say that is proportional to the posterior? $\endgroup$ – user280809 Feb 16 '16 at 1:24
  • $\begingroup$ @user280809 you're asking whether something that is proportional to another thing is still proportional to it if you multiply by a constant? $\endgroup$ – Glen_b Feb 16 '16 at 1:36
  • $\begingroup$ Yes also note originally I had wrong sign on beta $\endgroup$ – bdeonovic Feb 16 '16 at 1:42
  • $\begingroup$ Yes, I'm sorry, as you can see my knowledge of statistics is not very good and I am wondering if the denominator is actually a constant since one can change the n but from the tone of your response I assume that it is constant. $\endgroup$ – user280809 Feb 16 '16 at 1:43
  • $\begingroup$ @bdeonovic Thank you for your patience and help, I appreciate it. $\endgroup$ – user280809 Feb 16 '16 at 1:44

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.