[R-sig-Geo] residuals by subtracting point values from grid values

Tomislav Hengl T.Hengl at uva.nl
Tue Mar 24 15:26:48 CET 2009


Dear Else,

I've read your message twice, but I am still not sure what exactly you want to run: (1) which
prediction technique, (2) for which purpose (validation only?).

Using the krige.cv method, you can also run the cross validation for inverse distance interpolation
(note: you only need to omit the variogram):

> idw.zn.cv <- krige.cv(zinc~1, meuse, nfold=2)
[inverse distance weighted interpolation]
...

This is all explained in Edzer's paper on gstat:

Pebesma, E.J. 2004. Multivariable geostatistics in S: The gstat package. Computers and Geosciences
30: 683–91.
http://dx.doi.org/10.1016/j.cageo.2004.03.012 

see also pages 222-226 in Bivand et al. (2008) code available at:
http://www.asdar-book.org/book/geos_mod.R

here are some similar simple examples:

http://spatial-analyst.net/wiki/index.php?title=Spatial_prediction_of_soil_moisture 

HTH 

Tom Hengl


-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of
Els Verfaillie
Sent: Tuesday, March 24, 2009 3:00 PM
To: r-sig-geo at stat.math.ethz.ch
Subject: [R-sig-Geo] residuals by subtracting point values from grid values

Hi list,

 

I've splitted my dataset (e.g. the meuse dataset) into random 2 parts (2/3
for prediction and 1/3 for validation). I've done an interpolation (e.g.
IDW, but I also want to do it with different kriging techniques) based on
the prediction dataset. Now I want to subtract the "zinc" values from the
validation dataset (i.e. a SpatialPointsDataFrame with 52 points) from the
"var1.pred" values from the interpolation (i.e. a SpatialPointsDataFrame
with 3103 points) to obtain the residuals. This of course only on the
location of the 52 points from the validation dataset. Then I want to
calculate validation indices.

 

This is my code:

 

#Validation and prediction dataset

permid <- sample(155)

idportion <- 1:round(2*155/3)

meuse.pred <- meuse[permid[idportion], ] 

meuse.val <- meuse[permid[-idportion], ]

 

#idw based on meuse.pred

idw.pred.zn <- idw(zinc ~ 1, meuse.pred, meuse.grid)

 

I know that I could use the "krige.cv" to do an n-fold cross-validation, but
I would like to do it based on the above method.

 

Any suggestions? 

 

Thanks a lot!

 

Els 

 

______________________________________________

Dr. Els Verfaillie

Carto-GIS cluster

Ghent University (UGent) - Department of Geography

Krijgslaan 281 - S8  B- 9000 Gent  Belgium

______________________________________________






	[[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



More information about the R-sig-Geo mailing list