Extract the values of the model response from an object
response.Rd
Extract the values of the model response from an object of class “model”, “multimodel”, “cv” or a fitted model.
Usage
response(object, ...)
# S3 method for model
response(object, ...)
# S3 method for default
response(object, ...)
# S3 method for multimodel
response(object, ...)
# S3 method for cv
response(object, complete = FALSE, ...)
Arguments
- object
An object of class “model”, “multimodel” or “cv” or a fitted model.
- ...
Currently not used.
- complete
Logical: If
FALSE
, the output includes only the observations featuring exactly once in thefolds
(sorted by their position in the model data); otherwise, it returns the full vector.
Details
The default method applies response.model()
to model(object, ...)
.
The method for class “cv” with complete=FALSE
returns a vector of the same length as
cv_predict.cv(x)
and cv_resid.cv(x)
.
See also
cv_predict
(in particular, the examples), predict.model
.
Examples
response(lm(mpg ~., mtcars))
#> [1] 21.0 21.0 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 17.8 16.4 17.3 15.2 10.4
#> [16] 10.4 14.7 32.4 30.4 33.9 21.5 15.5 15.2 13.3 19.2 27.3 26.0 30.4 15.8 19.7
#> [31] 15.0 21.4