View source: R/functions_tprs.R
computeTPRS | R Documentation |
Compute TPRS basis for given spatial coordinates
computeTPRS(coords, maxdf, rearrange = TRUE, intercept = FALSE)
arrangeTPRS(tprs, intercept = FALSE)
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 |
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. arrangeTPRS()
to arrange the matrix columns to be in order of increasing resolution. Specifically, it function 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.
An n
-by-k
matrix where n
is the number of rows in coords
and k
is equal to maxdf
x <- runif(100)
y <- runif(100)
mat <- computeTPRS(data.frame(x, y), maxdf=4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.