[R-sig-Geo] imaging geoRglm binomial krig

Ken Nussear knussear at mac.com
Wed Mar 4 20:07:16 CET 2009


Hi

Wondering if anyone has had success imaging a krige produced  using  
geoRglm?

The dataset has 3467 locations....

Here is the code used to build the krige and attempted image.

itdsglm1 <- trend.spatial(~TRAN_LNTH + Maxent + HWYS_Dist2 + MDEP +   
pop, WMgeo.Sign)

itlsglm1 <- trend.spatial(~TRAN_LNTH + Maxent + HWYS_Dist2 + MDEP +   
pop, WMgeo.kriglocs)

kmod <- model.glm.control(trend.d = itdsglm1, trend.l = itlsglm1,  
cov.model = "exponential")

kprior <- prior.glm.control(beta.prior = "flat", sigmasq.prior =  
"fixed", sigmasq= 0.0307, phi.prior = "fixed", phi = 7748,  
phi.discrete = NULL, tausq.rel = 5.276)


bkcontrl <- mcmc.control(S.scale = .07, thin=40, phi.start= 7748,  
phi.scale = .2, burn.in=10)
kgout <- output.glm.control(sim.posterior=T, sim.predict=T,  
keep.mcmc.sim=T, inference=T, messages=T, quantile=c(0.25,0.5,0.975))


bkb <- binom.krige.bayes(WMgeo.Sign, locations = WMgeo.kriglocs 
$coords,  model= kmod, mcmc.input= bkcontrl, prior=kprior)

image(bkb, locations=WMgeo.kriglocs$coords,  
values.to.plot='simulation', number.col=1, messates=T)



image.glm.krige.bayes(bkb, locations=WMgeo.kriglocs$coords,  
values.to.plot=c("median"), number.col=1, coords.data=WMgeo.kriglocs 
$coords, x.leg=c(410312,561312), y.leg=c(3822651,3920651), messages=T)




I get the following errors and I can't figure out what it wants....


mapping the medians of the predictive distribution
Error in image.default(x = c(410311.919949, 411311.919949,  
412311.919949,  :
  dimensions of z are not length(x)(-1) times length(y)(-1)
In addition: Warning messages:
1: In if (coords.data) coords.data <- eval(attr(x, "data.locations")) :
  the condition has length > 1 and only the first element will be used
2: In matrix(values.loc, ncol = ny) :
  data length [3467] is not a sub-multiple or multiple of the number  
of rows [36]



Ken



More information about the R-sig-Geo mailing list