0
$\begingroup$

I am building a generalized linear model using the logit function in R using JAGS. Whenever I saw code people only define priors for the parameters of the model, but never for parameters of the distribution of the data. Why is that the case?

Take as an example the code below. Priors for beta0 and beta1 are defined, but not for p[i] (like they would if you would simply look for the posterior of p given the data).

dat.list <- with(dat, list(y=y, x=x, N=nrow(dat)))
modelString="
model{
  for (i in 1:N) {
    y[i] ~ dbern(p[i])
    logit(p[i]) <- beta0+beta1*x[i]
  }
  beta0 ~ dnorm(0,1.0E-06)
  beta1 ~ dnorm(0,1.0E-06)
}
"
$\endgroup$
1
  • 1
    $\begingroup$ I strongly suggest you read the JAGS documentation to familiarize yourself with JAGS notation and its meaning. The prior for p[i] is clearly defined via the logit(p[i]) line combined with the definitions of beta0 and beta1 as Normally distributed with means 0 and precisions 1e-6. $\endgroup$
    – jbowman
    Aug 22 at 0:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.