1
# -*- coding:iso8859-1 -*-
2
#-----------------------------------------------------------------------------
4
# Purpose: This simple routine implements a simple Gibbs sampler.
6
# Author: Fl�vio Code�o Coelho
9
# RCS-ID: $Id: module1.py $
12
# Acknowledgements: Whatever
13
#-----------------------------------------------------------------------------
16
from RandomArray import *
17
from matplotlib.pylab import *
32
# the core of the method: sample recursively from two normal distributions
33
# Tthe mean for the current sample, is updated at each step.
35
x[i] = normal(m1+rho*(y[i-1]-m2)/s2,s1*sd)
36
y[i] = normal(m2+rho*(x[i-1]-m1)/s1,s2*sd)
38
scatter(x,y,marker='d',c='r')
39
title('Amostrador de Gibbs')