How to plot / map Spatial Random Effects in R?

0

I am working with visceral leishmaniasis data in census tracts of a Brazilian municipality. I circled a Baysian (CAR conditional autoregressive model) BYM model of the CARBayes package in software R. However, I am not able to visualize and export Spatial Random Effects. Could someone help me with this? Very obgda.

modelbym1 <- S.CARbym(formula = eq1, data = spat.data,   
                family = "poisson", W = W2, burnin = 100000,  
                n.sample = 300000, thin = 20) 
    
asked by anonymous 15.10.2018 / 07:14

1 answer

0

The code to export random spatial effects is:

pmean = apply(modelbym1$samples$psi,2,mean) 
write.csv(pmean, file = "pmean.csv") 

So just do a join with ".shp" because the values are exported in the same order as the original data.

    
10.01.2019 / 02:12