[R-sig-Geo] How to calculate R2 coefficient of determination for variogram ?

Edzer Pebesma edzer.pebesma at uni-muenster.de
Thu Sep 2 15:32:43 CEST 2010


It looks quite OK; I suspect however that instead of using
mean(s.v$gamma) for SSTot, for this mean the same weighting scheme
should have been used.
--
Edzer

On 09/02/2010 02:59 PM, kili at grf.rs wrote:
> 
> Hi list,
> 
> I'm not sure in my calculation of R2 coefficient of determination for
> variogram. Could someone check it, or give the better way.
> 
> Here is an example:
> 
> library(sp)
> library(gstat)
> 
> data(meuse)
> coordinates(meuse) <- ~x+y
> s.v<- variogram(log1p(zinc)~sqrt(dist), meuse)
> vr.fit <- fit.variogram(variogram(log1p(zinc)~sqrt(dist), meuse), vgm(0,
> "Exp", 300, 1))
> 
> ## SSErr is it summ of weighted squares of residuals ?
> (SSErr<-attr(vr.fit,"SSErr"))
> 
> ## SStot total sum of weighted squares
> 
> weig<-s.v$np/s.v$dist^2  #fit.method	 fitting method, used by gstat. The
> default method uses weights $N_h/h^2$ with $N_h$ the number of point pairs
> and $h$ the distance.
> 
> 
> (SStot<- sum(weig*(s.v$gamma-mean(s.v$gamma))^2)  )
> (R2<-1-SSErr/SStot    )    # R2 coefficient of determination
> 
> Best regards,
> Kili
> 
> _______________________________________________
> 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



More information about the R-sig-Geo mailing list