The INTAMAP system
About the R intamap package
The R intamap-package is the core of the computational back-end of the INTAMAP interpolation service. It is a package completely implemented in R [R Development Core Team, 2009]. The package is uploaded to the the Comprehensive R Network Archives (CRAN) (http://cran.r-project.org) where it can be easily downloaded directly from R.
The package includes the necessary supporting tools for spatial interpolation, some of the simpler interpolation methods, the spatial copula methods and the method for anisotropy detection. Although it was developed as the computational back-end of the INTAMAP WPS, it is a fully functional R-package with several new interpolation methods usueful also for the interactive user.
The core of the package, seen from the WPS-point of view, is the functions interpolate and interpolateBlock, which can perform automatic interpolation based on observations and predictionLocations (or only the number of locations). A range of prediction types are available (such as mean, variance, exceedance probabilities, cumulative distribution functions, quantiles, unbiased predictions, fraction above threshold and block max (the last two for block predictions), The methods can either be chosen by the user (automap, linearVariogram, idw, copula, localVariance), or be chosen automatically. The system will then try to optimize the prediction method based on the observations (whether they can be assumed to have a Gaussian distribution or not) and the time available for the prediction.
If the observations appear not to be Gaussian, the system will check if there is time enough for applying the spatial copula methods, as these are particularly designed for such applications. The estimation of prediction time is based on a set of prediction tests with a synthetic data set with variable number of observations and predictions. To have a time model that is correct for the architecture, it is necessary to start R (and install the intamap package) and run: > timeModels = generateTimeModels() and exit R while saving the timeModels: > q('yes') The time models will then be loaded the next time R is started in the same directory. There are default time models included in the intamap package, but these are only valid for the computer on which they were calculated. Generation of time models can be rather time consuming (hours - days), depending on the parameter nSam, which defines the number of examples for each combination of number of observation locations, prediction locations and prediction type. A larger number (e.g. nSam = 10) will reduce some of the randomness in the estimation of these time models.
The last remark is particularly related to the methods that are based on iterative search procedures for the best parameter set (copula and psgp). These search procedures are based on randomness, and the real prediction time can therefore deviate from the estimated prediction time.
If the observations come with observations characteristics (observations errors), the system will try the psgp method, if this method has been installed. For other cases, the system will rely on the interpolation methods in the automap package.
The interpolation process is basically divided into four different parts in the intamap package; pre-processing, parameter estimation, spatial prediction and post-processing. The pre-processing has a rather limited functionality in the current setup, whereas the post-processing is important for converting the R prediction to a format more useful for the WPS, and also for estimating other prediction types than mean and variance for the predictions assumed to have a normal distribution.
All the main functions in the intamap package can take a list object as an argument. This list object, below referred to as an intamap-object, will have class equal to the chosen prediction method. When a function is called, the method corresponding to the class will be dispatched, and the results will be added to the list object. This gives a simple interface to the functionality.
Other functions in the intamap package includes parameter estimation, different methods for block predictions, conversion of projections, a function for checking the setup of the intamap object, and a function that returns a string that makes it possible to rebuild the parameters for a certain method. The last one is useful for a WPS-call, to be able to reuse parameters in subsequent requests. The package also include simple plot and summary functions.
R Development Core Team (2009) R: A language and environment for statistical computing, R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0, URL http://www.R-project.org