stcov {stopp} | R Documentation |
Create stcov
objects and interpolate spatio-temporal covariates on a regular grid
Description
This function interpolates the covariate values observed
at some observed sites to a regular grid. The imput object
should be either a matrix or a dataframe with four columns:
x
, y
, t
, and the covariate values, named as the
covariate later called in the model formula (see stppm
).
The interpolation is performed through Inverse Distance Weighting (IDW).
See the Details.
Usage
stcov(
x,
interp = TRUE,
nx = NULL,
mult = 1,
p = 81,
names = NULL,
verbose = FALSE
)
Arguments
x |
A data.frame with four columns, containing the spatio-temporal coordinates and the covariate values. |
interp |
Logical value indicating whether to interpolate the covariate
on a regular grid. Default to |
nx |
Number of coordinates to generate for each dimention.
The default is |
mult |
The multiplicand of the number of points in the default for |
p |
Power of IDW distances. |
names |
Factor string to name the covariate. |
verbose |
Default to FALSE. If TRUE, the elapsed minutes are printed. |
Details
The function builds a regular grid with equispaced values along the three
coordinates and interpolates the covariate values at the new locations.
The interpolation at a point location is performed
through the inverse-distance weighting smoothing procedure of the covariate
values
at their sampling locations
.
In such a case, the smoothed value at location
is
where the weight is the
-th element of the inverse
th powers
of distance,
with
the Euclidean distance from
to
.
Value
A stpm
object, to be imputed as list object in stppm
.
Author(s)
Nicoletta D'Angelo
See Also
Examples
set.seed(2)
df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15))
cov <- stcov(df, interp = FALSE)