Print

Print


 >
> I have a changepoint problem but this example has me baffled.  I would greatly
> appreciate it if anyone could provide another example or reference.
>
> With the stagnant example, I'm very confused by "k~dcat(punif[])" with punif[] a
> column of identical values (0.0344828).  The resulting distribution of k shows
> that it oscillates around the init for k .  Each init for k leads to very
> different results.
>
> Please be patient with me - I'm just learning.
>
> Thanks
> Jamie
>


dear Jamie

This is a very good observation.  In fact  'Stagnant' is an extremely
good example of how NOT to do MCMC (I only wish I could honestly say we
put it in on purpose!)

The problem is the following:

a) the model is parameterised so that alpha is the intercept at
the changepoint

b) this means that alpha and the changepoint will be strongly correlated
in the simulation

c) we have forced the changepoint k to occur at one of the observations

d) WinBUGS uses univariate Gibbs sampling.

Hence, when sampling k conditional on alpha, only a limited number of k's
receive any support, and so the sampler stays fixed (it only oscillates
because there are repeated x's and so k is not precisely identifiable).

This is all easily solved by making the changepoint continuous (as
I believe has previously been pointed out on this list, only I had
forgotten).  The model becomes

model
        {
           for( i in 1 : N ) {
                Y[i] ~ dnorm(mu[i],tau)
                mu[i] <- alpha + beta[J[i]] * (x[i] - x.change)
                J[i] <- 1 + step(x[i] - x.change)
           }
           tau ~ dgamma(0.001,0.001)
           alpha ~ dnorm(0.0,1.0E-6)
           for( j in 1 : 2 ) {
           beta[j] ~ dnorm(0.0,1.0E-6)
           }
           sigma <- 1 / sqrt(tau)
           x.change~dunif(-1.3,1.1)
        }

and it all mixes fine (except alpha and x.change are still rather
correlated).

I assure you that this will be changed in the next manual - it makes a
very good teaching example of what not to do.

David

-------------------------------------------------------------------
To mail the BUGS list, mail to [log in to unmask]
You can search old messages at www.jiscmail.ac.uk/lists/bugs.html
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]