[R-sig-Geo] Simulation of multinomial classes covariate

TM amonleong at wanadoo.es
Thu May 5 16:29:58 CEST 2011


Hello everyone,

I am looking for a R code to simulate an spatial distribution of multinomial 
classes (like colors classes) in a map.

The problem is find a a multivariate distribution of the color classes 
(covariate: map colors) and a continous variable (like rain or ph) to study 
different kriging (cokriging) methodologies to make cross-validation 
predictions in order to test the effect on prediction which helps solve some 
of the data I now encounter.

Does somebody know, what to do in such a situation?
Does somebody know, what to do treat multinomial classes covariate in 
spacetime models using kriging?

I found this (DCluster package), but I am not sure if my way is wrong:

----------------------------------------------------------------------------------------------
 library(DCluster)

 library(boot)
 library(spdep)

 data(nc.sids)

 sids<-data.frame(Observed=nc.sids$SID74)
 sids<-cbind(sids, 
Expected=nc.sids$BIR74*sum(nc.sids$SID74)/sum(nc.sids$BIR74))
 sids<-cbind(sids, Population=nc.sids$BIR74, x=nc.sids$x, y=nc.sids$y)

 #K&N's method over the centroids
 mle<-calculate.mle(sids, model="poisson")
 knresults<-opgam(data=sids, thegrid=sids[,c("x","y")], alpha=.05,
+  iscluster=kn.iscluster, fractpop=.5, R=100, model="multinomial", mle=mle)

 #Plot all centroids and significant ones in red

 plot(sids$x, sids$y, main="Kulldorff and Nagarwalla's method")
 points(knresults$x, knresults$y, col="red", pch=19)
 dev.off()
-----------------------------------------------------------------------------

Thank you very much in advance! Any tips are appreciated much!

     cheers,

             Toni Monleón
              UB



More information about the R-sig-Geo mailing list