Displaying 1 result from an estimated 1 matches for "newdata0".
Did you mean:
newdata
2008 Dec 16
1
Prediction intervals for zero inflated Poisson regression
...t;- resid(fm_zip, type = "pearson")
VarComp <- resid(fm_zip, type = "response") / Pearson
fem <- bioChemists$fem
bootstrap <- replicate(999, {
yStar <- pmax(round(fit + sample(Pearson) * VarComp, 0), 0)
predict(zeroinfl(yStar ~ fem | 1), newdata = newdata)
})
newdata0 <- newdata
newdata0$fit <- predict(fm_zip, newdata = newdata, type = "response")
newdata0[, 3:4] <- t(apply(bootstrap, 1, quantile, c(0.025, 0.975)))
newdata0$model <- "Zero inflated"
#compare the intervals in a nice plot.
newdata <- rbind(newdata, newdata0)
libr...