{"action":"created","issue":{"url":"https://api.github.com/repos/lme4/lme4/issues/388","repository_url":"https://api.github.com/repos/lme4/lme4","labels_url":"https://api.github.com/repos/lme4/lme4/issues/388/labels{/name}","comments_url":"https://api.github.com/repos/lme4/lme4/issues/388/comments","events_url":"https://api.github.com/repos/lme4/lme4/issues/388/events","html_url":"https://github.com/lme4/lme4/issues/388","id":164400745,"number":388,"title":"bootMer results very different from predict result","user":{"login":"alireza202","id":6646274,"avatar_url":"https://avatars.githubusercontent.com/u/6646274?v=3","gravatar_id":"","url":"https://api.github.com/users/alireza202","html_url":"https://github.com/alireza202","followers_url":"https://api.github.com/users/alireza202/followers","following_url":"https://api.github.com/users/alireza202/following{/other_user}","gists_url":"https://api.github.com/users/alireza202/gists{/gist_id}","starred_url":"https://api.github.com/users/alireza202/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alireza202/subscriptions","organizations_url":"https://api.github.com/users/alireza202/orgs","repos_url":"https://api.github.com/users/alireza202/repos","events_url":"https://api.github.com/users/alireza202/events{/privacy}","received_events_url":"https://api.github.com/users/alireza202/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-07-07T20:32:54Z","updated_at":"2016-07-07T22:27:15Z","closed_at":null,"body":"I'm doing a multilevel negative binomial regression:\r\n```\r\nfit_model <- glmer.nb(formula = y ~ x + (x | item), data = =training)\r\n```\r\nand do the prediction for new data using:\r\n```\r\ntesting_results <- predict(object = fit_model, newdata = testing, type = 'response')\r\n```\r\nSince I need the prediction interval, I use bootMer:\r\n```\r\nboot <- lme4::bootMer(fit_model, \r\n                      function(x) predict(x, newdata = testing, re.form = NULL, type = 'response'), \r\n                      nsim = 200, \r\n                      use.u = FALSE, \r\n                      type = 'parametric', \r\n                      parallel = 'multicore', \r\n                      ncpus = 4)\r\n\r\ndata.frame(fit = apply(merBoot$t, 2, function(x) mean(x)),\r\n           lower = apply(merBoot$t, 2, function(x) as.numeric(quantile(x, probs=.05, na.rm=TRUE))),\r\n           upper = apply(merBoot$t, 2, function(x) as.numeric(quantile(x, probs=.95, na.rm=TRUE)))) -> PI.boot\r\n```\r\nNow when I plot the mean that I get from `bootMer` and the one from `predict`, they wildly differ. Here is an example:\r\n\r\n<img width=\"454\" alt=\"screen shot 2016-07-07 at 11 55 21 am\" src=\"https://cloud.githubusercontent.com/assets/6646274/16668616/99965e86-4446-11e6-9b88-ef31b5f0c0ee.png\">\r\n\r\nwhere red is the data, green is the prediction from `predict` function, blue is the prediction from `bootMer`, with the corresponding confidence interval. Left of the dotted line was the training, and right side is the testing. Am I doing something wrong here? I tried doing the same thing with poisson regression, and got the same result."},"comment":{"url":"https://api.github.com/repos/lme4/lme4/issues/comments/231226622","html_url":"https://github.com/lme4/lme4/issues/388#issuecomment-231226622","issue_url":"https://api.github.com/repos/lme4/lme4/issues/388","id":231226622,"user":{"login":"alireza202","id":6646274,"avatar_url":"https://avatars.githubusercontent.com/u/6646274?v=3","gravatar_id":"","url":"https://api.github.com/users/alireza202","html_url":"https://github.com/alireza202","followers_url":"https://api.github.com/users/alireza202/followers","following_url":"https://api.github.com/users/alireza202/following{/other_user}","gists_url":"https://api.github.com/users/alireza202/gists{/gist_id}","starred_url":"https://api.github.com/users/alireza202/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alireza202/subscriptions","organizations_url":"https://api.github.com/users/alireza202/orgs","repos_url":"https://api.github.com/users/alireza202/repos","events_url":"https://api.github.com/users/alireza202/events{/privacy}","received_events_url":"https://api.github.com/users/alireza202/received_events","type":"User","site_admin":false},"created_at":"2016-07-07T22:27:15Z","updated_at":"2016-07-07T22:27:15Z","body":"Here is the RData file with a smaller set of the training and testing data, along with the R code:\r\n\r\n[bootMer_issue.zip](https://github.com/lme4/lme4/files/353165/bootMer_issue.zip)\r\n\r\nI got a few warnings while running `glmer.nb` and `bootMer` commands, that I didn't get with the full data set. It might be that there are fewer items in the sample."}}
{"actor":{"display_login":"alireza202"}}