So I have the following formulas:

$\frac {\mu-\bar{x}}{\frac{\sigma}{\sqrt{n}}} \sim N(0,1)$


$\frac{\sum_{i=1}^n(x_i-\bar{x})^2}{\sigma^2} \sim\chi^2_{n-1}$

and given following sample:

Sample 1: 120 , 107 , 110 , 116 , 114 , 111 , 113 , 117 , 114 , 112

Assuming I can generate values from a N(0,1), how can I sample posterior values for $\mu$ ?

EDIT: I forgot to include:

$\mu|\sigma^2 \sim N(\beta, \frac{\sigma^2}{n_o})$

$\mu\,|\,x_1,x_2,....x_n\,,\,\sigma^2 \sim N(\frac {n\bar{x} + n_o\beta}{ n + n_o} \, , \frac {\sigma^2}{n + n_o})$

  • 1
    $\begingroup$ Perhaps I am missing something, and I don't want to assume what your distributions are for you, but can you tell us what the likelihood of your data is, and what priors you are using? Since you ask for posterior values. $\endgroup$
    – user95564
    Nov 19, 2015 at 8:15

1 Answer 1


First up, your formulas don't tell us much except that

$$ x \sim N(\mu,\sigma^2). $$

To sample from the posterior distribution $f(\mu|\bar{x})$ we'd need to know $\mu$'s prior $f(\mu)$. These are related with Bayes' law.

$$ f(\mu|\bar{x}) = \frac{f(\bar{x}|\mu) f(\mu)}{f(\bar{x})} $$

  • $\begingroup$ Sorry, question edited with the info. $\endgroup$
    – Jenna Maiz
    Nov 19, 2015 at 14:07
  • 1
    $\begingroup$ Well, there's no prior for $\sigma$. If you assume it is a known parameter along with $\beta$ then you've already supplied the posterior for $\mu$. It's a normal distribution, you just need to plug in the values. If it has a flat prior, then that would take a few pages of working for me but probably a Gibbs sampler. $\endgroup$
    – ACE
    Nov 20, 2015 at 4:23

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.