Team, I am giving the exact code that produces the error. Please see below. Can anyone please help ?
Thanks Aravindhan PROGRAM ------------------------------------------------------------------------------------------- rm(list = ls()) x<-c(1,14,49,26,4,10,25,36,79,15) y<-c(1,5,32,8,4,23,399,79,341,2) db = data.frame(x,y) library(car) db = data.frame(x,y) print("---------------------------------------------------------==") summary(m1 <- glm(y~0+x, family = poisson())) mod.db.hub<-glm(y~0+x,family="poisson",data=db) fit<-fitted(mod.db.hub) e<-residuals(mod.db.hub) X<-model.matrix(mod.db.hub) boot.huber.fixed<-function(data,indices,maxit=20) { Y<-fit+e[indices] mod<-glm(Y~X+0,family="poisson",maxit=maxit) coefficients(mod) } library(boot) db.fix.boot<-boot(db,boot.huber.fixed,2000,maxit=20) db.fix.boot boot.ci(db.fix.boot,index=1,type=c("bca","perc","poisson")) ---------------------------------------------------------------------------------------- The error I get is ------------------------------------------------------------------------------------------ > db.fix.boot<-boot(db,boot.huber.fixed,2000,maxit=20) Error in eval(expr, envir, enclos) : negative values not allowed for the 'Poisson' family In addition: Warning messages: 1: In dpois(y, mu, log = TRUE) : non-integer x = 1.002114 2: In dpois(y, mu, log = TRUE) : non-integer x = 4.050746 3: In dpois(y, mu, log = TRUE) : non-integer x = 44.219309 4: In dpois(y, mu, log = TRUE) : non-integer x = 7.786340 5: In dpois(y, mu, log = TRUE) : non-integer x = 3.189963 6: In dpois(y, mu, log = TRUE) : non-integer x = 10.348190 7: In dpois(y, mu, log = TRUE) : non-integer x = 56.408862 8: In dpois(y, mu, log = TRUE) : non-integer x = 27.751783 9: In dpois(y, mu, log = TRUE) : non-integer x = 480.383098 10: In dpois(y, mu, log = TRUE) : non-integer x = 2.497504 > db.fix.boot Error: object 'db.fix.boot' not found > boot.ci(db.fix.boot,index=1,type=c("bca","perc","poisson")) Error in boot.ci(db.fix.boot, index = 1, type = c("bca", "perc", "poisson")) : object 'db.fix.boot' not found ------------------------------------------------------------------------------------------ -----Original Message----- From: Aravindhan, K Sent: Saturday, November 15, 2014 7:59 AM To: r-help@r-project.org Subject: RE: [R] boot strapping poisson getting warnings and negative values Team, Has anyone looked at this question from me ? it will help me immensely if someone can provide an answer to this. Thanks Aravindhan -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of K Aravindhan Sent: Friday, August 08, 2014 7:42 PM To: r-help@r-project.org Subject: [R] boot strapping poisson getting warnings and negative values Dear Team, I am getting this error while running the boot-strapping functions. ================================================== mod.db.hub<-glm(TOTAL~1+IPD,family="poisson",data=db) fit<-fitted(mod.db.hub) e<-residuals(mod.db.hub) X<-model.matrix(mod.db.hub) boot.huber.fixed<-function(data,indices,maxit=20) { Y<-fit+e[indices] mod<-glm(Y~X-1,family="poisson",maxit=maxit) coefficients(mod) } library(boot) db.fix.boot<-boot(db,boot.huber.fixed,2000,maxit=20) db.fix.boot boot.ci(db.fix.boot,index=1,type=c("bca","perc","poisson")) boot.ci(db.fix.boot,index=2,type=c("bca","perc","poisson")) ================================================== Error in eval(expr, envir, enclos) : negative values not allowed for the 'Poisson' family In addition: Warning messages: 1: In dpois(y, mu, log = TRUE) : non-integer x = 25.006412 2: In dpois(y, mu, log = TRUE) : non-integer x = 26.969411 3: In dpois(y, mu, log = TRUE) : non-integer x = 66.352323 4: In dpois(y, mu, log = TRUE) : non-integer x = 61.083519 5: In dpois(y, mu, log = TRUE) : non-integer x = 20.596770 6: In dpois(y, mu, log = TRUE) : non-integer x = 43.428258 7: In dpois(y, mu, log = TRUE) : non-integer x = 1108.263554 8: In dpois(y, mu, log = TRUE) : non-integer x = 61.937982 9: In dpois(y, mu, log = TRUE) : non-integer x = 419.991213 10: In dpois(y, mu, log = TRUE) : non-integer x = 47.369133 Can you explain to me how to get rid of these ? Thanks Aravindhan ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.