Dear BUGS Users
I am using WinBugs 1.4 to model a random coefficientsfor road safety
analysis considering time autocorrelations for both dependent variable and
independent variables. My dataset contains 5814 sites and 10 years data.
This model was failed to compile, I tried lots of times but still I have
the problem. I got an error message of multiple definitions of y[5814,1]
in the model shown in the following, I understand that there may be some
hidden problems that I did not notice.
I have some missing data values (NA’s) in the dataset, which makes the
dataset is not evenly time spaced data, is it the problem that AR(1) model
cannot work? How to solve this problem if it is.
Any help is highly appreciated.
Thank you
Bo Lan
********************************************************************
l[i,j]---ith intersection in year j light type, if it is signalised l[i,j]
=1, otherwise is 0
ml[i,j]---ith intersection in year j main line traffic volume
xst[i,j]--ith intersection in year j minor street traffic volume
tot[i,j]---ith intersection in year j total traffic accident counts
model {
for (i in 1:N) {
for (j in 1:M) {
y[i,j]<-tot[i,j]
y[i,j]~ dpois(theta[i,j])
lnml[i,j]<-log(ml[i,j])
lnxst[i,j]<-log(xst[i,j])}
}
for (i in 1:N) {
log(theta[i,1])<-b[1]+b[2]*lnml[i,1]+b[3]*lnxst[i,1]+b[4]*l[i,1]
for (j in 2:M) {
log(theta[i,j])<-b[1]+b[2]*lnml[i,j]+b[3]*lnxst[i,j]+b[4]*l
[i,j]+r*(log(theta[i,j-1])-b[1]-b[2]*lnml[i,j-1]-b[3]*lnxst[i,j-1]-b[4]*l
[i,j-1])
}
}
for (k in 1:4) {b[k] ~ dnorm(0.0, tau)}
r~dunif(1,-1)
tau ~ dgamma(0.01, 0.01)
sigma <- 1/ sqrt(tau)
}
Data
list(N =5814, M =10)
l[ ,1] l[ ,2] l[ ,3] l[ ,4] l[ ,5] l[ ,6] l[ ,7] l[ ,8] l[ ,9] l
[ ,10] ml[ ,1] ml[ ,2] ml[ ,3] ml[ ,4] ml[ ,5] ml[ ,6] ml[ ,7] ml[ ,8] ml
[ ,9] ml[ ,10] xst[ ,1] xst[ ,2] xst[ ,3] xst
[ ,4] xst[ ,5] xst[ ,6] xst[ ,7] xst[ ,8] xst
[ ,9] xst[ ,10] tot[ ,1] tot[ ,2] tot[ ,3] tot
[ ,4] tot[ ,5] tot[ ,6] tot[ ,7] tot[ ,8] tot
[ ,9] tot[ ,10]
1 1 1 1 1 1 1 1 0 0
6716 6716 5632 6489 6489 7000 7126 7216 6963
6963 251 251 251 251 251 251 251 251
251 251 0 0 0 0 2 0 1
0 0 0
.
.
.
END
-------------------------------------------------------------------
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
|