Many thanks to several people for their quick and helpful
responses, which I've summarized below. By the way the
problem occurs when running WinBUGS version 1.4.3.
(I was, however, using an older version, 1.4, of WinBUGS
when I made the posting. sorry, folks...)
Ken
--------------------------------------------------------------------
From Russell Millar:
He had run across a similar problem (see the year 2000 BUGS
list archives, #35) and thought the problem was that
the full conditionals became extremely complicated in the
deterministic state process case. Hand-coding a solution
using something like AD Model Builder was a not-too-difficult
alternative.
From Martyn Plummer:
He found that the original formulation did compile and run
under JAGS, but the autocorrelation was very high. He also
noted high autocorrelations with my workaround, too, that were
severe enough to raise concerns about convergence.
From Andrew Thomas:
He noted that older versions of WinBUGS had problems with deep
recursions, but thought that OpenBUGS might handle this better.
From Colin Millar:
He'd had a similar problem with a Schaefer surplus production
model but w/ no observation process variation (in contrast to my
no state process variation), and similar to Russell Millar's
thoughts, believed that severe autocorrelation in the states
might be the problem. An alternative that worked for him was
to code it up directly in R.
From Mike Thompson:
He'd tried similar experiments in the past and was told by
BUGS developers that it was the deeply recursive nature of the
model that was the problem; e.g., state[30] is a function of
all previous states, state[t], t=1,...,29. He'd tried a similar
workaround, noting correctly that huge.tau was more appropriate
labeling than tiny.tau!
On Thu, 30 Aug 2007 18:51:10 +0100, Ken Newman <[log in to unmask]> wrote:
>I'm using WinBUGS (being run under MS Vista) to measure
>the effect of assuming no state process error in a toy univariate
>state-space model. The state process is a deterministic
>Beverton-Holt "birth" model, and the obs'n process is
>a lognormally distributed estimate of the state:
>
> state[t] <- (alpha*state[t-1])/(1+beta*state[t-1])
> obs[t] ~ dlnorm(log(state[t]), sigma^2)
>
> Here's my problem: the above model, when translated into
>WinBUGS code, results in the compiler hanging (with the
>hourglass shown), but if I make state[t] stochastic,
>it compiles and executes just fine. So my crude fix in WinBUGS
>has been:
> state[t] ~ dnorm((alpha*state[t-1])/(1+beta*state[t-1]), 1000)
>
> Can someone explain why the compiler hangs on the
>deterministic version?
>
> Below is listed the actual WinBUGS code.
>
>Ken
>-------------------------------------------------------------------------
>
>#Observation error only, no state noise; deterministic Beverton-Holt
>
>model {
>
> # Priors
> alpha ~ dgamma(15,1)
> beta ~ dunif(0.00001,0.01)
> CV ~ dunif(0.1,0.5)
> n.init ~ dunif(10,100)
>
> sigma.sq <- log(CV*CV+1)
> tau <- 1/sigma.sq
> tiny.tau <- 1000 #only for the workaround below
>
> state[1] <- round((alpha*n.init)/(1+beta*n.init))
> temp[1] <- log(state[1])-sigma.sq/2
> obs[1] ~ dlnorm(temp[1],tau)
>
> for(i in 2:T) {
> # the commented out statement below results in compiler hanging
> # state[i] <- (alpha*state[i-1])/(1 + beta*state[i-1])
>
> # next two lines are the clunky workaround
> mu[i] <- (alpha*state[i-1])/(1 + beta*state[i-1])
> state[i] ~ dnorm(mu[i],tiny.tau)
>
> # Obs'n process: bias corrected lognormal
> temp[i] <- log(state[i]) - sigma.sq/2
> obs[i] ~ dlnorm(temp[i],tau)
> }
>}
>
>#Data
>list(T=30,
> obs=c( 467, 3465, 4249, 5701, 5966 ,4568, 3289, 4257, 4217, 6453, 4674,
> 4955, 6230, 4798, 3426, 3990, 6198, 4200, 4223, 4853, 5280,
> 4456, 3716, 5360, 5660, 4060, 5189, 2885, 3110, 6400))
>
># Initial values
>list(alpha=14,beta=0.009,n.init=50,CV=0.3)
>
>-------------------------------------------------------------------
>This list is for discussion of modelling issues and the BUGS software.
>For help with crashes and error messages, first mail [log in to unmask]
>To mail the BUGS list, mail to [log in to unmask]
>Before mailing, please check the archive at
www.jiscmail.ac.uk/lists/bugs.html
>Please do not mail attachments to the list.
>To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
>If this fails, mail [log in to unmask], NOT the whole list
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|