I'll try to make an example to make it easier to understand the question.
model{
constant1=(number)
constan2=(number)
for(j in 1:k){ #k defined in data
a[j] ~ dgamma(c[j],d[j])
b[j]~ dgamma(e[j], f[j])
c[j] ~ dgamma(constan1,constant2)
d[j] ~ dgamma(constan1,constant2)
e[j] ~ dgamma(constan1,constant2)
f[j] ~ dgamma(constan1,constant2) }
l[i]<-
}
I want to make a likelihood ( l ) that is a sum of elements in 1:k (for each i => a simple loop would solve it..), but unlike R, in bugs I cannot make a for() function or a sum function to make l[i] (multiple definitions..).
It's impossible to do something like this in bugs (it accepts only one specification).
for(i in N){ #N is a number defined on data, k also
l[i]<-0
for(j in 1:k){
l[i]<-l[i]+ d[j]*log(c[j])-log(d[j])+loggam(c[i])+pow(a[j],b[j])+a[j]*t[i] +
delta[i]*a[j]
#it's just an example.. t and delta is in data
}
}
I tried to make this l[i] using functions sum and inprod, bugs doesn't allow to make log() of a function.
Also, i keep getting errors when i use inprod with 2 "distributions", like c and d (inprod(d,c)).
And, if I make a l[i] specification directly with a sum all 1:k it gets a error of complex/too many constants.
Any idea how to write it in a simple way and make a sum all at once of all 1:k?
I am stucked, would be very usefull any comment.
Thanks in advance.
-------------------------------------------------------------------
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
|