Description Usage Arguments Details Value Author(s) See Also Examples
Obtains predictions from a cumulative link model.
1 2 3 4 5 |
object |
a fitted object of class inheriting from
|
newdata |
optionally, a data frame in which to look for variables
with which to predict. Note that all predictor variables should be
present having the same names as the variables used to fit the
model. If the response variable is present in |
se.fit |
should standard errors of the predictions be provided?
Not applicable and ignored when |
interval |
should confidence intervals for the predictions be
provided? Not applicable and ignored when |
level |
the confidence level. |
type |
the type of predictions. |
na.action |
function determining what should be done with missing
values in |
... |
further arguments passed to or from other methods. |
If newdata
is omitted and type = "prob"
a vector of
fitted probabilities are returned identical to the result from
fitted
.
If newdata
is supplied and the response
variable is omitted, then predictions, standard errors and intervals
are matrices rather than vectors with the same number of rows as
newdata
and with one column for each response class. If
type = "class"
predictions are always a vector.
If newdata
is omitted, the way missing values in the original fit are handled
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, standard
errors or interval limits), with residual value NA
. See also
napredict
.
If type = "cum.prob"
or type = "linear.predictor"
there
will be two sets of predictions, standard errors and intervals; one
for j and one for j-1 (in the usual notation) where j = 1, ..., J index
the response classes.
If newdata is supplied and the response variable is omitted, then
predict.clm
returns much the same thing as predict.polr
(matrices of predictions). Similarly, if type = "class"
.
If the fit is rank-deficient, some of the columns of the design matrix
will have been dropped. Prediction from such a fit only makes sense if
newdata is contained in the same subspace as the original data. That
cannot be checked accurately, so a warning is issued
(cf. predict.lm
).
A list containing the following components
fit |
predictions or fitted values if |
se.fit |
if |
upr, lwr |
if |
Rune Haubo B Christensen
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## simple model:
fm1 <- clm(rating ~ contact + temp, data=wine)
summary(fm1)
## Fitted values with standard errors and confidence intervals:
predict(fm1, se.fit=TRUE, interval=TRUE) # type="prob"
## class predictions for the observations:
predict(fm1, type="class")
newData <- expand.grid(temp = c("cold", "warm"),
contact = c("no", "yes"))
## Predicted probabilities in all five response categories for each of
## the four cases in newData:
predict(fm1, newdata=newData, type="prob")
## now include standard errors and intervals:
predict(fm1, newdata=newData, se.fit=TRUE, interval=TRUE, type="prob")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.