[R-br] Modelo Bayesiano

Sérgio Henrique almeida da silva ju sergio.edfisica em gmail.com
Sexta Maio 11 11:55:21 BRT 2012


Olá

Estou tentando estimar a prevalência de uma doença (True Prevalence),
através de um modelo Bayesiano (Joseph L, Gyorkos TW, Coupal L
Bayesian estimation of
disease prevalence and the parameters of diagnostic tests in the
absence of a gold standard Am J Epidemiol 1995,141:263-72.)

Para isso estou usando a biblioteca (R2WinBUGS) e modelando através de
distribuição Binomial Negativa

##Parameterized by p and r:
model {
    for( i in 1 : N ) {
      y[i] ~ dnegbin( p , r )
    }
    p ~ dbeta(1.001,1.001)
    r ~ dgamma(0.01,0.01)
    m <- r*(1-p)/p
    v <- r*(1-p)/(p*p)
}


Porém quando rodo o modelo:

N <-nrow(dados1)
y <-dados1$esqui
data <- list("N", "y")

inits <- function(){list(p=rbeta(N,1.001,1.001),r=rgamma(1,0.01,0.01))}

esqui.sim <- bugs(data, inits, model.file = "esqui.bugs",
parameters = c("p", "r"), n.chains = 2, n.iter = 1000,
bugs.directory = "C:/Users/sergio/Downloads/winbugs14",debug=T)

Aparece o seguinte erro no log:

display(log)
check(C:/Users/sergio/AppData/Local/Temp/Rtmp4SGBkz/esqui.bugs.txt)
model is syntactically correct
data(C:/Users/sergio/AppData/Local/Temp/Rtmp4SGBkz/data.txt)
expected collection operator c
compile(2)
inits(1,C:/Users/sergio/AppData/Local/Temp/Rtmp4SGBkz/inits1.txt)
command #Bugs:inits cannot be executed (is greyed out)
inits(2,C:/Users/sergio/AppData/Local/Temp/Rtmp4SGBkz/inits2.txt)
command #Bugs:inits cannot be executed (is greyed out)
gen.inits()
command #Bugs:gen.inits cannot be executed (is greyed out)
thin.updater(1)
update(500)
command #Bugs:update cannot be executed (is greyed out)
set(p)
command #Bugs:set cannot be executed (is greyed out)
set(r)
command #Bugs:set cannot be executed (is greyed out)
set(deviance)
command #Bugs:set cannot be executed (is greyed out)
dic.set()
command #Bugs:dic.set cannot be executed (is greyed out)
update(500)
command #Bugs:update cannot be executed (is greyed out)
coda(*,C:/Users/sergio/AppData/Local/Temp/Rtmp4SGBkz/coda)
command #Bugs:coda cannot be executed (is greyed out)
stats(*)
command #Bugs:stats cannot be executed (is greyed out)
dic.stats()

DIC
history(*,C:/Users/sergio/AppData/Local/Temp/Rtmp4SGBkz/history.odc)
command #Bugs:history cannot be executed (is greyed out)
save(C:/Users/sergio/AppData/Local/Temp/Rtmp4SGBkz/log.odc)
save(C:/Users/sergio/AppData/Local/Temp/Rtmp4SGBkz/log.txt)

O que estou fazendo de errado?

Abraços

-- 
Sérgio Henrique Almeida da Silva Junior
Doutorando em Epidemiologia em Saúde Pública
Escola Nacional de Saúde Pública Sérgio Arouca - ENSP/FIOCRUZ
http://lattes.cnpq.br/1611345552843383
Tel: (21) 94429486/78101651 id: 123*20942


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