Skip to contents

Minimises \(\sum_i (y_i - f(x_i))^2 + \lambda J(f)\) with the bending energy J; the solution \(f(s) = a_0 + a_1 u + a_2 v + \sum_i w_i \phi(|s - x_i|)\), \(\phi(r) = r^2 \log(r) / (8\pi)\), solves the bordered system with \(K + \lambda I\) and \(P = (1, x)\) (Duchon 1977; Wahba 1990). lam = 0 interpolates. Equal to fields::Tps with the same lambda and scale.type = "unscaled".

Usage

ThinPlateSpline(x, y, lam = 0, newdata = NULL)

Arguments

x

Two-column matrix of knots.

y

Values.

lam

Smoothing parameter.

newdata

Optional two-column matrix of prediction locations.

Value

List with w, a, fitted, residuals, df (trace of the hat matrix), predicted, lam.

References

Duchon, J. (1977). Splines minimizing rotation-invariant semi-norms in Sobolev spaces. Constructive Theory of Functions of Several Variables, 85-100. Springer, Berlin.

Wahba, G. (1990). Spline Models for Observational Data. SIAM, Philadelphia.

Examples

P <- rbind(c(0, 0), c(1, 0), c(0, 1), c(1, 1), c(.5, .5))
ThinPlateSpline(P, c(0, 1, 1, 2, 1.5), newdata = rbind(c(.5, .5), c(.25, .75)))$predicted
#> [1] 1.500000 1.294285