{"action":"created","issue":{"url":"https://api.github.com/repos/glmmTMB/glmmTMB/issues/295","repository_url":"https://api.github.com/repos/glmmTMB/glmmTMB","labels_url":"https://api.github.com/repos/glmmTMB/glmmTMB/issues/295/labels{/name}","comments_url":"https://api.github.com/repos/glmmTMB/glmmTMB/issues/295/comments","events_url":"https://api.github.com/repos/glmmTMB/glmmTMB/issues/295/events","html_url":"https://github.com/glmmTMB/glmmTMB/issues/295","id":293001246,"node_id":"MDU6SXNzdWUyOTMwMDEyNDY=","number":295,"title":"clarifying scale of dispersion model","user":{"login":"bbolker","id":78918,"node_id":"MDQ6VXNlcjc4OTE4","avatar_url":"https://avatars1.githubusercontent.com/u/78918?v=4","gravatar_id":"","url":"https://api.github.com/users/bbolker","html_url":"https://github.com/bbolker","followers_url":"https://api.github.com/users/bbolker/followers","following_url":"https://api.github.com/users/bbolker/following{/other_user}","gists_url":"https://api.github.com/users/bbolker/gists{/gist_id}","starred_url":"https://api.github.com/users/bbolker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbolker/subscriptions","organizations_url":"https://api.github.com/users/bbolker/orgs","repos_url":"https://api.github.com/users/bbolker/repos","events_url":"https://api.github.com/users/bbolker/events{/privacy}","received_events_url":"https://api.github.com/users/bbolker/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-01-31T01:36:38Z","updated_at":"2018-10-17T16:19:54Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"While working on offsets for the dispersion model I was a little surprised that the dispersion is modeled on the variance scale rather than the sd scale: i.e. on [line 91 of glmmTMB.cpp](https://github.com/glmmTMB/glmmTMB/blob/master/glmmTMB/src/glmmTMB.cpp#L591) we have\r\n\r\n```\r\nvector<Type> phi = exp(etad);\r\n```\r\nand on [line 691](https://github.com/glmmTMB/glmmTMB/blob/master/glmmTMB/src/glmmTMB.cpp#L600) we have\r\n```\r\n tmp_loglik = dnorm(yobs(i), mu(i), sqrt(phi(i)), true);\r\n```\r\nThere's nothing wrong with this, of course, but I would have thought the sd scale was more intuitive.\r\n\r\nAs long as we're on the subject:\r\n\r\n- gaussian: dispersion -> variance\r\n- gamma: dispersion -> shape parameter (this is consistent, at least: variance prop to dispersion)\r\n- beta: var prop to 1/dispersion\r\n- beta-binomial: similar but more complex\r\n\r\netc etc.\r\n\r\nAt the very least we should document all of this somewhere ... to the extent that we can, we should try to make it consistent across families, or at least predictable ...\r\n"},"comment":{"url":"https://api.github.com/repos/glmmTMB/glmmTMB/issues/comments/430694278","html_url":"https://github.com/glmmTMB/glmmTMB/issues/295#issuecomment-430694278","issue_url":"https://api.github.com/repos/glmmTMB/glmmTMB/issues/295","id":430694278,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDY5NDI3OA==","user":{"login":"bbolker","id":78918,"node_id":"MDQ6VXNlcjc4OTE4","avatar_url":"https://avatars1.githubusercontent.com/u/78918?v=4","gravatar_id":"","url":"https://api.github.com/users/bbolker","html_url":"https://github.com/bbolker","followers_url":"https://api.github.com/users/bbolker/followers","following_url":"https://api.github.com/users/bbolker/following{/other_user}","gists_url":"https://api.github.com/users/bbolker/gists{/gist_id}","starred_url":"https://api.github.com/users/bbolker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbolker/subscriptions","organizations_url":"https://api.github.com/users/bbolker/orgs","repos_url":"https://api.github.com/users/bbolker/repos","events_url":"https://api.github.com/users/bbolker/events{/privacy}","received_events_url":"https://api.github.com/users/bbolker/received_events","type":"User","site_admin":false},"created_at":"2018-10-17T16:19:54Z","updated_at":"2018-10-17T16:19:54Z","author_association":"CONTRIBUTOR","body":"FWIW  for `nbinom1` family,  var = mu*(1+phi) and `sigma()` returns phi; according to @mmaechler 's defs above, this should be sqrt(1+phi) instead ... ?"}}
{"actor":{"display_login":"bbolker"}}