interpolate {intamap} | R Documentation |
spatial interpolation
Description
interpolate
is a function that interpolates spatial data
Usage
interpolate(observations, predictionLocations,
outputWhat = list(mean = TRUE, variance = TRUE),
obsChar = NA, methodName = "automatic", maximumTime = 30,
optList = list(), cv = FALSE, ...)
interpolateBlock(observations, predictionLocations, outputWhat,
blockWhat = "none", obsChar = NA, methodName = "automatic",
maximumTime = 30,
optList = list(), ...)
Arguments
observations |
observation data, object of class |
predictionLocations |
prediction locations, object of class |
outputWhat |
list with names what kind of output is expected, e.g.
|
blockWhat |
List defining particular output for block predictions. See |
obsChar |
list with observation characteristics, used by some interpolation methods |
methodName |
name of interpolation method to be used, see spatialPredict for more details, or |
maximumTime |
the maximum time available for interpolation, will be compared to the result of |
optList |
list; further options, mainly passed to
|
cv |
If cross-validation should be done |
... |
other arguments to be passed to other functions |
Details
The functions interpolate
and interpolateBlock
are particularly implemented for being called by
a Web Processing Server (WPS), but they can also be used interactively. The only necessary
arguments are observations
and predictionLocations
. It is also recommended
to set outputWhat
, and blockWhat
if necessary. If outputWhat
contains nsim
, the return table will also contain a number of realisations,
for methods able to return simulations.
interpolate
can use different interpolation methods for the result. The function
will internally call the following functions which can be method specific.
An indication of available methods can be given by methods(estimateParameters)
or methods(spatialPredict)
.
The method can be set through the argument methodName
, or through the
built-in automatic selection method. There are different criteria that helps
in selecting the right method for a particular data set. There are four
methods that are available for the automatic choice:
automap
, psgp
(from the separate package psgp
)
copula
and transgaussian
are the possibilities.
First of all, if observation errors are present, the psgp
method is preferred.
If not, it is checked whether the data appear to deviate significantly from normality.
This is assumed to be the case if any of the tests below are TRUE:
test[1] = length(boxplot.stats(dataObs)$out)/length(dataObs) > 0.1 test[2] = fivenum(dataObs)[3] - fivenum(dataObs)[2] < IQR(dataObs)/3 test[3] = fivenum(dataObs)[4] - fivenum(dataObs)[3] < IQR(dataObs)/3 g = boxcox(dataObs ~ 1,lambda=seq(-2.5,2.5,len=101),plotit=FALSE)$y test[4] = g[71] < sort(g)[91]
where fivenum
defines the Tukey five number statistic and
IQR
finds the interquartile range of the data. If the minimum of
dataObs is <= 0, min(dataObs) + sdev(dataObs) is added to all values.
At last, the function calls predictTime
for an estimate of the
prediction time. If any of the tests above were true and the estimated prediction time
for copula
prediction is below maximumTime
, the copula
method is chosen. If any of the
tests were TRUE and the estimated prediction time is too long, transGaussian
kriging is chosen, as long as all values are above zero. If any of
the tests are true for a set of observations with negative or zero-values,
automap
is chosen, but a warning is issued.
The element methodParameters
in the object being returned is a string that makes it possible
to regenerate the variogram model or the copula parameters in createIntamapObject
.
This is particularly useful when the function is called through a WPS, when
the element with the estimated parameters cannot be preserved in a state
that makes it possible to use them for a later call to interpolate
.
The possibility
for doing parallel processing is enabled for some of the main methods.
To be able to take advantage of multiple CPUs on a computer, the package
doParallel
must be downloaded, additionally the parameter nclus must be set to
a value larger than 1. Parallel computation is not taken into account when
estimating the prediction times.
Value
An intamap object, which is a list with elements, see intamap-package
.
The exact number and names of these elements might vary due to different methods applied,
but the list below shows the most typical:
observations |
the observations, as a |
predictionLocations |
the prediction locations, as a |
formulaString |
the relationship between independent and dependent variables,
|
outputWhat |
a list of the prediction types to return |
anisPar |
the estimated anisotropy parameters |
variogramModel |
the estimated parameter for the method, can also be e.g. |
methodParameters |
a string, that when parsed, can be used to regenerate the variogram model or copula parameters. Useful for repeated calls to interpolate when it is not necessary to reestimate the parameters. |
predictions |
a |
outputTable |
a matrix, organized in a convenient way for the calling WPS;
first row: x-coordinates, second row: y-coordinates; further rows:
output elements as specified by |
processDescription |
some textual descriptions of the interpolation process, including warnings |
Author(s)
Edzer Pebesma
References
Pebesma, E., Cornford, D., Dubois, G., Heuvelink, G.B.M., Hristopulos, D., Pilz, J., Stohlker, U., Morin, G., Skoien, J.O. INTAMAP: The design and implementation f an interoperable automated interpolation Web Service. Computers and Geosciences 37 (3), 2011.
See Also
createIntamapObject
, estimateParameters
,
spatialPredict
, intamap-package
Examples
data(meuse)
coordinates(meuse) = ~x+y
meuse$value = meuse$zinc
data(meuse.grid)
gridded(meuse.grid) = ~x+y
x = interpolate(meuse, meuse.grid, list(mean=TRUE, variance=TRUE))
summary(t(x$outputTable))