computeTPRS {spconf} | R Documentation |
Create TPRS basis
Description
Compute TPRS basis for given spatial coordinates
Usage
computeTPRS(coords, maxdf, rearrange = TRUE, intercept = FALSE)
arrangeTPRS(tprs, intercept = FALSE)
Arguments
coords |
Data frame containing the coordinates. |
maxdf |
Largest number of splines to include in TPRS basis |
rearrange |
Logical indicator of whether to rearrange the columns of TPRS basis. |
intercept |
Logical indicator of whether or not to remove the intercept column from the basis when |
tprs |
Matrix of TPRS basis values (from |
Details
computeTPRS
creates a thin-plate regression spline (TPRS) basis from a two-dimensional set of coordinate locations using the mgcv
package.
The output from mgcv
is structured to have the linear terms as the last columns of the matrix. Use arrangeTPRS()
to arrange the matrix columns to be in order of increasing resolution. Specifically, it moves the last two columns to the left of the matrix and the third-from last column, which corresponds to the intercept, is optionally removed.
Value
An n
-by-k
matrix of spline basis functions where n
is the number of rows in coords
and k
is equal to maxdf
Examples
x <- runif(100)
y <- runif(100)
mat <- computeTPRS(data.frame(x, y), maxdf=4)