[R] boot strapping poisson getting warnings and negative values

Berend Hasselman bhh at xs4all.nl
Fri Aug 8 17:33:25 CEST 2014


On 08-08-2014, at 16:12, K Aravindhan <vind1971 at yahoo.co.in> wrote:

> Dear Team,
> I am getting this error while running the boot-strapping functions. 
> 

do you really have to post identical messages within 4 to 5 minutes?
One message is enough and be patient and wait!

Berend

> ==================================================
> 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 at 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.



More information about the R-help mailing list