Learn R Programming

EnviroStat (version 0.4-2)

sinterp: Fitting a thin-plate spline

Description

Function to compute coefficients for arbitrary dimension thinplate spline smooths, that is, smooth mappings from Rq to Rp.

Usage

sinterp(x, y, m = 2, lam = 0, lsq = FALSE)

Arguments

x
An $nq x nk$ matrix of knots, where nq = dimension of the domain space, and nk = the number of knots. Each column represents one knot. That is, the row dimension should be the dimension of the domain space, and the column dimension should be the number of knot points.
y
An $nq x nk$ matrix of function values at each knot point, where np = dimension of the image space. Each data set is a column. (Note that the row dimension of y is the number of knots which corresponds to the column dimension of x). (As returned by Falternate3.)
m
An integer such that $2*\code{m}$ is the order of the spline. The default value is 2.
lam
A vector of real smoothing parameters. If lam is missing or 0, sinterp performs interpolation.
lsq
if TRUE, subtract least squares fit from y, returning the polynomial coefficients as element b of the result

Value

Thin-plate spline solution; more details in Sampson-Guttorp (1992)
x
A copy of the x matrix argument passed to the function.
y
A copy of the y matrix argument.
m
A copy of the m argument.
lam
A copy of the lam argument.
lsq
A copy of the lsq argument.
b
If requested, this contains the coefficients of the least squares portion. Each column represents one y dataset, with the coefficients in the same order as in sol.
sol
A solution array. The first $n$ components are the coefficients of $u(x-x(i))$. The next $d+m-1$ choose $m-1$ components are the coefficients of the interpolating polynomial. These coefficients are ordered by increasing order of the total degree of the monomial. Within a group of monomials whose total degree is the same, the coefficient of monomial $i$ is before the coefficient of monomial $j$ if and only if $x(k)$ appears to a higher power in monomial $i$ than it does in monomial $j$ for some $k$ such that $x(k-l)$ is not in either monomial for any $l$. Example: if $m=3$ and $d=4$, the order of the polynomial coefficients will be: $1,x1,x2,x3,x4,x1^2,x1*x2,x1*x3,x1*x4,x2^2,x2*x3,x2*x4,x3^2,x3*x4,x4^2$ The above mess describes each column. The array is $len x ny x nlam$, where nlam is the number of lambda values, ny is the number of y data vectors, and len is the length of the vector described above. In the case that nlam equals 1 (the default), "sol" is returned as 2-dimensional $len x ny$ array without the third dimension.
ainf
A vector of informational integers for the factored "a" matrix. Zero's indicate everything is O.K.. If the i-th entry is $k$, then the $k$-th pivot block of the a matrix for the i-th lambda value is singular. In the last case, no solution will be computed.
linf
A vector of informational integers corresponding to the least squares solution(if requested). Zero's indicate no problems. If the i-th entry is $k$, then the $k$-th diagonal entry of the R matrix of the QR decomposition of the polynomial matrix is zero.
f
A copy of the factorial values calculated for various internal length determinations.
a
A copy of the internally generated factored "a" matrix.

References

Described in Sampson P.D., and Guttorp, P., "Nonparametric estimation of nonstationary spatial covariance structure", in Journal of the American Statistical Association, vol 87, pp 108-119, 1992.