Hi all,
I sent this message some weeks ago and got two answers
- From G. Nehmiz
In the regression expression for "log(lam[j])" you should try the so-called
"centering". I.e. the mean of the regressor should be close to 0. This will
reduce the correlations between parameters and also the autocorrelations in
the time-series of each parameter. Consequently, the necessary number of
iterations will go down.
- from J. BOwman
My experience with C/C++ is that you have to think differently to get the
program right. The structure of WINBugs as a programming language is
different enough so that straightforward translation breaks down. It's
sort of a pain, actually, but your model looks pretty straightforward... I
would strongly recommend letting your PC run for a day or two before
tackling C++ programming. BTW, I have about 30 years programming
experience, about 15 of which is with C/C++, so I'm not a novice programmer.
So I followed both advices and modified the code (thanks Gerhard and thanks
John:
centering : log(lam[j]) <- cstte[qtte[j,1]] + vis*(ind[qtte[j,1]]-5) +
last*qtte[j,4] - ptime[qtte[j,1]]*(qtte[j,2]/30 - 1 - beta*(qtte[j,3]-2.4))
predifined logfact lik[j] <- qtte[j,5]*log(lam[j])-lam[j]-qtte[j,6]
(qtt[j,6]=logfact(qtt[j,5])
However, it's still taking days to estimate the model
Many thanks to the list
Naji
Original message
----------------------------------------------------------------------------
-------------------------------------------------
I have a code modelling consumer behavior. I estyimated the model for some
200 panelists (more than two hours).. I'd like to estimate the same model
for all my panelists, ie 1200 persons generating 75000 observations..Can
somebody forward/share his experience writing BUGS code into C,Matlab,Gauss
langages?
Thanks in advance
Naji
*model;
{ for( i in 1 : Nind )
{
cstte[i] ~ dnorm(m.cstte,p.cstte)
ptime[i] ~ dnorm(m.ptime,p.ptime)
}
for( j in 1 : Nobs )
{
qtte[j,5] ~ dpois(lam[j])
log(lam[j]) <- cstte[qtte[j,1]] + vis*ind[qtte[j,1]] +
last*qtte[j,4] - ptime[qtte[j,1]]*(qtte[j,2]/30 - beta*qtte[j,3])
lik[j] <- qtte[j,5]*log(lam[j])-lam[j]-logfact(qtte[j,5])
}
llik <- sum( lik[])
}
last ~ dnorm(0.001,0.001)
vis ~ dnorm(0.001,0.001)
beta ~ dnorm(0.001,0.001)
m.cstte ~ dnorm(0.001,0.001)
p.cstte ~ dgamma(0.01,0.01)
m.ptime ~ dnorm(0.001,0.001)
p.ptime ~ dgamma(0.01,0.01)
-------------------------------------------------------------------
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
|