[R-sig-Geo] problem in cokriging plot
Saman Monfared
samanmonfared1 at gmail.com
Wed Jan 11 11:30:55 CET 2012
Hi.
I have some problems in prediction of cokriging
1)- I don't know how make a grid for prediction, I have a polygone and I select
3000 points into this polygone. I want make grid like "meuse.grid"
nc.sids <- readShapePoly("City Boundary.shp")
pts <- spsample(nc.sids, n=3000, type="regular")
grd<-data.frame(pts)
grided(grd)~c("x","y")
2)- I have problem for predict and plot results of cokriging:
coordinates(dd) = ~x+y
m<-vgm( 0.22493303,"Gau",78006.24,0,cutoff=100607.2, width = 100607.2/12)
g <- gstat(NULL, id = " B", form = B ~1,data=dd,fill.cross = F)
g <- gstat(g, id = "A", form = A~1,data=dd,fill.cross = F)
g <- gstat(g, id = "T", form = T~ 1,data=dd,fill.cross = F)
vm <- variogram(g,covariance=F)
plot(vm)
vm.fit <- fit.lmc(vm, g, model=m,fit.ranges =F)
plot(vm, vm.fit)
z<-predict(vm.fit,grd)
R output:
Error in function (classes, fdef, mtable) :
unable to find an inherited method for function "proj4string", for
signature "data.frame"
when I use
pts <- spsample(nc.sids, n=3000, type="regular")
grd <- as(pts, "SpatialPixels")
grided(grd)~c("x1","x2")
.
.
.
z<-predict(vm.fit,grd)
and when I use
spplot(z,contour=T)
it is plot not all of predictions and thier variances only plot some of them.
when I want plot predictions or covariances
image(z["B.var"],col = "beige")
R output is:
Error in `[.data.frame`(x at data, i, j, ..., drop = FALSE) :
undefined columns selected
how can I plot all three prediction variables and thier variances????
More information about the R-sig-Geo
mailing list