Print

Print


*Dear BUGers,*

 Thanks a lot for your kind reply and helpful information about my Weibull
modelling  problems, especially, I appreciated much for *Dr. Andrew Millard*,
Dr. Sanjib Basu, Dear Polychronis,

My data D is a time series of 16,670 records. I am trying to code in winbugs
a Weibull distribution to sample and calculate the marginal likelihood of
the data given this model. My 2-parameter Weib(alpha, beta) model is as
follows.

model    #2-parameter Weibull Distribution
   {
   for(i in 1 : N) {
   y[i] ~ dweib(alpha, beta)
   }
   alpha ~ dgamma(0.1,0.1) #Prior pdf of alpha
   beta ~ dgamma(0.1,0.1) #Prior pdf of beta
   median <- pow(log(2), 1/alpha)/alpha
   mean<-alpha*beta
   sigma<-pow(alpha, 0.5)*beta
   }
This model did not work for so long a data. I tried using the first 900
records, it worked but the results seemed to be incorrect.
What's wrong with this model? How can I consider all these records?How to
extend it into three-parameter Weibull(alpha, beta,mu)?



From: Polychronis Kostoulas <[log in to unmask]>

Regarding three-parameter Weibull(alpha, beta, mu) perhaps the zero's trick
can be useful.
Polychronis



From: Sanjib Basu <[log in to unmask]>

I would suggest putting a more informative prior on the shape parameter of
the Weibull (I think alpha in your model). Possibly restricting it in an
interval around 1, and not let it get away too close to zero or too big.
Sanjib Basu
Division of Statistics
Northern Illinois University
De Kalb, IL 60115, USA
(815) 753-6799
[log in to unmask]





From: Emanuele Del Fava <[log in to unmask]>

just looking at the summary statistics of a Weibull distribution, you should
have that, given the parameterization of WinBUGS:

median=pow(log(2),1/alpha)/beta
mean=(1/beta)*Gammafunc(1+1/alpha)
variance=(1/beta^2)*Gammafunc(1+2/alpha)-mean^2
The only issue is that I don't know how to implement the gamma function in
WinBUGS, but you may find something on the web.
Emanuele



From: MILLARD A.R. <[log in to unmask]>

This line is clearly wrong as the median must involve alpha and beta.

>     median <- pow(log(2), 1/alpha)/alpha

Also be aware that the Winbugs parameterisation seems to be different from
that in most text books, so I think this should be
temp <- (log(2)/beta)
median <- pow(temp, 1/alpha)
The mean involves a gamma function, as does the standard deviation.
The dgamma priors on alpha and beta may also cause problems with
convergence, as they are heavily weighted towards zero. Try uniform priors
or other priors that reflect your real prior information about the likely
size of alpha and beta.
Andrew

 From: MILLARD A.R. <[log in to unmask]>

I had a quick look at your model and data. There are several values of zero
in the full dataset, which have a likelihood of zero, and therefore cause
winbugs to crash. When I replace these with 0.001 the model runs with no
problem.

 Model comparison with WinBUGS is not straightforward, though it can be done
for certain types of models.  I suggest you review the discussions on the
list and the examples in Peter Congdon's three books on Bayesian modelling.

Andrew

-------------------------------------------------------------------
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