[R-br] RES: Regressão espacial com variavel transformada log normal

Mauro Sznelwar sznelwar em uol.com.br
Quinta Junho 11 01:13:57 BRT 2015


Tentei instalar esta biblioteca INLA e não consegui, por acaso é exclusiva
do LINUX ou não está disponível no CRAN?


Como os dados são contínuos seria necessário considerar uma distribuição 
contínua com mistura Bernoulli, veja uma proposta aqui:
http://jupiter.est.ufmg.br/~posgrad/mestrado/dissertacao_mestrado_zaida%20_q
uiroz.pdf
e um exemplo no script abaixo:

## hurdle model for zero-gamma (zero inflation and continuous outcome)
require(INLA)

### rainfall data from Parana' state in Brazil
data(PRprec)

### analize data from one location
PRprec[301,1:3]
y <- as.matrix(PRprec[,-(1:3)])[301,]

summary(y)

plot.ts(y)
if (TRUE)
     dev.off()

### organize the dataset to build a model for
### smoothing the rainfall amount over the year
### accounting for a smoothed zero probability as well
n <- length(y)
dat <- list(resp=cbind(
                 c((y>0)+0, rep(NA,n)),
                 c(rep(NA,n), ifelse(y>0,y,NA))),
             t0=c(1:n, rep(NA,n)),
             t1=c(rep(NA,n), 1:n))

### two choices to smooth the rainfall amount
form1 <- resp ~ 0 +
     f(t0, model='rw2', cyclic=TRUE) +
         f(inla.group(t1, n=73), model='rw1', cyclic=TRUE)
form2 <- resp ~ 0 +
     f(t0, model='rw2', cyclic=TRUE) +
         f(t1, model='rw2', cyclic=TRUE)
inla.setOption(scale.model=TRUE)

res1 <- inla(form1, family=c('binomial', 'gamma'), data=dat)
res2 <- inla(form2, family=c('binomial', 'gamma'), data=dat)

day <- seq(ISOdate(2011,1,1), ISOdate(2011,12,31), 24*3600)
par(mfrow=c(2,1), mar=c(3,3,1,1), mgp=c(2,1,0))
plot(day, y>0)
for (j in 4:6) {
     lines(day, 1/(1+exp(-res1$summary.ran$t0[,j])), lty=2)
     lines(day, 1/(1+exp(-res2$summary.ran$t0[,j])), lty=2, col=2)
}
plot(day, y, type='l')
for (j in 4:6) {
     lines(day[seq(3,n,5)], exp(res1$summary.ran[[2]][,j]), lty=2)
     lines(day, exp(res2$summary.ran[[2]][,j]), lty=2, col=2)
}


Elias
_______________________________________________
R-br mailing list
R-br em listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código
mínimo reproduzível.


---
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus



Mais detalhes sobre a lista de discussão R-br