computeTPRS: Create TPRS basis

View source: R/functions_tprs.R

computeTPRSR 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 rearrange is TRUE.

tprs

Matrix of TPRS basis values (from computeTPRS).

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. 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.

Value

An n-by-k matrix 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)

jpkeller/spconf documentation built on Oct. 20, 2024, 2 a.m.