Extract Gradients
gradients.Rdgradients is a generic function which extracts gradients
from objects.
Usage
gradients(x, ...)
# S3 method for class 'condensity'
gradients(x, errors = FALSE, gradient.order = NULL, ...)
# S3 method for class 'condistribution'
gradients(x, errors = FALSE, gradient.order = NULL, ...)
# S3 method for class 'lsqregression'
gradients(x, errors = FALSE, gradient.order = NULL, ...)
# S3 method for class 'npregression'
gradients(x, errors = FALSE, gradient.order = NULL, ...)
# S3 method for class 'qregression'
gradients(x, errors = FALSE, ...)
# S3 method for class 'singleindex'
gradients(x, errors = FALSE, ...)Arguments
Object And Output Controls
Object to interrogate and whether gradient standard errors are requested.
- x
an object for which the extraction of gradients is meaningful.
- errors
a logical value specifying whether or not standard errors of gradients are desired. Defaults to
FALSE.
- gradient.order
for
npregression,condensity,condistribution, andlsqregressionobjects fitted withregtype="lp", optional derivative order request (scalar or one entry per continuous predictor). Fornpregression,condensity, andcondistribution, unavailable components whose order exceeds the fitted polynomial degree are returned asNAwhen another requested continuous component remains available. Forlsqregression, a supplied order must exactly identify the stored order; unavailable stored components remainNA, while any different requested order is rejected. If another derivative order is desired, compute the fit, prediction, or evaluation withgradients=TRUEand thatgradient.order;gradients()does not recompute derivatives after fitting.
Details
This function provides a generic interface for extraction of gradients
from objects. For npregression, condensity,
condistribution, and lsqregression objects fitted with
regtype="lp",
gradient.order identifies the stored continuous-predictor
derivative order to extract; it is not a post-fit recomputation control.
For lsqregression, the requested order must exactly match the stored
order. For qregression objects,
errors=TRUE returns
asymptotic standard errors for the quantile gradients when the object was
fitted with gradients=TRUE.
References
See the references for the method being interrogated via
gradients in the appropriate help file. For example, for
the particulars of the gradients for nonparametric regression see the
references in npreg
Author
Tristen Hayfield [email protected], Jeffrey S. Racine [email protected]
Note
This method currently only supports objects from the np library.