  Print

Hello WinBUGS users.

I am hoping to use WinBUGS for my model. I have done the modelling, but I am a bit suspicious about the output.

Hence it’ll be of great help if someone can please point out if my WinBUGS code is correct wrt to the theoretical model.

Model:

w[j] ~ Mixture of exponential distributions with parameters lambda and lambda and P decides the probability of w[j] being generated from either of the exponential distributions.

Some of the w[j] values are censored due to which I have to use dweib(1, mu[j]) instead of a simple exponential distribution. From the tutorial it seemed to me that the Weibull distribution supports censoring.

Now some of the w[j]’s are generated from a single exponential distribution instead of the mixture. My confusion is regarding the WinBUGS code that handles this. I am doing it in the following manner.

The first observation is generated from the mixture.

Now w[j] is generated from only a single exponential distribution under the following conditions:

For every w[j], there is a corresponding cen[j] which equals to 0 and

cen[j-1] does not equal to 0.

Also I have the variable M[j] that decides which of the exponential distribution generates the data. I use it as:

Mod[j] <- equals(cen[j], 0)*(1 - equals(cen[j-1], 0)) + (1 - equals(cen[j], 0)*(1 - equals(cen[j-1], 0)) )*M[j]

The first part is 1 if both the conditions are fulfilled and Mod[j]  is assigned the value 1, otherwise the values is assigned based on M[j].

The complete WinBUGS model is as follows:

model

{

for (j in 1 : 1)

{

w[j] ~ dweib(1, mu[j]) I(cen[j], )

mu[j] <- lambda[M[j]]

M[j] ~ dcat(P[])

}

for (j in 2 : T)

{

w[j] ~ dweib(1, mu[j]) I(cen[j], )

mu[j] <- lambda[Mod[j]]

Mod[j] <- equals(cen[j], 0)*(1 - equals(cen[j-1], 0)) + (1 - equals(cen[j], 0)*(1 - equals(cen[j-1], 0)) )*M[j]

M[j] ~ dcat(P[])

}

P[1:2] ~ ddirch(alpha[]);

alpha <- 1;

alpha <- 1;

lambda ~ dnorm(0.0, 1.0E-6) I(0, )

l2 <- 1 - lambda

theta ~ dnorm(0.0, 1.0E-6) I(0,  l2)

lambda <- lambda + theta

}

Kindly suggest if I am making any errors in handling the mixture model especially assigning some of the observations that are generated from only a single distribution instead of the mixture.

Thanks

Avik

`==========`
`Avik Sarkar`
`PhD Student`
`Department of Computing`
`Open University ; Milton Keynes ; UK`
`homepage :  `
`http://mcs.open.ac.uk/as5297`
`http://www.aviksarkar.com`
` `