Reputation: 75
I am trying to structure a Jags model and find the beta as well as the priors for a Bayesian data analysis.
My model has 3 predictors x1, x2, x3
and the outcome is a Bernoulli distribution variable Y.
How to define the prior probabilities P(Y=1|X1), P(Y=1|X2), P(Y=1|X3)
for the three predictors affecting the outcome Y?
My data are based in a matrix nXr, n=1920 r=4 columns
X1, X2, X3 and Y
.
Upvotes: 0
Views: 94
Reputation: 2583
It sounds like you are asking how to structure a GLM in JAGS. If so, then the easiest way is probably to use the template.jags function in the runjags package to do this for you using something like:
library('runjags')
template.jags(Y ~ X1 + X2 + X3, data=nXr, family='binomial', write.data=FALSE)
## Inspect and edit the JAGSmodel.txt file ##
results <- run.jags("JAGSmodel.txt", data=nXr)
Note that nXr is expected to be a data frame and not a matrix as you say that you currently have. This uses (relatively standard) minimally informative priors for the relevant parameters, but it is HIGHLY ADVISABLE to edit the model file that is created for you in order to adjust the priors as required. I don't know what you mean by 'finding the beta' unless you mean intercept and coefficients for the fixed effects?
If this doesn't help then I think you will need to add some more information to your question - for example more information about your predictors X1-3, what you are trying to achieve exactly, and showing the first few lines of your data wouldn't hurt either.
Upvotes: 1