Suppose we have some data points that we believe they follow $N(\mu, \sigma^2)$, and both parameters are unknown . I want to assign conjugate prior distributions on both $\mu$ and $\sigma^2$, and then obtain the posterior distribution. How this can be done in R?


I guess your answer can be found in wikipedia http://en.wikipedia.org/wiki/Conjugate_prior. The conjugate prior is the Normal-inverse gamma with hyperparameters $\mu_0, \nu, \alpha$ and $\beta$.

  • $\begingroup$ Thanks! But what is the R code to obtain the posterior distribution? $\endgroup$ – user9292 Jan 4 '13 at 4:23
  • 1
    $\begingroup$ The posterior distribution has the form given in the above Wiki link. You don't need to use R to find the posterior, although you can download the Normal-Gamma Package if you need to have the normal-gamma PDF or CDF in R. $\endgroup$ – caburke Jan 4 '13 at 4:40

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.