2

I'm new to OpenBUGS and I got some problem in fitting a model with the logit() function.

Reading around I found that one possible solution for this would be explicit specify the logit function without using the WinBUGS’ own logit function:

In more complex models, we have fairly often experienced problems when using WinBUGS’ own logit function, for instance with achieving convergence (actually, problems may arise even with fairly simple models.). Therefore,it is often better to specify that transformation explicitly by logit.p[i] <- log(p[i] / (1 – p[i])), p[i] <- exp(logit.p[i]) / (1 + exp(logit.p[i])) or p[i] <- 1 / (1 + exp(- logit.p[i])).

(more information here http://www.mbr-pwrc.usgs.gov/software/kerybook/AppendixA_list_of_WinBUGS_tricks.pdf at point 14.).

The problem is that I don't understand how to do that, let's suppose that my original likelihood function, using the WinBUGS integrated logit function, was:

for (i in 1:n){
    y[i] ~ dbern(p[i])
    logit(p[i]) <- beta[1] + beta[2]*x1[i] + beta[3]*x2[i] + beta[4]*x3[i] 
    }

How I explicit write that?

Thank you very much.

Vincenzo

Vincenzo G
  • 41
  • 5

1 Answers1

2

Thanks to a colleague, I found the way to explicitly specify a logit function in OpenBUGS, the working code is the following:

for (i in 1:n){
y[i] ~ dbern(logit.p[i])
logit.p[i] <- 1 / (1 + exp(-p[i]))
p[i] <-  beta[1] + beta[2]*x1[i] + beta[3]*x2[i] + beta[4]*x3[i] 
}
Vincenzo G
  • 41
  • 5