71  Sampling out of a bivariate Normal distribution

Open in Google Colab | Download notebook


Draw 4000 samples out of a bivariate Normal distribution with mean \(\boldsymbol{\mu} = (10, 20)\) and a covariance matrix of

\[\begin{align} \mathsf{\Sigma} = \begin{pmatrix} 4 & -2 \\ -2 & 6 \end{pmatrix} \end{align}\]

using each of the following three methods.

a) Using Numpy.

b) Using Stan’s build-in random number generator (that is, in the generated quantities block).

c) Using Stan’s MCMC sampler.

Make plots of the samples to show they are consistent.