Hi all,
This has probably shown up on the list already, but in case it has
not... I occasionally wish to use a nonstandard
(continuous)distribution , f(x), that is unbounded above. By way of
illustration, consider
f(x) = c|x-theta|^{-1/2}exp(-|x-theta|) -infty < x < infty
This will cause problems for the ones trick or the dpois trick, since both
of these methods require that the density be scaled so as to not to exceed
one:
model
{
for (i in 1:N){
ones[i] ~ dbern(p[i])
p[i] <- exp(-abs(y[i]-theta))* (3.14159/2)/sqrt(abs(y[i]-theta))
}
theta ~ dnorm(0,0.0001)
}
I used simulated data (N=104, theta=10).
The code above actually runs, but it leaves me very worried as
“probabilities” greater than one could easily appear as the chain runs.
As an alternative, I have used the trick of using a uniform distribution:
model
{
for (i in 1:N){
zeros[i] ~ dunif(a[i],b[i])
a[i] <- -1/p[i]
b[i] <- 1/p[i]
p[i] <- exp(-abs(y[i]-theta))* (3.14159/2)/sqrt(abs(y[i]-theta))
}
theta ~ dnorm(0,0.0001)
}
This gives virtually an identical answer to what I got using the ‘ones’
trick, but the uniform(-a,a) distribution is valid for any positive a, so
that using a=1/f(x) will result in the correct function being multiplied
by the likelihood even if f(x) is larger than one. This trick has always
worked for me at least as well as the ‘ones’ trick and the dpois trick.
Has anyone else used this approach, and is there a downside to it?
Ron Barry
Dept. of Mathematics and Statistics
Univ. of Alaska Fairbanks
Fairbanks, Alaska 99775-6660
[log in to unmask]
(907)-474-7226
-------------------------------------------------------------------
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
|