{"action":"opened","issue":{"url":"https://api.github.com/repos/cjgeyer/mcmc/issues/2","repository_url":"https://api.github.com/repos/cjgeyer/mcmc","labels_url":"https://api.github.com/repos/cjgeyer/mcmc/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/cjgeyer/mcmc/issues/2/comments","events_url":"https://api.github.com/repos/cjgeyer/mcmc/issues/2/events","html_url":"https://github.com/cjgeyer/mcmc/issues/2","id":374791255,"node_id":"MDU6SXNzdWUzNzQ3OTEyNTU=","number":2,"title":"Sampler becomes stuck, repeating a single proposal indefinitely","user":{"login":"rplzzz","id":7209964,"node_id":"MDQ6VXNlcjcyMDk5NjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/7209964?v=4","gravatar_id":"","url":"https://api.github.com/users/rplzzz","html_url":"https://github.com/rplzzz","followers_url":"https://api.github.com/users/rplzzz/followers","following_url":"https://api.github.com/users/rplzzz/following{/other_user}","gists_url":"https://api.github.com/users/rplzzz/gists{/gist_id}","starred_url":"https://api.github.com/users/rplzzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rplzzz/subscriptions","organizations_url":"https://api.github.com/users/rplzzz/orgs","repos_url":"https://api.github.com/users/rplzzz/repos","events_url":"https://api.github.com/users/rplzzz/events{/privacy}","received_events_url":"https://api.github.com/users/rplzzz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-28T19:49:23Z","updated_at":"2018-10-28T19:49:23Z","closed_at":null,"author_association":"NONE","body":"I am seeing the following odd behavior.  When I run the sampler, like so:\r\n```\r\nout1 <- metrop(logpost, pv0, 10, scale=mcmc_scale, debug=TRUE)\r\n```\r\nI get a couple of good iterations, but then the sampler starts repeating the same proposal over and over:\r\n```\r\nout1$proposal\r\n          [,1]      [,2]     [,3]      [,4]     [,5]     [,6]     [,7]     [,8]\r\n [1,] 3.073006 0.7735492 2.280427 0.2525763 2.127533 285.1648 1.125720 11.24583\r\n [2,] 3.146012 0.5470985 2.260854 0.2051526 2.255066 285.3296 1.251440 12.49165\r\n [3,] 3.219018 0.3206477 2.241281 0.1577288 2.382599 285.4944 1.377160 13.73748\r\n [4,] 3.079750 0.5285934 2.222736 0.3251265 2.038565 284.6061 1.331585 12.74362\r\n [5,] 3.079750 0.5285934 2.222736 0.3251265 2.038565 284.6061 1.331585 12.74362\r\n [6,] 3.079750 0.5285934 2.222736 0.3251265 2.038565 284.6061 1.331585 12.74362\r\n [7,] 3.079750 0.5285934 2.222736 0.3251265 2.038565 284.6061 1.331585 12.74362\r\n [8,] 3.079750 0.5285934 2.222736 0.3251265 2.038565 284.6061 1.331585 12.74362\r\n [9,] 3.079750 0.5285934 2.222736 0.3251265 2.038565 284.6061 1.331585 12.74362\r\n[10,] 3.079750 0.5285934 2.222736 0.3251265 2.038565 284.6061 1.331585 12.74362\r\n```\r\nYou can see that starting with iteration 4, the proposal is the same every time.\r\n\r\nRestarting from the point where the last one left off gives me a one more valid iteration, but the sampler quickly falls back into the same repetitive behavior:\r\n```\r\nout2 <- metrop(out1, pv0, 100, scale=mcmc_scale, debug=TRUE)\r\nout2$proposal\r\n           [,1]      [,2]     [,3]      [,4]     [,5]     [,6]     [,7]     [,8]\r\n  [1,] 3.079750 0.5285934 2.222736 0.3251265 2.038565 284.6061 1.331585 12.74362\r\n  [2,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n  [3,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n  [4,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n  [5,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n  [6,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n  [7,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n  [8,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n  [9,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n [10,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n [11,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n [12,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n [13,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n [14,] 2.919562 0.5275253 2.213430 0.3326856 2.271547 286.5868 1.500605 12.14620\r\n(...)\r\n```\r\nThe same proposal then gets repeated for all of the remaining iterations.\r\n\r\nI tried it one more time, starting from the end of the second run, and this time it was a few iterations before the repetition began:\r\n```\r\nout3 <- metrop(out2, pv0, 100, scale=mcmc_scale, debug=TRUE)\r\nout3$proposal[1:15,]\r\n          [,1]      [,2]     [,3]        [,4]     [,5]     [,6]     [,7]     [,8]\r\n [1,] 2.919562 0.5275253 2.213430  0.33268563 2.271547 286.5868 1.500605 12.14620\r\n [2,] 3.127507 0.5089804 2.380828 -0.01134893 2.182718 286.1311 1.301835 12.62126\r\n [3,] 3.100912 0.6157917 2.299748  0.24053632 2.345545 285.2590 1.331331 12.22602\r\n [4,] 3.082407 0.5776736 2.419722  0.02403483 2.273197 286.0605 1.381725 12.35563\r\n [5,] 3.082407 0.5776736 2.419722  0.02403483 2.273197 286.0605 1.381725 12.35563\r\n [6,] 3.082407 0.5776736 2.419722  0.02403483 2.273197 286.0605 1.381725 12.35563\r\n [7,] 3.082407 0.5776736 2.419722  0.02403483 2.273197 286.0605 1.381725 12.35563\r\n [8,] 3.082407 0.5776736 2.419722  0.02403483 2.273197 286.0605 1.381725 12.35563\r\n [9,] 3.082407 0.5776736 2.419722  0.02403483 2.273197 286.0605 1.381725 12.35563\r\n[10,] 3.082407 0.5776736 2.419722  0.02403483 2.273197 286.0605 1.381725 12.35563\r\n[11,] 3.082407 0.5776736 2.419722  0.02403483 2.273197 286.0605 1.381725 12.35563\r\n[12,] 3.082407 0.5776736 2.419722  0.02403483 2.273197 286.0605 1.381725 12.35563\r\n[13,] 3.082407 0.5776736 2.419722  0.02403483 2.273197 286.0605 1.381725 12.35563\r\n[14,] 3.082407 0.5776736 2.419722  0.02403483 2.273197 286.0605 1.381725 12.35563\r\n[15,] 3.082407 0.5776736 2.419722  0.02403483 2.273197 286.0605 1.381725 12.35563\r\n(...)\r\n```\r\n\r\nPresumably R's RNG is getting mangled somehow, but nothing in my code touches anything related to the RNG.  Do you have any idea what might be causing this behavior?\r\n"}}
{"actor":{"display_login":"rplzzz"}}