Learn R Programming

intamap (version 1.3-21)

interpolate: spatial interpolation

Description

interpolate is a function that interpolates spatial data

Usage

interpolate(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())

Arguments

observations
observation data, object of class SpatialPointsDataFrame. The observation to be interpolated has to be identified through the colum
predictionLocations
prediction locations, object of class SpatialPoints*, SpatialPixels* or
outputWhat
list with names what kind of output is expected, e.g. outputWhat = list(mean=TRUE,variance=TRUE, nsim = 5)
blockWhat
List defining particular output for block predictions. See createIntamapObject
obsChar
list with observation characteristics, used by some interpolation methods
methodName
name of interpolation method to be used, see spatialPredict for more details, or automatic, to let the method be decided by the program, based on maximumTime and type of variables
maximumTime
the maximum time available for interpolation, will be compared to the result of predictTime for the requested method, or for finding the best interpolation method
optList
list; further options, mainly passed to createIntamapObject as the argument params, directly as arguments, but some are used locally in i

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:
  • observationsthe observations, as a Spatial*DataFrame
  • predictionLocationsthe prediction locations, as a Spatial-object
  • formulaStringthe relationship between independent and dependent variables, value or obs used if not given
  • outputWhata list of the prediction types to return
  • anisParthe estimated anisotropy parameters
  • variogramModelthe estimated parameter for the method, can also be e.g. copulaParams for the copula method or inverseDistancePower for inverse distance power method.
  • methodParametersa 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.
  • predictionsa 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.var
  • outputTablea 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 outputWhat
  • processDescriptionsome textual descriptions of the interpolation process, including warnings

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

References

http://www.intamap.org/

See Also

createIntamapObject, estimateParameters, spatialPredict, intamap-package

Examples

Run this code
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))

Run the code above in your browser using DataLab