Reputation: 751
I am conducting a logit regression analysis in winbugs from R. I have to force all of the coefficients of this model to be positive. Therefore, I used uniform priors for all of the coefficients, but winbugs is not happy with that: it generates a silly error windows. When I used dnorm(0.0,1.0E-4))
as prior for all the coefficients, the problem was solved. What can be done to obtain positive betas in this model given below?
model
{
for (i in 1:m) {
# Linear regression on logit
logit(p[i]) <- beta.concern2*DCEconcern2[i] + beta.concern3*DCEconcern3[i] + beta.concern4*DCEconcern4[i] + beta.concern5*DCEconcern5[i] +
beta.breath2*DCEbreath2[i] + beta.breath3*DCEbreath3[i] + beta.breath4*DCEbreath4[i] + beta.breath5*DCEbreath5[i] +
beta.weath2*DCEweath2[i] +beta.weath3*DCEweath3[i] +beta.weath4*DCEweath4[i] +beta.weath5*DCEweath5[i] +
beta.sleep2*DCEsleep2[i] +beta.sleep3*DCEsleep3[i] +beta.sleep4*DCEsleep4[i] +beta.sleep5*DCEsleep5[i] +
beta.act2*DCEact2[i] +beta.act3*DCEact3[i] +beta.act4*DCEact4[i] +beta.act5*DCEact5[i]
y2[i] ~ dbern(p[i])
}
beta.concern2 ~ dunif(0,100)
beta.concern3 ~ dunif(0,100)
beta.concern4 ~ dunif(0,100)
beta.concern5 ~ dunif(0,100)
beta.breath2 ~ dunif(0,100)
beta.breath3 ~ dunif(0,100)
beta.breath4 ~ dunif(0,100)
beta.breath5 ~ dunif(0,100)
beta.weath2 ~ dunif(0,100)
beta.weath3 ~ dunif(0,100)
beta.weath4 ~ dunif(0,100)
beta.weath5 ~ dunif(0,100)
beta.sleep2 ~ dunif(0,100)
beta.sleep3 ~ dunif(0,100)
beta.sleep4 ~ dunif(0,100)
beta.sleep5 ~ dunif(0,100)
beta.act2 ~ dunif(0,100)
beta.act3 ~ dunif(0,100)
beta.act4 ~ dunif(0,100)
beta.act5 ~ dunif(0,100)
}
Upvotes: 1
Views: 1242
Reputation: 59565
In your case, I would prefer half flat normal, i.e. something like
dnorm(0, 1.0E-8)I(0, 1.0E8)
Give it a shot.
EDIT: the added I(a, b)
just limits the distribution to the interval from a
to b
.
Upvotes: 0
Reputation: 871
Try
dnorm(0, 1.0E-8)I(0, 1.0E8)
Notice the 1.0 instead of the 10, which was causing the "expected right parenthesis" error.
Upvotes: 1