Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

How to convert a spatial map to a probability map in R?

$
0
0

I made a spatial map of the UK showing the estimated mean effect of a location variable ID for each city. See the image here (as i haven't enough reputation to post the image on here).

But is it possible to create a probability map of the UK so that I can see the probability of survival (i.e. the dependent variable y) given the ID variable for each city? Maybe a legend showing which city has higher probability based on colour.

My code uses the BayesX package to create a model X, such that

g<-(y ~x1 +x2 + +sx(ID,bs='mrf',map=UK) + r(ID))


X<-bayesx(g,family=binomial, method = "MCMC",iterations = 1000, burnin = 0, step = 20, seed = 123)

where sx(ID) is a non-linear spatial function for the variable ID (and r(ID) is a random effect) and the plot shows the mean effect of the structured term

plot(X, term = "sx(ID)", map = UK )

Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>