predictvglm(object, newdata = NULL,
type = c("link", "response", "terms"),
se.fit = FALSE, deriv = 0, dispersion = NULL,
untransform = FALSE, extra = object@extra, ...)
"vlm"
,
e.g., vglm
.
The alternative "response"
is on the
type = "link", se.fit = FALSE, deriv = 0
.predictvlm
.se.fit = FALSE
, a vector or matrix of predictions.
If se.fit = TRUE
, a list with componentsvglm
object.
This code implements smart prediction (see
smartpred
).
predict
,
vglm
,
predictvlm
,
smartpred
.# 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