On Wed, 10 Dec 2003, Guorong Chen wrote:
> I stuck when I tried to fit a mixture distribution of
> two normals for residuals in a linear mixed model. My
> model compiles well. But When I initialize my model,
> following error message pups up: "can not generate
> initial values for T", where T is a 2x4x8x6x5 group
> index matrix. That is, each element of T can only take
> either 1 or 2.
Here's a general trick that I don't recall seeing on the list, so I am
replying on-list. The reason why WinBUGS can't generate initial values
from the priors depends very much on the model. The solution is to supply
them yourself, but that is likely to be a tedious amount of typing in this
case. However you can generate them automatically. Use the following
model
model{
for (a in 1:2){
for (b in 1:4){
for (c in 1:8){
for (d in 1:6){
for (e in 1:5){
T[a,b,c,d,e] ~ dcat(p[1:2])
}}}}}
p[1] <- 0.5
p[2]<-0.5
}
and after compiling and "gen inits", use Model|Save State to get a set
of values you can use as inits for your main model. A similar trick can
be used for any large array that needs initialising, but it is often sensible
to use an informative distribution for the generation step here even if
the main model has vague priors (thus giving initial values not too far in
the tails of the posterior). If you want different initial values for
several chains then updating this inits generating model followed by
Save State will give them.
Andrew
=========================================================================
Dr. Andrew Millard [log in to unmask]
Department of Archaeology, University of Durham, Tel: +44 191 334 1147
South Road, Durham. DH1 3LE. United Kingdom. Fax: +44 191 334 1101
http://www.dur.ac.uk/a.r.millard/
=========================================================================
-------------------------------------------------------------------
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
|