interpolate is a function that interpolates spatial datainterpolate(observations, predictionLocations, outputWhat, obsChar = NA,
methodName = "automatic", maximumTime = 30, optList = list())
interpolateBlock(observations, predictionLocations, outputWhat,
blockWhat = "none", obsChar = NA, methodName = "automatic",
maximumTime = 30,
optList = list())SpatialPointsDataFrame.
The observation to be interpolated has to be identified through the
columSpatialPoints*, SpatialPixels* or outputWhat = list(mean=TRUE,variance=TRUE, nsim = 5)createIntamapObjectautomatic, to let
the method be decided by the program, based on maximumTime and type of variables predictTime
for the requested method, or for finding the best interpolation method
createIntamapObject
as the argument params, directly as arguments, but some are used
locally in iintamap-package.
The exact number and names of these elements might vary due to different methods applied,
but the list below shows the most typical:Spatial*DataFrameSpatial-objectvalue or obs used if not givencopulaParams
for the copula method or inverseDistancePower for inverse distance power method.Spatial*DataFrame with predictions, for most
methods with a format equal to the output from krige with
predicted mean and variance as var1.pred and var1.varoutputWhatinterpolate 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
doSNOW 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.=>createIntamapObject, estimateParameters,
spatialPredict, intamap-packagedata(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))Run the code above in your browser using DataLab