# [R-sig-Geo] Variogram models in gstat

Edzer Pebesma edzer.pebesma at uni-muenster.de
Sun Apr 18 19:22:33 CEST 2010

```Sidney, I'm taking the liberty to copy r-sig-geo in this.

the answer is in the C sources, I looked at
http://svn.52north.org/cgi-bin/viewvc.cgi/main/gstat/src/vario_fn.c?view=markup&root=geostatistics

copying the essential C snippets from the code:

Sidney Bernal wrote:
>
> Edzer Thanks, really helped me the link you sent me, but still need the mathematical formulas variogram of the following models:
>
> 5    Exc               Exclass (Exponential class)

1.0 - exp(-pow(h/r[0],r[1]))

> 6    Mat                              Mat (Matern)

1.0 - (pow(2.0, -(kappa - 1.0))/gammafn(kappa)) *
pow(hr, kappa) * bessel_k(hr, kappa, 1.0);

> 7    Ste Mat (Matern, M. Stein's parameterization)

bes = bessel_k(2.0 * sqrt(delta[1]) * h, delta[1], 1.0);
if (!isfinite(bes))
return 0.0;
if (bes == 0.0)
return 1.0;
mult = pow(2.0, 1.0 - delta[1]) / gammafn(delta[1]) *
pow((2.0 * sqrt(delta[1]) * h), delta[1]);
if (!isfinite(mult))
return 1.0;
return 1.0 - bes * mult;

> 13   Hol                                Hol (hole)

return 1.0 - sin(h/(*r))/(h/(*r));

> 16   Spl                              Spl (spline)

return h * h * log(h);
(I'm not sure this is a legal model)

> 17   Leg                            Leg (Legendre)

r2 = r[0] * r[0];
ang = h / (PI * 6378.137);
return 2.0 - (1.0 - r2)/(1 - 2.0 * r[0] * cos(ang) + r2);

These are all unit variogram models, and get multiplied by their partial
sill. r[0] is range, r[1] is kappa for the partial model defined in
vgm(). h is distance.

Good luck with your geostatistics course,
--
Edzer

>
>
>
>
>
>
>
>
>
>
> Sidney Bernal
>
>
>
>
>> Date: Sat, 17 Apr 2010 18:47:43 +0200
>> From: edzer.pebesma at uni-muenster.de
>> To: sidney86_115 at hotmail.com
>> CC: r-sig-geo at stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] Variogram models in gstat
>>
>> Most of them can be found on page 38 of http://www.gstat.org/gstat.pdf
>>
>> The Mat / Ste models are e.g. described in M. Stein, "Interpolation of
>> Spatial Data: Some Theory for Kriging", Springer.
>>
>> Let me know if there are further descriptions missing.
>> --
>> Edzer
>>
>> Sidney Bernal wrote:
>>>
>>> Good Morning
>>>
>>> Today I make a geostatistics course, so I'm using R 2.10.1 and I am writing to ask the please of the mathematical formulas of the 19 models of covariogram variogram programmed in the gstat package.
>>>
>>> short long
>>> 1 Nug Nug (nugget)
>>> 2 Exp Exp (exponential)
>>> 3 Sph Sph (spherical)
>>> 4 Gau Gau (gaussian)
>>> 5 Exc Exclass (Exponential class)
>>> 6 Mat Mat (Matern)
>>> 7 Ste Mat (Matern, M. Stein's parameterization)
>>> 8 Cir Cir (circular)
>>> 9 Lin Lin (linear)
>>> 10 Bes Bes (bessel)
>>> 11 Pen Pen (pentaspherical)
>>> 12 Per Per (periodic)
>>> 13 Hol Hol (hole)
>>> 14 Log Log (logarithmic)
>>> 15 Pow Pow (power)
>>> 16 Spl Spl (spline)
>>> 17 Leg Leg (Legendre)
>>> 18 Err Err (Measurement error)
>>> 19 Int Int (Intercept)
>>>
>>>
>>> Sidney Bernal
>>> sidney86_115 at hotmail.com
>>>
>>>
>>>
>>> Sidney Bernal
>>>
>>>
>>> _________________________________________________________________
>>>
>>>
>>> e=wlmailtagline
>>> [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> --
>> Edzer Pebesma
>> Institute for Geoinformatics (ifgi), University of Münster
>> Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
>> 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
>> http://www.52north.org/geostatistics e.pebesma at wwu.de
>
> _________________________________________________________________
> News, entertainment and everything you care about at Live.com. Get it now!
> http://www.live.com/getstarted.aspx

--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de

```