Displaying 1 result from an estimated 1 matches for "jagsr".
Did you mean:
jags
2011 Sep 10
1
dgamma in jags within r
...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 density using the dgamma of r
par(new=TRUE)
plot(x, dgamma(x, shape=jagsr, rate=jagsmu), type="l", axes=FALSE,...