Learn R Programming

schumaker (version 1.2.2)

impute_gradients: impute gradients from two vectors with x and y coordinates.

Description

impute gradients from two vectors with x and y coordinates.

Usage

impute_gradients(x, y, edgeGradients = c(NA, NA))

Arguments

x

A vector of x coordinates

y

A corresponding vector of y coordinates

edgeGradients

This gives the options of specifing the gradients at either edge of the domain. By default this is c(NA,NA) meaning that the defaults from the original paper are used. If this is set to c(0,NA) for instance this will mean that the left edge gradient is zero and the right edge gradient is as recommended in the original paper. This setting has no impact if a full set of gradients is input.

References

Schumaker, L.L. 1983. On shape-preserving quadratic spline interpolation. SIAM Journal of Numerical Analysis 20: 854-64.

Judd (1998). Numerical Methods in Economics. MIT Press

Examples

Run this code
x = seq(1,6)
y = log(x)
grads = impute_gradients(x, y)

Run the code above in your browser using DataLab