predict.robmixglm {robmixglm} | R Documentation |
Predict Method for robmixglm
Description
Obtains predictions from a fitted robust mixture generalized linear model object.
Usage
## S3 method for class 'robmixglm'
predict(object, newdata = NULL,
type = c("link", "response"), ...)
Arguments
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 |
... |
Other parameters. (not used) |
Details
If newdata
is omitted the predictions are based on the data
used for the fit. In that case how cases with missing values in the
original fit is determined by the na.action
argument of that
fit. If na.action = na.omit
omitted cases will not appear in
the residuals, whereas if na.action = na.exclude
they will
appear (in predictions and standard errors), with residual value
NA
. See also napredict
.
Value
A vector predicted linear predictors or response. For binomial
the
resonse is the predicted proportion.
Examples
library(MASS)
data(forbes)
forbes.robustmix <- robmixglm(100*log10(pres)~bp, data = forbes, cores = 1)
plot(forbes$bp, forbes$pres)
preddata <- data.frame(bp = seq(from = min(forbes$bp), to = max(forbes$bp), by = 0.01))
# convert to original scale
preddata$predpres <-10^(predict(forbes.robustmix, newdata = preddata)/100)
lines(preddata$bp, preddata$predpres, col = "red")