This is a user friendly method to compute predictions from GeDS objects.
# S3 method for GeDS
predict(object, newdata, type = c("response", "link", "terms"),
n = 3L, ...)
the GeDS-class
object for which the
computation of the predicted values is required.
an optional data.frame
, list
or environment
containing values
of the independent variables for which predicted values of the predictor model
(including the GeDS and the parametric components) should be computed.
If left empty the values are extracted from the object x
itself.
character string indicating the type of prediction required.
By default it is equal to "response"
, i.e. the result is on the scale of the response variable.
See details for the other options.
integer value (2, 3 or 4) specifying the order (\(=\) degree \(+ 1\)) of the GeDS fit
whose predicted values should be computed.
By default equal to 3L
.
Non-integer values will be passed to the function as.integer
.
potentially further arguments (required by the definition of the generic function.). They are ignored, but with a warning.
A numeric vector corresponding to the predicted values (if type = "link"
or
type = "response"
). If type = "terms"
a numeric matrix with a column per term.
This is a method for the function predict
that
allows the user to handle GeDS-Class
objects.
In analogy with the function predict.glm
in the stats package,
the user can specify the scale on
which the predictions should be computed through the argument type
.
If the predictions are required to be on the scale of the response variable, the user should set
type = "response"
, which is the default. Alternatively
if one wants the predictions to be on the predictor scale, it is necessary to set type = "link"
.
By specifying type = "terms"
, it is possible to inspect the predicted values
separately for each single independent variable which enter either the GeD spline
component or the parametric component of the predictor model.
In this case the returned result is a matrix whose columns correspond to the terms supplied
via newdata
or extracted from the object
.
As GeDS objects contain three different fits (linear, quadratic and cubic), it is possible
to specify the order
for which GeDS predictions are required via the input argument n
.