[R] Prediction error for Ordinary Kriging

Jon Olav Skoien jon.skoien at jrc.ec.europa.eu
Fri Jan 7 14:15:13 CET 2011


Pearl,

You find the prediction error as the var1.var column in your result 
object, i.e., y in your script. For plotting:

spplot(y, 2)
or
spplot(y,"var1.var")

Jon



On 1/5/2011 9:28 PM, pearl may dela cruz wrote:
> Hi ALL,
>
> Can you please help me on how to determine the prediction error for ordinary
> kriging?Below are all the commands i used to generate the OK plot:
>
> rsa2<- readShapeSpatial("residentialsa", CRS("+proj=tmerc
> +lat_0=39.66666666666666 +lon_0=-8.131906111111112 +k=1 +x_0=0 +y_0=0
> +ellps=intl +units=m +no_defs"))
> x2<- readShapeSpatial("ptna2", CRS("+proj=tmerc +lat_0=39.66666666666666
> +lon_0=-8.131906111111112 +k=1 +x_0=0 +y_0=0 +ellps=intl +units=m +no_defs"))
> bb<- bbox(rsa2)
> cs<- c(1, 1)
> cc<- bb[, 1] + (cs/2)
> cd<- ceiling(diff(t(bb))/cs)
> rsa2_grd<- GridTopology(cellcentre.offset = cc,cellsize = cs, cells.dim = cd)
> getClass("SpatialGrid")
> p4s<- CRS(proj4string(rsa2))
> x2_SG<- SpatialGrid(rsa2_grd, proj4string = p4s)
> x2_SP<- SpatialPoints(cbind(x2$X, x2$Y))
> v<- variogram(log1p(tsport_ace) ~ 1, x2, cutoff=100, width=9)
> te<- fit.variogram(v,vgm(0.0437, "Exp", 26, 0))
> y<- krige(tsport_ace~1, x2, x2_SG, model = ve.fit)
> spplot(y, 1, col.regions = bpy.colors(100), sp.layout = list("sp.lines",as(rsa2,
> "SpatialLines"),no.clip = TRUE))
>
>   I'm looking forward to your response. Thanks.
>
> Best regards,
> Pearl dela Cruz
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list