Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gelman_rubin returns wrong values #46

Closed
isofer opened this issue Jun 23, 2011 · 3 comments
Closed

gelman_rubin returns wrong values #46

isofer opened this issue Jun 23, 2011 · 3 comments
Assignees

Comments

@isofer
Copy link
Contributor

isofer commented Jun 23, 2011

x = pm.Normal('x',0,1,size=5)

@pm.deterministic
def y(x=x):
return x[2]

m = pm.MCMC([y,x])
m.sample(100,0)
m.sample(100,0)
m.sample(100,0)
pm.diagnostics.gelman_rubin(m)


I ran this code and got different values for y and for x[2].
for instance,
{'x': [0.96274904628327884,
1.0617412110342699,
0.94988095858687061,
0.94650618423398925,
1.0581700972182297],
'y': 1.0180891431696331}

@ghost ghost assigned fonnesbeck Jun 30, 2011
@fonnesbeck
Copy link
Member

Its not clear to me what the bug is here. The G-R statistics should be approximately one if convergence is reached. They are based on a stochastic sample, so you should not expect them to be identical each time you run the code. If I am missing something, please clarify.

@isofer
Copy link
Contributor Author

isofer commented Jun 30, 2011

y is a deterministic node and it's equal to x[2], so the trace of y and the trace of x[2] is identical,
which means that GR of x[2] should be equal to the GR of y.
In the result above you can see that x[2] has GR of 0.949880...
while the GR of y is 1.01808

@fonnesbeck
Copy link
Member

Got it, thanks. It was just a silly transpose error. Fixed in 81999ab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants