interpSplines,GVector,GRaster-method {fasterRaster} | R Documentation |
Interpolate values at points to a GRaster using splines
Description
This function interpolates values in the data table of a "points" GVector
to a GRaster
using splines with Tykhonov regularization to avoid overfitting.
Usage
## S4 method for signature 'GVector,GRaster'
interpSplines(
x,
y,
field,
method = "bilinear",
lambda = NULL,
solver = "Cholesky",
xlength = NULL,
ylength = NULL,
interpolate = TRUE,
verbose = is.null(lambda)
)
Arguments
x |
A "points" |
y |
A |
field |
Character or integer or numeric integer: Name or index of the column in |
method |
Character: The method to use for interpolation can be either |
lambda |
Either |
solver |
Character: Type of solver to use. Can be either of |
xlength , ylength |
Either |
interpolate |
Logical: If |
verbose |
Logical: if |
Details
If you receive the error, "No data within this subregion. Consider increasing spline step values, try increasing the values of xlength
and ylength
.
If cross-validation takes too long, or other warnings/errors persist, you can randomly subsample x
to ~100 points to get an optimum value of lambda
(using interpolate = FALSE
), then use this value in the same function again without cross-validation (setting lambda
equal to this value and interpolate = TRUE
).
Value
Output depends on values of lambda
and interpolate
:
-
lambda
isNULL
andinterpolate
isTRUE
: AGRaster
with an attribute namedlambdas
. This is adata.frame
with values oflambda
that were assessed, plusmean
(mean residual value) andrms
(root mean square error). You can see the table usingattr(output_raster, "lambdas", exact = TRUE)
. -
lambda
isNULL
andinterpolate
isFALSE
: Adata.frame
with values oflambdas
that were assessed, plusmean
(mean residual value) andrms
(root mean square error). You can see the table usingattr(output_raster, "lambdas", exact = TRUE)
. -
lambda
is a number (interpolate
is ignored): AGRaster
.
See Also
interpIDW()
, fillNAs()
, GRASS tool v.surf.bspline
(see grassHelp("v.surf.bspline")
)