{"action":"created","issue":{"url":"https://api.github.com/repos/stan-dev/rstanarm/issues/109","repository_url":"https://api.github.com/repos/stan-dev/rstanarm","labels_url":"https://api.github.com/repos/stan-dev/rstanarm/issues/109/labels{/name}","comments_url":"https://api.github.com/repos/stan-dev/rstanarm/issues/109/comments","events_url":"https://api.github.com/repos/stan-dev/rstanarm/issues/109/events","html_url":"https://github.com/stan-dev/rstanarm/issues/109","id":167914293,"number":109,"title":"Offset sometimes doesn't work with posterior_predict","user":{"login":"jgabry","id":7796803,"avatar_url":"https://avatars.githubusercontent.com/u/7796803?v=3","gravatar_id":"","url":"https://api.github.com/users/jgabry","html_url":"https://github.com/jgabry","followers_url":"https://api.github.com/users/jgabry/followers","following_url":"https://api.github.com/users/jgabry/following{/other_user}","gists_url":"https://api.github.com/users/jgabry/gists{/gist_id}","starred_url":"https://api.github.com/users/jgabry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgabry/subscriptions","organizations_url":"https://api.github.com/users/jgabry/orgs","repos_url":"https://api.github.com/users/jgabry/repos","events_url":"https://api.github.com/users/jgabry/events{/privacy}","received_events_url":"https://api.github.com/users/jgabry/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/stan-dev/rstanarm/labels/minor%20bug","name":"minor bug","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-27T17:46:22Z","updated_at":"2016-07-27T17:50:59Z","closed_at":null,"body":"(Reported by Seth via email)\r\n\r\n```r\r\nlibrary(rstanarm)\r\nx1 = rnorm(100,0,.1)\r\nx2 = rnorm(100,2,.1)\r\ny = rnbinom(200,1,exp(c(x1,x2))/20)\r\ndata = data.frame(group=c(rep(1,100),rep(2,100)),x=c(x1,x2),y=y)\r\n\r\nM2 <-stan_glmer.nb(y ~ x + (1|group),data=data,iter=40,warmup=20,chains=1,offset=rep(0,200))\r\nprint(M2$stanfit)\r\npredictions0 = posterior_predict(M2) # ok \r\npredictions1 = posterior_predict(M2,data) #ok \r\n\r\npredictions2 = posterior_predict(M2,data[1:50,]) \r\nWarning message:\r\nIn sweep(eta, 2L, offset, `+`) :\r\n  STATS is longer than the extent of 'dim(x)[MARGIN]'\r\n```\r\n\r\n@bgoodri What seems to be the case is that `posterior_predict` tries to use the original offset used to fit the model. But not only does this not really make sense if `newdata` is specified, even \r\nif `newdata` is the same dataset as the original, if it's not the exact same size then we don't know which `offset` values to drop. \r\n\r\nShould add an `offset` argument to `posterior_predict` that is required if `newdata` is specified?"},"comment":{"url":"https://api.github.com/repos/stan-dev/rstanarm/issues/comments/235665291","html_url":"https://github.com/stan-dev/rstanarm/issues/109#issuecomment-235665291","issue_url":"https://api.github.com/repos/stan-dev/rstanarm/issues/109","id":235665291,"user":{"login":"bgoodri","id":3386282,"avatar_url":"https://avatars.githubusercontent.com/u/3386282?v=3","gravatar_id":"","url":"https://api.github.com/users/bgoodri","html_url":"https://github.com/bgoodri","followers_url":"https://api.github.com/users/bgoodri/followers","following_url":"https://api.github.com/users/bgoodri/following{/other_user}","gists_url":"https://api.github.com/users/bgoodri/gists{/gist_id}","starred_url":"https://api.github.com/users/bgoodri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgoodri/subscriptions","organizations_url":"https://api.github.com/users/bgoodri/orgs","repos_url":"https://api.github.com/users/bgoodri/repos","events_url":"https://api.github.com/users/bgoodri/events{/privacy}","received_events_url":"https://api.github.com/users/bgoodri/received_events","type":"User","site_admin":false},"created_at":"2016-07-27T17:50:59Z","updated_at":"2016-07-27T17:50:59Z","body":"Can `offset` default to 0 in `posterior_predict` and have it recycle?"}}
{"actor":{"display_login":"bgoodri"}}