Displaying 1 result from an estimated 1 matches for "jagsgamma".
2011 Sep 10
1
dgamma in jags within r
...gamma(r, mu) has a density of
?^r*x^(r?1)*exp(??x)
--------------------
Gamma(r)
So I conclude that
?=1/s then ? in jags is the rate=1/s parameter of dgamma
and r in jags is the shape=a parameter of dgamma
Then
dgamma(r, mu) in jags syntax is dgamma(x, shape=r, rate=mu) in r syntax
# lets try:
jagsgamma <- function(x, r, mu) {(mu^r*x^(r-1)*exp(-mu*r))/gamma(r)}
x <- seq(0,40,by=0.1)
# parameters of the gamma
jagsr=0.001
jagsmu=0.001
# plot the density using the formula of jags
plot(x, jagsgamma(x, jagsr, jagsmu), type="l", xlab="x", ylab="Density")
# plot the de...