|
Home Download R/S-plus What's new Manual Examples Screenshots Mailing lists Qt GUI front end Idrisi32 front end PCRaster support GRASS support links Known bugs |
The gstat R package and S-Plus library: multivariable geostatistics for SIntroductionThe S port of gstat (R package, S-Plus library) is now available. It provides the essential parts of gstat functionality to S users, aside from the added bonus of being in a very rich environment. See below for the source trees. New features to S users are the combination of
ReferenceIf you use the gstat S package/library for your publications, you can do me a favour by using the following reference:Pebesma, Edzer J, 2004. Multivariable geostatistics in S: the gstat package. Computers & Geosciences, 30: 683-691Note that in this publication, all forward quotes ' were erroneously replaced by back-quotes `. Interfacegstat uses two formulae to define the (universal kriging) regression model and spatial locations. A sample run is:# calculate sample variogram: v <- variogram(log(zinc) ~ 1, locations = ~ x + y, data = meuse) # fit a model to sample variogram: v.fit <- fit.variogram(v, model = vgm(1, "Sph", 900, 1)) # plot both: plot(v, model = v.fit) # view result # use ordinary kriging on a regular grid, in meuse.grid: z <- krige(formula = log(zinc) ~ 1, locations = ~ x + y, data = meuse, newdata = meuse.grid, model = v.fit) # view ordinary kriging prediction and prediction error levelplot(var1.pred ~ x + y, z, aspect=mapasp(z), main = "ordinary kriging prediction") # view result levelplot(sqrt(var1.var) ~ x + y, z, aspect=mapasp(z), main = "ordinary kriging prediction error") # view resultThe linear model for the data is in the first formula: log(zinc) ~ 1means that log-zinc values are modelled as an intercept (unknown constant mean) and an intrinsically stationary residual; the second formula ~ x + ydefines the spatial coordinates for the observations, found in the same data set. Note that data and newdata need to be defined to find the regressors and spatial coordinates of the observed variable (data) and of the prediction locations (newdata). Alternatively, ~ x + y + zis used for three-dimensional data, and ~ xfor one-dimensional data. DocumentationDocumentation (printed R manual pages) are available (pdf, dvi).ExamplesAn example R script shows how most of the 17 original gstat examples are done in R, with links to the graphics. In the package they are the output of the commanddemo(examples)and works in S-Plus (6.1) as well, if preceded by:
data <- function(x) { } # make empty function
meuse <- meuse # make locally modifyable copy
Examples of gstat, used within R on top of grass can be found in
demo(grass)but it requires the meuse data base to be a grass data base. This link provides such a data base (grass5). Feature list
Installation instructionsR is easy: read help(INSTALL) within R to find out how to install packages from source code.the gstat S-Plus library (unix, >= 6.0) requires a few steps:
Install on R for Windows:A compiled version of gstat is on CRAN. To install it on a connected computer, start R, choose from the menu: Packages, Install from CRAN, and choose gstat. Alternatively (if you're not connected) download gstat.zip from here, and install: start R, choose Packages, Install from local zip file, and enter the location of gstat.zip on your computer.Install on S-Plus 6.0 or 6.1 for Windows
Download source tree:The current gstat R package in source form is available from CRAN; try this link . Download he source tree for the
Last modified: January 24, 2005 Page contents by Edzer J. Pebesma, page layout by Kor de Jong. Send comments. |