{"action":"created","issue":{"url":"https://api.github.com/repos/stan-dev/pystan/issues/133","labels_url":"https://api.github.com/repos/stan-dev/pystan/issues/133/labels{/name}","comments_url":"https://api.github.com/repos/stan-dev/pystan/issues/133/comments","events_url":"https://api.github.com/repos/stan-dev/pystan/issues/133/events","html_url":"https://github.com/stan-dev/pystan/issues/133","id":53132639,"number":133,"title":"bug yielding Rhat values of \"nan\"","user":{"login":"jbloom","id":1906801,"avatar_url":"https://avatars.githubusercontent.com/u/1906801?v=3","gravatar_id":"","url":"https://api.github.com/users/jbloom","html_url":"https://github.com/jbloom","followers_url":"https://api.github.com/users/jbloom/followers","following_url":"https://api.github.com/users/jbloom/following{/other_user}","gists_url":"https://api.github.com/users/jbloom/gists{/gist_id}","starred_url":"https://api.github.com/users/jbloom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbloom/subscriptions","organizations_url":"https://api.github.com/users/jbloom/orgs","repos_url":"https://api.github.com/users/jbloom/repos","events_url":"https://api.github.com/users/jbloom/events{/privacy}","received_events_url":"https://api.github.com/users/jbloom/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-12-30T17:42:04Z","updated_at":"2015-01-04T22:03:37Z","closed_at":null,"body":"I am using PyStan to do MCMC over some variables in a simplex (Dirichlet prior). I check for convergence by looking at the Rhat value for each variable in the simplex. Occasionally, a few of the variables in the simplex have an Rhat of \"nan.\" Even when I repeatedly re-run the MCMC with more steps, these variables keep having an Rhat of \"nan.\" This is despite the fact that other variables in the simplex will have Rhat values of very close to one (<1.02) and the effective sample size (n_eff) will be >1000 even for the variables returning \"nan\" for Rhat.\r\n\r\nI am speculating that there is some bug in the Rhat calculation that ends up returning \"nan\" for pathological values of certain variables?"},"comment":{"url":"https://api.github.com/repos/stan-dev/pystan/issues/comments/68651465","html_url":"https://github.com/stan-dev/pystan/issues/133#issuecomment-68651465","issue_url":"https://api.github.com/repos/stan-dev/pystan/issues/133","id":68651465,"user":{"login":"ariddell","id":19950,"avatar_url":"https://avatars.githubusercontent.com/u/19950?v=3","gravatar_id":"","url":"https://api.github.com/users/ariddell","html_url":"https://github.com/ariddell","followers_url":"https://api.github.com/users/ariddell/followers","following_url":"https://api.github.com/users/ariddell/following{/other_user}","gists_url":"https://api.github.com/users/ariddell/gists{/gist_id}","starred_url":"https://api.github.com/users/ariddell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ariddell/subscriptions","organizations_url":"https://api.github.com/users/ariddell/orgs","repos_url":"https://api.github.com/users/ariddell/repos","events_url":"https://api.github.com/users/ariddell/events{/privacy}","received_events_url":"https://api.github.com/users/ariddell/received_events","type":"User","site_admin":false},"created_at":"2015-01-04T22:03:37Z","updated_at":"2015-01-04T22:03:37Z","body":"Yes. I want to fix this.\r\n\r\nI'm tempted to write a \"RFC\" for on common Rhat implementation. PyStan tried using Stan's Rhat implementation but it was far too slow (it could not operate on the chains in situ in Python). The current implementation is a copy of RStan's implementation but something is clearly going wrong.\r\n\r\nI'd love a C++ rhat function (without Eigen) that both RStan and PyStan could call. The trick is that it has to accept `num_chain` arrays of doubles where the memory is not contiguous (otherwise we could use Eigen)."}}