Hi Els,

I think you want to do:

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

and for kriging cross-validation:

krige.pred.zn <- krige(zinc ~ 1, meuse.pred, meuse.val,model = 
vgm(140000,"Sph",600,0.1))
krige.pred.zn$res = krige.pred.zn$var1.pred - meuse.val$zinc
krige.pred.zn$zscore = krige.pred.zn$res/sqrt(krige.pred.zn$var1.var)


You cannot do crossvalidation with meuse.grid, as you dont have zinc-observations in the data set. As Tom said, this is more or less the same as you can get a lot easier using krige.cv (with nfold=3), unless you are planning to recalculate the variogram for each fold.

Cheers,
Jon



Els Verfaillie wrote:
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
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to