# NOT RUN {
# Illustrates smart prediction
pneumo <- transform(pneumo, let = log(exposure.time))
fit <- vglm(cbind(normal, mild, severe) ~ poly(c(scale(let)), 2),
propodds, data = pneumo, trace = TRUE, x.arg = FALSE)
class(fit)
(q0 <- head(predict(fit)))
(q1 <- predict(fit, newdata = head(pneumo)))
(q2 <- predict(fit, newdata = head(pneumo)))
all.equal(q0, q1) # Should be TRUE
all.equal(q1, q2) # Should be TRUE
head(predict(fit))
head(predict(fit, untransform = TRUE))
p0 <- head(predict(fit, type = "response"))
p1 <- head(predict(fit, type = "response", newdata = pneumo))
p2 <- head(predict(fit, type = "response", newdata = pneumo))
p3 <- head(fitted(fit))
all.equal(p0, p1) # Should be TRUE
all.equal(p1, p2) # Should be TRUE
all.equal(p2, p3) # Should be TRUE
predict(fit, type = "terms", se = TRUE)
# }
Run the code above in your browser using DataLab