Dear WinBUGS users,
About 1 month ago I created a code that ran perfectly. After 1 month Im trying to use it again but I get the error "expected variable name". Any ideas? The code is:
model {
#MODEL'S LIKELIHOOD--------------------------------------------------
for (i in 1:n) {
for (j in 1:n){
x[i,j] ~ dlnorm(m[i,j], t)
m[i,j] <- c + a[i] + b[j]
} }
#CONSTRAINTS---------------------------------------------------------
#SUM TO ZERO CONSTRAINTS
a[1] <- -sum(a[2:n])
b[1] <- -sum(b[2:n])
#PRIORS--------------------------------------------------------------
c ~ dnorm(0,0.001)
for (i in 2:n) {
a[i] ~ dnorm(0, 0.01)
b[i] ~ dnorm(0,0.01) }
t ~ dgamma(0.01, 0.01)
sigma2 <- 1/t
#ACCIDENT YEAR AND TOTAL RESERVE-------------------------------------
R[1] <- 0
for (i in 2:n){
R[i] <- sum(x[i,(n+2-i):n])
}
Total <- sum(R[])
}
#DATA----------------------------------------------------------------
list(n=10, x=structure(.Data=c(357848,766940,610542,482940,527326,
574398,146342,139950,227229,67948,352118,884021,
933894,1183289,445745,320996,527804,266172,425046,
NA,290507,1001799,926219,1016654,750816,146923,495992,
280405,NA,NA,310608,1108250,776189,1562400,272482,
352053,206286,NA,NA,NA,443160,693190,991983,769488,
504851,470639,NA,NA,NA,NA,396132,
937085,847498,805037,705960,NA,NA,NA,NA,NA,
440832,847631,1131398,1063269,NA,NA,NA,NA,NA,NA,
359480,1061648,1443370,NA,NA,NA,NA,NA,NA,NA,376686,
986608,NA,NA,NA,NA,NA,NA,NA,NA,344014,NA,NA,NA,NA,NA,NA,NA,NA,NA),
.Dim=c(10,10) ) )
#INITIAL VALUES------------------------------------------------------
list(a=c(
NA,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1),b=c(
NA,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5),
c=5,
t=1,
x = structure(.Data = c(NA,NA,NA,NA,NA,NA,NA,NA,
NA,NA,NA,NA,NA,NA,NA,NA,NA,
NA,NA,0,NA,NA,NA,NA,NA,NA,NA,NA,
0,0,NA,NA,NA,NA,NA,NA,NA,0,0,0,NA,NA,NA,NA,
NA,NA,0,0,0,0,NA,NA,NA,NA,NA,
0,0,0,0,0,NA,NA,NA,NA,0,0,0,0,0,0,NA,NA,NA,0,0,
0,0,0,0,0,NA,NA,0,0,0,0,0,0,0,0,
NA,0,0,0,0,0,0,0,0,0),.Dim = c(10,10)))
-------------------------------------------------------------------
This list is for BUGS users to support each other, ask questions or share ideas.
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
|