Given $$\begin {align} \beta&\sim\mathcal N(1.5,1)\\ y&\sim\mathcal N(\beta x,5.5) \end{align} $$I have 10,000 samples from the posterior $\beta_S\sim P(\beta|x)$

Is it enough to get the prediction posterior samples by computing $\hat \mu_s=\beta_s x$ for $s=1\cdots10,000$?

And getting a Single sample with dimension $(10000,1)$ from $ \mathcal N(\hat\mu,5.5) $?

Or do I still need to take N samples of the above and get a sample dimension $(N,10000,1)$?

I need the prediction distribution samples and I don't know how to properly get the posterior predictive samples.


1 Answer 1


You want the posterior predictive for $y$, which will be given as $p(y^{rep}|y)=\int p(y^{rep}|\beta,y)p(\beta|y)=\int p(y^{rep}|\beta)p(\beta|y)$. This suggests the following procedure for generating samples from the posterior predictive.

  1. Draw from your posterior of $\beta_s\sim p(\beta|y)$

  2. From each of your sampled $\beta_s$ draw $y|\beta_s\sim N(\beta_s x,5.5)$.

  • $\begingroup$ In step 2, how many samples $y|\beta_s$ for a single sampled $\beta_s$? Is one sample sufficient or do I take M samples and get the mean $\endgroup$
    – wd violet
    Nov 10, 2023 at 3:14
  • 1
    $\begingroup$ One sample is sufficient in step 2 for each $\beta_s$. $\endgroup$ Nov 10, 2023 at 3:15
  • $\begingroup$ Thank you for your clarification! $\endgroup$
    – wd violet
    Nov 10, 2023 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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