gstat (version 2.1-0)

vgm: Generate, or Add to Variogram Model


Generates a variogram model, or adds to an existing model. print.variogramModel prints the essence of a variogram model.


vgm(psill = NA, model, range = NA, nugget,, anis, kappa = 0.5, ..., covtable,
	Err = 0)
# S3 method for variogramModel
print(x, ...)
# S3 method for variogramModel
plot(x, cutoff, ..., type = 'l')


If a single model is passed, an object of class variogramModel

extending data.frame.

In case a vector ofmodels is passed, an object of class variogramModelList which is a list of variogramModel


When called without a model argument, a data.frame with available models is returned, having two columns: short (abbreviated names, to be used as model argument: "Exp", "Sph" etc) and long (with some description).

as.vgm.variomodel tries to convert an object of class variomodel (geoR) to vgm.



(partial) sill of the variogram model component, or model: see Details


model type, e.g. "Exp", "Sph", "Gau", "Mat". Calling vgm() without a model argument returns a data.frame with available models.


range parameter of the variogram model component; in case of anisotropy: major range


smoothness parameter for the Matern class of variogram models


nugget component of the variogram (this basically adds a nugget compontent to the model); if missing, nugget component is omitted

the variogram model to which we want to add a component (structure)


anisotropy parameters: see notes below


a variogram model to print or plot


arguments that will be passed to print, e.g. digits (see examples), or to variogramLine for the plot method


if model is Tab, instead of model parameters a one-dimensional covariance table can be passed here. See covtable.R in tests directory, and example below.


numeric; if larger than zero, the measurement error variance component that will not be included to the kriging equations, i.e. kriging will now smooth the process Y instead of predict the measured Z, where Z=Y+e, and Err is the variance of e


object of class variomodel, see geoR


maximum distance up to which variogram values are computed


plot type


Edzer Pebesma


If only the first argument (psill) is given a character value indicating a model, as in vgm("Sph"), then this taken as a shorthand form of vgm(NA,"Sph",NA,NA), i.e. a spherical variogram with nugget and unknown parameter values; see examples below. Read fit.variogram to find out how NA variogram parameters are given initial values for a fitting a model, based on the sample variogram. Package automap gives further options for automated variogram modelling.


Pebesma, E.J., 2004. Multivariable geostatistics in S: the gstat package. Computers and Geosciences, 30: 683-691.

Deutsch, C.V. and Journel, A.G., 1998. GSLIB: Geostatistical software library and user's guide, second edition, Oxford University Press.

For the validity of variogram models on the sphere, see Huang, Chunfeng, Haimeng Zhang, and Scott M. Robeson. On the validity of commonly used covariance and variogram functions on the sphere. Mathematical Geosciences 43.6 (2011): 721-733.

See Also

show.vgms to view the available models, fit.variogram, variogramLine, variogram for the sample variogram.


Run this code
vgm(NA, "Sph", NA, NA)
vgm(, "Sph") # "Sph" is second argument: NO nugget in this case
vgm(10, "Exp", 300)
x <- vgm(10, "Exp", 300)
vgm(10, "Nug", 0)
vgm(10, "Exp", 300, 4.5)
vgm(10, "Mat", 300, 4.5, kappa = 0.7)
vgm( 5, "Exp", 300, = vgm(5, "Exp", 60, nugget = 2.5))
vgm(10, "Exp", 300, anis = c(30, 0.5))
vgm(10, "Exp", 300, anis = c(30, 10, 0, 0.5, 0.3))
# Matern variogram model:
vgm(1, "Mat", 1, kappa=.3)
x <- vgm(0.39527463, "Sph", 953.8942, nugget = 0.06105141)
print(x, digits = 3);
# to see all components, do
vv=vgm(model = "Tab",  covtable = 
	variogramLine(vgm(1, "Sph", 1), 1, n=1e4, min = 0, covariance = TRUE))
vgm(c("Mat", "Sph"))
vgm(, c("Mat", "Sph")) # no nugget

Run the code above in your browser using DataCamp Workspace