[R-sig-Geo] calculate SSerror in fit.variogram

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Jun 22 15:28:54 CEST 2012


> library(gstat)
Loading required package: sp
Loading required package: spacetime
Loading required package: zoo

Attaching package: ‘zoo’

The following object(s) are masked from ‘package:base’:

    as.Date, as.Date.numeric

Loading required package: xts
> loadMeuse()
> f = fit.variogram(variogram(zinc~1,meuse), vgm(1, "Sph", 900))
> attributes(f)
$names
[1] "model" "psill" "range" "kappa" "ang1"  "ang2"  "ang3"  "anis1" "anis2"

$row.names
[1] 1

$class
[1] "variogramModel" "data.frame"

$singular
[1] FALSE

$SSErr
[1] 5337300

> attr(f, "SSErr")
[1] 5337300

v = variogram(zinc~1,meuse)

> sum((v$np / (v$dist^2)) * (v$gamma - variogramLine(f, dist_vector =
v$dist)$gamma)^2)
[1] 5337300

so, by default, the weights for computing the weighted sum of squared
differences are dist/(h*h)

On 06/22/2012 03:16 PM, Saman Monfared wrote:
> Hi.
> I have used fit.variogram in gstat.
> How can I calculate SSerror between the sample variogram and the
> fitted variogram model in different estimation method of
> fit.method=2-7.
> 
> Thanks.
> 
> Saman Monfared
> Msc Student,
> Department of Statistics, Shiraz University,
> Shiraz 71454, Iran
> Email: Samanmonfared1 at gmail.com
> 
> Tel: +98 917 5305167
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> 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



More information about the R-sig-Geo mailing list