Hi Moshood,

     For an introduction to cross-validation I would recommend "An 
Introduction to Statistical Learning, with Applications in R" (James, 
Witten, Hastie, Tibshirani - Springer 2013), section 5.1.

     This textbook is available for free online at 
http://www-bcf.usc.edu/~gareth/ISL/.


El 15/05/2014 17:39, Moshood Agba Bakare escribió:
> Hi Michele,
> I have similar problem. I used ordinary kriging and inverse distance 
> weighting method (IDW) to generate set of interpolated values from the 
> same interpolation grid. I don't understand how cross validation can 
> be done to come up with diagnostic statistics such as mse, rmse to use 
> as basis for identifying the best interpolation method. I used 
> krige.cv <http://krige.cv> but I encountered error message. Please any 
> advice on what to do please?
>
> ## Create grid for the interpolation through ordinary kriging and idw
>
> grid <- expand.grid(easting = seq(from = 299678, to = 301299, by=10),
> northing=seq(from = 5737278, to = 5738129, by=10))
>
>
> ## convert the grid to SpatialPixel class to indicate gridded spatial data
>
> coordinates(grid)<-~easting + northing
> proj4string(grid)<-CRS("+proj=utm +zone=12 +ellps=WGS84 +datum=WGS84 
> +units=m +no_defs +towgs84=0,0,0")
> gridded(grid)<- TRUE
>
> #### Ordinary kriging
>
> prok <- krige(id="yield",yield ~ 1, canmod.sp, newdata = grid, 
> model=exp.mod,nmax=20,maxdist=33.0)
>
> ## Inverse Distance Weighting (IDW) Interpolation method
>
> yield.idw = idw(yield~1, canmod.sp, grid,nmax=20,maxdist=33.0,idp=1)
>
>
> Thanks
> Moshood
>
>
>
> On Thu, May 15, 2014 at 9:23 AM, Michele Fiori 
> <mfiori@arpa.sardegna.it <mailto:mfiori@arpa.sardegna.it>> wrote:
>
>     Thank you for your kind reply
>     therefore as I have used the Osl method for regression, my result
>     will never
>     match the universal kriging; However, in order to validate my
>     method, I'm
>     trying to implement in the script a calculation loop witch runs n
>     times (the
>     number of stations) regression + kriging without one station at a
>     time.
>     Thank you again
>     Michele
>
>
>     -----Messaggio originale-----
>     Da: r-sig-geo-bounces@r-project.org
>     <mailto:r-sig-geo-bounces@r-project.org>
>     [mailto:r-sig-geo-bounces@r-project.org
>     <mailto:r-sig-geo-bounces@r-project.org>]
>     Per conto di rubenfcasal
>     Inviato: martedì 29 aprile 2014 19:49
>     A: r-sig-geo@r-project.org <mailto:r-sig-geo@r-project.org>
>     Oggetto: Re: [R-sig-Geo] Regression Kriging cross validation
>
>     Hello Michele,
>
>          Universal kriging is equivalent to Linear Regression (with the
>     generalized-least-squaresestimator) + Simple Kriging of residuals
>     (e.g.
>     Cressie, 1993, section 3.4.5). The differences you observe are
>     probably due
>     to the use of ordinary least squares. If you use (leave-one-out)
>     cross-validation with krige.cv <http://krige.cv> (considering the
>     UK model), the trend is also
>     re-estimated at each prediction location. From my point of view,
>     this would
>     be the recommended way to proceed.
>          As far as I know, there are no available implementations of the
>     procedure you are suggesting.
>
>          Best regards,
>              Rubén.
>
>
>     El 29/04/2014 13:33, Michele Fiori escribió:
>     > Hi everyone,
>     > I am working on rainfall interpolation using regression kriging
>     method
>     > and I need suggestions on how I can carry out a cross validation
>     > (leave-one-out) for this elaboration. At first I tried to apply
>     > directly Krige.cv, similarly to UK method (example for october:
>     > PP10uk.cv <- krige.cv <http://krige.cv>(reg, prec2, PP10.vgm)),
>     but unfortunately when I
>     > applied Universal Kriging on the same data, I realized that UK
>     map was a
>     little different from RK map.
>     > So my question is: How could I manage universal kriging in order to
>     > make it equivalent to regression kriging and use the above
>     > cross-validation, or is there another different method to apply
>     cross
>     > validation (leave-one-out) on Regression Kriging interpolation?
>     > Below my code:
>     > Many thanks
>     >
>     > Michele Fiori
>     >
>     > ARPAS - Environmental Protection Agency of Sardinia MeteoClimatic
>     > Department - Meteorological Service
>     >
>     > Viale Porto Torres 119 - 07100 Sassari, Italy Tel + 39 079
>     258617 <tel:%2B%2039%20079%20258617> Fax
>     > + 39 079 262681 <tel:%2B%2039%20079%20262681>
>     www.sardegnaambiente.it/arpas <http://www.sardegnaambiente.it/arpas>
>     >
>     > ####  Creating SpatialPixelDataFrame ("dem" - 250x250 m grid)
>     >       ....
>     > ####  Loading Precipitation data
>     >       prec2 <- read.table("prec2.txt", sep="\t", header =TRUE)
>     >       coordinates(prec2) <- c("x", "y")
>     >       proj4string(prec2) <- CRS("+init=epsg:32632")
>     > ####  Linear regression Model
>     >       mod.gen <- lm(PP10 ~ QUOTA_MARE + UTM_EST + UTM_NORD +
>     DIST_MARE,
>     > prec2)
>     >       step1 <- stepAIC(mod.gen, direction="both")
>     >       reg <- formula(step1)
>     >       PP10.lm <- lm(reg, prec2)
>     >       summary(PP10.lm)
>     >       prec2$residuals <- residuals(PP10.lm)
>     >       dem$predlm <- predict(PP10.lm, dem)
>     > ####  Variogram of residuals
>     >       PP10.vgm <- vgm(nugget=51.46, model="Sph", range=38038.89,
>     > psill=86.44)
>     > ####  Ordinary Kriging of residuals
>     >       PP10.okr <- krige(PP10.lm$residuals ~ 1, prec2, dem, PP10.vgm,
>     > maxdist=Inf)
>     >       dem$varokr <- PP10.okr$var1.pred
>     > ####  Regression Kriging (Linear Regression + Ordinary Kriging of
>     > residuals)
>     >       dem$vark <- dem$predlm + dem$varokr
>     > ####  Universal kriging
>     >       PP10.uk <- krige(reg, prec2, dem, PP10.vgm, maxdist=Inf)
>     >       dem$varuk <- PP10.uk$var1.pred
>     >       dem$difference <- dem$vark - dem$varuk
>     >       spplot(dem[c("difference")], col.regions=terrain.colors(25),
>     > contour=FALSE, cuts = 15)
>     >
>     > _______________________________________________
>     > R-sig-Geo mailing list
>     > R-sig-Geo@r-project.org <mailto:R-sig-Geo@r-project.org>
>     > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>     >
>
>     _______________________________________________
>     R-sig-Geo mailing list
>     R-sig-Geo@r-project.org <mailto:R-sig-Geo@r-project.org>
>     https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>     _______________________________________________
>     R-sig-Geo mailing list
>     R-sig-Geo@r-project.org <mailto:R-sig-Geo@r-project.org>
>     https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>


	[[alternative HTML version deleted]]

