<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div id="yui_3_16_0_1_1416662401672_34812"><span></span></div><div id="yui_3_16_0_1_1416662401672_34811"> </div><div id="yui_3_16_0_1_1416662401672_34801" class="signature"><div id="yui_3_16_0_1_1416662401672_34810" align="left">Paz</div><div id="yui_3_16_0_1_1416662401672_34809" align="left"> e Bem !!</div><div id="yui_3_16_0_1_1416662401672_34806" align="left"> </div><div id="yui_3_16_0_1_1416662401672_34853" align="left"><br></div><div id="yui_3_16_0_1_1416662401672_34854" dir="ltr" align="left">estou com o seguinte codigo, para modelos CAR com dados de contagem (Poisson)<br></div><div id="yui_3_16_0_1_1416662401672_34855" dir="ltr" align="left">e gostaria de plotar no grid criado um grafico em tom de cinza</div><div id="yui_3_16_0_1_1416662401672_34858" dir="ltr" align="left">com os efeitos espaciais e um outro com a média de cada região</div><div id="yui_3_16_0_1_1416662401672_34857" dir="ltr" align="left">não estou conseguindo.</div><div id="yui_3_16_0_1_1416662401672_34856" dir="ltr" align="left">neste modelo qual a saída q mostra o valor estimado pro rho.?</div><div id="yui_3_16_0_1_1416662401672_34860" dir="ltr" align="left">desde ja obrigado</div><div dir="ltr" align="left"><br></div><div id="yui_3_16_0_1_1416662401672_34937" dir="ltr" align="left"><br></div><div id="yui_3_16_0_1_1416662401672_34936" dir="ltr" align="left"><br></div><div id="yui_3_16_0_1_1416662401672_34935" dir="ltr" align="left">############################ CARBayes Leroux vs CAR #######################################<br style="" class="">#####################################################################<br style="" class="">rm(list=ls())<br style="" class="">require(spatstat)<br style="" class="">require(lattice)<br style="" class="">require(MASS)<br style="" class="">require(coda)<br style="" class="">require (MCMCpack)<br style="" class="">require(plotrix) <br style="" class="">require(CARBayes)<br style="" class=""><br style="" class="">########## simulação<br style="" class=""><br style="" class=""><br style="" class="">x.easting= 1:10<br style="" class="">x.northing <- 1:10<br style="" class="">Grid <- expand.grid(x.easting, x.northing)<br style="" class="">n <- nrow(Grid)<br style="" class=""><br style="" class=""><br style="" class="">distance <-array(0, c(n,n))<br style="" class="">W <-array(0, c(n,n))<br style="" class=""> for(i in 1:n)<br style="" class=""> {<br style="" class=""> for(j in 1:n)<br style="" class=""> {<br style="" class=""> temp <- (Grid[i,1] - Grid[j,1])^2 + (Grid[i,2] - Grid[j,2])^2<br style="" class=""> distance[i,j] <- sqrt(temp)<br style="" class=""> if(temp==1) W[i,j] <- 1 <br style="" class=""> } <br style="" class=""> }<br style="" class=""> <br style="" class=""><br style="" class="">x1= rnorm(n) # variavel 1<br style="" class="">x2= rnorm(n) # variavel 2<br style="" class="">E= rep(50,n) # valor esperado para cada regiao <br style="" class="">theta= rnorm(n, sd=0.05) #<br style="" class="">phi <- mvrnorm(n=1, mu=rep(0,n), Sigma=0.4 * exp(-0.1 * distance))<br style="" class="">risk <- exp(-0.2 + 0.1 * x1 + 0.1*x2 + theta + phi)<br style="" class="">fitted <- E * risk<br style="" class="">Y <- rpois(n=n, lambda=fitted)<br style="" class=""><br style="" class="">formula <- Y ~ x1 + x2 + offset(log(E))<br style="" class=""><br style="" class="">model <- poisson.lerouxCAR(formula=formula, W=W, burnin=50, n.sample=1000)<br style="" class=""><br style="" class=""><br style="" class=""><br style="" class="">model$formula<br style="" class="">model$samples<br style="" class="">model$fitted.values<br style="" class="">model$random.effects<br style="" class="">model$residuals<br style="" class="">model$W.summary<br style="" class="">model$DIC<br style="" class="">model$p.d<br style="" class="">model$summary.results<br style="" class="">model$model<br style="" class="">model$accept<br style="" class=""><br style="" class=""><br style="" class=""><br></div><div dir="ltr" align="left"><br></div><div id="yui_3_16_0_1_1416662401672_34826" align="left"><br></div><div id="yui_3_16_0_1_1416662401672_34825" align="left"><br></div><div id="yui_3_16_0_1_1416662401672_34805" align="left"> </div><div id="yui_3_16_0_1_1416662401672_34804" align="left"> </div><div id="yui_3_16_0_1_1416662401672_34803" align="left"> </div><div id="yui_3_16_0_1_1416662401672_34802" align="left">Att</div><div id="yui_3_16_0_1_1416662401672_34800" align="left">Edson<br> </div></div></div></body></html>