{"action":"created","issue":{"url":"https://api.github.com/repos/MoBiodiv/mobr/issues/115","repository_url":"https://api.github.com/repos/MoBiodiv/mobr","labels_url":"https://api.github.com/repos/MoBiodiv/mobr/issues/115/labels{/name}","comments_url":"https://api.github.com/repos/MoBiodiv/mobr/issues/115/comments","events_url":"https://api.github.com/repos/MoBiodiv/mobr/issues/115/events","html_url":"https://github.com/MoBiodiv/mobr/issues/115","id":200143593,"number":115,"title":"spatial rarefaction function miscalculating richness for n=1","user":{"login":"dmcglinn","id":1190381,"avatar_url":"https://avatars.githubusercontent.com/u/1190381?v=3","gravatar_id":"","url":"https://api.github.com/users/dmcglinn","html_url":"https://github.com/dmcglinn","followers_url":"https://api.github.com/users/dmcglinn/followers","following_url":"https://api.github.com/users/dmcglinn/following{/other_user}","gists_url":"https://api.github.com/users/dmcglinn/gists{/gist_id}","starred_url":"https://api.github.com/users/dmcglinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmcglinn/subscriptions","organizations_url":"https://api.github.com/users/dmcglinn/orgs","repos_url":"https://api.github.com/users/dmcglinn/repos","events_url":"https://api.github.com/users/dmcglinn/events{/privacy}","received_events_url":"https://api.github.com/users/dmcglinn/received_events","type":"User","site_admin":false},"labels":[{"id":219653340,"url":"https://api.github.com/repos/MoBiodiv/mobr/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":{"login":"rueuntal","id":1157182,"avatar_url":"https://avatars.githubusercontent.com/u/1157182?v=3","gravatar_id":"","url":"https://api.github.com/users/rueuntal","html_url":"https://github.com/rueuntal","followers_url":"https://api.github.com/users/rueuntal/followers","following_url":"https://api.github.com/users/rueuntal/following{/other_user}","gists_url":"https://api.github.com/users/rueuntal/gists{/gist_id}","starred_url":"https://api.github.com/users/rueuntal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rueuntal/subscriptions","organizations_url":"https://api.github.com/users/rueuntal/orgs","repos_url":"https://api.github.com/users/rueuntal/repos","events_url":"https://api.github.com/users/rueuntal/events{/privacy}","received_events_url":"https://api.github.com/users/rueuntal/received_events","type":"User","site_admin":false},"assignees":[{"login":"rueuntal","id":1157182,"avatar_url":"https://avatars.githubusercontent.com/u/1157182?v=3","gravatar_id":"","url":"https://api.github.com/users/rueuntal","html_url":"https://github.com/rueuntal","followers_url":"https://api.github.com/users/rueuntal/followers","following_url":"https://api.github.com/users/rueuntal/following{/other_user}","gists_url":"https://api.github.com/users/rueuntal/gists{/gist_id}","starred_url":"https://api.github.com/users/rueuntal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rueuntal/subscriptions","organizations_url":"https://api.github.com/users/rueuntal/orgs","repos_url":"https://api.github.com/users/rueuntal/repos","events_url":"https://api.github.com/users/rueuntal/events{/privacy}","received_events_url":"https://api.github.com/users/rueuntal/received_events","type":"User","site_admin":false},{"login":"dmcglinn","id":1190381,"avatar_url":"https://avatars.githubusercontent.com/u/1190381?v=3","gravatar_id":"","url":"https://api.github.com/users/dmcglinn","html_url":"https://github.com/dmcglinn","followers_url":"https://api.github.com/users/dmcglinn/followers","following_url":"https://api.github.com/users/dmcglinn/following{/other_user}","gists_url":"https://api.github.com/users/dmcglinn/gists{/gist_id}","starred_url":"https://api.github.com/users/dmcglinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmcglinn/subscriptions","organizations_url":"https://api.github.com/users/dmcglinn/orgs","repos_url":"https://api.github.com/users/dmcglinn/repos","events_url":"https://api.github.com/users/dmcglinn/events{/privacy}","received_events_url":"https://api.github.com/users/dmcglinn/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2017-01-11T16:38:01Z","updated_at":"2017-01-11T18:53:11Z","closed_at":null,"body":"It appears that our function `rarefaction` is miscalculating the richness when sample size is 1 (possibly at other sizes as well I'm not sure yet). Was this function ever compared to hand-worked examples as a test? We should get some explicit tests in place for this function. Here is code to demonstrate the bug: \r\n\r\n```r\r\n\r\n# create a 3 species community distributed across 4 sites\r\ncomm = rbind(c(0, 0, 1), \r\n                       c(0, 0, 0),\r\n                       c(0, 1, 0), \r\n                       c(1, 0, 0))\r\nreplicate(4, rarefaction(comm, 'spat', xy_coords = 1:4))\r\n# note that the replicates differ from on another the correct value when \r\n# n = 1 is 0.75 (= mean(c(1, 0, 1, 1)) the site richness values)\r\n# but sometimes the function returns 1. \r\n```\r\n\r\nI think this bug likely has something to do with the reordering of the data prior to computing the accumulation curves to try to randomize the pattern by which ties are encountered. "},"comment":{"url":"https://api.github.com/repos/MoBiodiv/mobr/issues/comments/271959521","html_url":"https://github.com/MoBiodiv/mobr/issues/115#issuecomment-271959521","issue_url":"https://api.github.com/repos/MoBiodiv/mobr/issues/115","id":271959521,"user":{"login":"rueuntal","id":1157182,"avatar_url":"https://avatars.githubusercontent.com/u/1157182?v=3","gravatar_id":"","url":"https://api.github.com/users/rueuntal","html_url":"https://github.com/rueuntal","followers_url":"https://api.github.com/users/rueuntal/followers","following_url":"https://api.github.com/users/rueuntal/following{/other_user}","gists_url":"https://api.github.com/users/rueuntal/gists{/gist_id}","starred_url":"https://api.github.com/users/rueuntal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rueuntal/subscriptions","organizations_url":"https://api.github.com/users/rueuntal/orgs","repos_url":"https://api.github.com/users/rueuntal/repos","events_url":"https://api.github.com/users/rueuntal/events{/privacy}","received_events_url":"https://api.github.com/users/rueuntal/received_events","type":"User","site_admin":false},"created_at":"2017-01-11T18:53:11Z","updated_at":"2017-01-11T18:53:11Z","body":"OK is my input still needed?\n\nI guess we'd need to rerun the sensitivity analysis, right?\n\nOn Jan 11, 2017 11:36 AM, \"Dan McGlinn\" <notifications@github.com> wrote:\n\n> It does appear to be because of the reordering b/c I changed this part of\n> the rarefaction function and it returned the correct answer:\n>\n> # I changed this old line in the function rarefaction\n> new_order = sample(1:n)\n> # to this so that the shuffled order stopped\n> new_order = 1:n\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/MoBiodiv/mobr/issues/115#issuecomment-271954919>, or mute\n> the thread\n> <https://github.com/notifications/unsubscribe-auth/ABGoPvlvD5uAMdmgtET8cv6EG5MAlqjIks5rRSEbgaJpZM4Lgy1t>\n> .\n>\n"}}
{"actor":{"display_login":"rueuntal"}}