Here we show a standalone example of using PyJAGS to
estimate the parameters of a straight line model in data with Gaussian noise. The
data and model used in this example are defined in createdata.py, which can be downloaded
from here. The
script shown below can be downloaded from here.
Example code
Running the code
A description of installing PyJAGS is given here. If you have downloaded the createdata.py and test_PyJAGS.py scripts into the directory ${HOME}, then you can run it using:
python test_PyJAGS.py
If you have Matplotlib installed then the script will produce a plot of the posterior distributions
on the straight line parameters $m$ and $c$.
A Python 3 Docker image with PyJAGS installed is
available, which can be used with:
docker run -it -v ${HOME}:/work mattpitkin/samplers:python3
to enter an interactive container, and then within the container the test script can be run with: