Learn R Programming

np (version 0.40-13)

gradients: Extract Gradients

Description

gradients is a generic function which extracts gradients from objects.

Usage

gradients(x, ...)

## S3 method for class 'condensity': gradients(x, errors = FALSE, \dots)

## S3 method for class 'condistribution': gradients(x, errors = FALSE, \dots)

## S3 method for class 'npregression': gradients(x, errors = FALSE, \dots)

## S3 method for class 'qregression': gradients(x, errors = FALSE, \dots)

## S3 method for class 'singleindex': gradients(x, errors = FALSE, \dots)

Arguments

x
an object for which the extraction of gradients is meaningful.
...
other arguments.
errors
a logical value specifying whether or not standard errors of gradients are desired. Defaults to FALSE.

Value

  • Gradients extracted from the model object x.

Note

This method currently only supports objects from the np library.

Details

This function provides a generic interface for extraction of gradients from objects.

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

See Also

fitted, residuals, coef, and se, for related methods; np for supported objects.

Examples

Run this code
x <- runif(10)
y <- x + rnorm(10, sd = 0.1)
gradients(npreg(y~x, gradients=TRUE))

Run the code above in your browser using DataLab