# Bayesian Methods for the Physical Science. Learning from # Examples in Astronomy and Physics. By S. Andreon and B. Weaver. # From Andreon & Hurn 2010, Monthly Notices of the Royal Astronomical # Society 404, 1922 data { nu <-6 obsvarlgM <- pow(errlgM,2) } model { for (i in 1:length(obstot)) { obsbkg[i] ~ dpois(nbkg[i]) obstot[i] ~ dpois(nbkg[i]/C[i]+n[i]) n[i] ~ dunif(0,3000) nbkg[i] ~ dunif(0,3000) precy[i] ~ dgamma(1.0E-5,1.0E-5) obslgM[i] ~ dnorm(lgM[i],precy[i]) obsvarlgM[i] ~ dgamma(0.5*nu,0.5*nu*precy[i]) z[i] <- alpha+14.5+beta*(log(n[i])/2.30258-1.5) lgM[i] ~ dnorm(z[i], pow(intrscat,-2)) } intrscat <- 1/sqrt(prec.intrscat) prec.intrscat ~ dgamma(1.0E-5,1.0E-5) alpha ~ dnorm(0.0,1.0E-4) beta ~ dt(0,1,1) }