Displaying 1 result from an estimated 1 matches for "sim_1".
Did you mean:
sim1
2012 May 03
1
overlapping confidence bands for predicted probabilities from a logistic model
...01 level
pred <- predict(mod1, newdata=data.frame(x=c(0,1)), se.fit=T)
with(pred, cbind(low = plogis(fit - 1.96*se.fit), est = plogis(fit), up = plogis(fit + 1.96*se.fit))) # confidence bands based on SEs
# simulation-based confidence bands:
sims <- t(replicate(200, coef(glm(simulate(mod1)$sim_1 ~ x, data=dat, family=binomial))))
pred0 <- plogis(quantile(sims%*%c(1,0), c(0.025, 0.5, 0.975)))
pred1 <- plogis(quantile(sims%*%c(1,1), c(0.025, 0.5, 0.975)))
rbind(pred0, pred1)
# the upper bound of the prediction for x=0 is greater than the lower bound of the prediction for x=1, using bo...