On 04/08/2013 11:11 PM, Edzer Pebesma wrote: > > > On 04/08/2013 08:12 PM, Saman Monfared wrote: >> Dear All, >> We know that the estimation of covariance parameters is an important >> problem for spatial processes because the variogram shows the spatial >> variation. In many cases to select the best variogram model some >> parametric models considered and some criterions such as mean >> prediction error, mean square error, correlation between the observed >> and predicted values and correlation between the predicted and the >> residual values in cross validation method uses to select the best >> variogram model. >> >> Below codes get an example whit two variogram models which are have >> very different parameters (sill, range and nugget) but values of >> mentioned criterions are approximately equal for them. >> Why? >> What is the role of variogram? >> What is the role of empirical variogram when a variogram function >> which is so far away than it can has approximately equaled cross >> validation results. >> >> library(gstat) >> data(meuse) >> coordinates(meuse)<-~x+y >> v<-variogram(log(zinc)~1,meuse) >> v.f<-fit.variogram(v,vgm(.205,"Mat",700,0.008,kappa=1)) >> plot(v,v.f) >> v.ff<-fit.variogram(v,vgm(.205,"Mat",700,0.008,kappa=1) >> ,fit.sills =F, fit.ranges =F) >> plot(v,v.ff) >> k1<-krige.cv(log(zinc)~1,meuse,v.f) >> k2<-krige.cv(log(zinc)~1,meuse,v.ff) >> mean(k1$residual) >> mean(k2$residual) >> mean(k1$residual^2) >> mean(k2$residual^2) >> cor(k1$var1.pred,k1$observed) >> cor(k2$var1.pred,k2$observed) >> cor(k1$var1.pred,k1$residual) >> cor(k2$var1.pred,k2$residual) >> >> Best, >> Saman. > > Because the ratio of the two models, > > v1 = variogramLine(v.f, 500) > v2 = variogramLine(v.ff, 500) > plot(v1[,1], v1[,2]/v2[,2]) > > is fairly constant. > > If a variogram model gets multiplied by a positive constant, the kriging > predictions will remain identical: > > v.fff = v.ff > v.ff$psill = v.ff$psill * 1234 # or any pos. number
I meant, of course: v.fff$psill <- v.fff$psill * 1234 # or any pos. number k3 <- krige.cv(log(zinc)~1,meuse,v.fff) which leads to > summary(k3$var1.pred-k2$var1.pred) Min. 1st Qu. Median Mean 3rd Qu. Max. -3.020e-14 -9.326e-15 0.000e+00 -1.490e-16 7.994e-15 3.286e-14 i.e., essentially zeros: > all.equal(k3$var1.pred, k2$var1.pred) [1] TRUE > k3 <- krige.cv(log(zinc)~1,meuse,v.fff) > summary(k3$var1.pred-k2$var1.pred) > Min. 1st Qu. Median Mean 3rd Qu. Max. > 0 0 0 0 0 0 > -- 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.pebe...@wwu.de _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo