View source: R/glmrobPredict.R
predict.glmrob | R Documentation |
Obtains predictions and optionally estimates standard errors of those predictions from a fitted robust generalized linear model (GLM) object.
## S3 method for class 'glmrob'
predict(object, newdata = NULL,
type = c("link", "response", "terms"), se.fit = FALSE,
dispersion = NULL, terms = NULL, na.action = na.pass, ...)
object |
a fitted object of class inheriting from |
newdata |
optionally, a data frame in which to look for variables with which to predict. If omitted, the fitted linear predictors are used. |
type |
the type of prediction required. The default is on the
scale of the linear predictors; the alternative The value of this argument can be abbreviated. |
se.fit |
logical switch indicating if standard errors are required. |
dispersion |
the dispersion of the GLM fit to be assumed in
computing the standard errors. If omitted, that returned by
|
terms |
with |
na.action |
function determining what should be done with missing
values in |
... |
optional further arguments, currently simply passed to
|
If se = FALSE
, a vector or matrix of predictions.
If se = TRUE
, a list with components
fit |
Predictions |
se.fit |
Estimated standard errors |
residual.scale |
A scalar giving the square root of the dispersion used in computing the standard errors. |
Andreas Ruckstuhl
glmrob()
to fit these robust GLM models,
residuals.glmrob()
and other methods;
predict.lm()
, the method used for a non-robust fit.
data(carrots)
## simplistic testing & training:
i.tr <- sample(24, 20)
fm1 <- glmrob(cbind(success, total-success) ~ logdose + block,
family = binomial, data = carrots, subset = i.tr)
fm1
predict(fm1, carrots[-i.tr, ]) # --> numeric vector
predict(fm1, carrots[-i.tr, ],
type="response", se = TRUE)# -> a list
data(vaso)
Vfit <- glmrob(Y ~ log(Volume) + log(Rate), family=binomial, data=vaso)
newd <- expand.grid(Volume = (V. <- seq(.5, 4, by = 0.5)),
Rate = (R. <- seq(.25,4, by = 0.25)))
p <- predict(Vfit, newd)
filled.contour(V., R., matrix(p, length(V.), length(R.)),
main = "predict(glmrob(., data=vaso))", xlab="Volume", ylab="Rate")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.