It sounds like you might want to use a beta distribution for a prior here instead.
Neither a uniform(0,1)
nor normal(0.5,0.5)
prior represents a prior belief that the parameter(s) have mode(s) at 0 and 1. For the uniform(0,1)
prior, there is no mode, and for the normal(0.5,0.5)
prior, the mode is at 0.5.
You can try to find the correct beta distirbution hierarchically by having: beta(a,b)
, where a
and b
are parameters drawn from uniform(0,1)
hyperpriors. A beta distribution is bimodal when its a
and b
parameters are between zero and one, non-inclusive. It is symmetrically bimodal when a
= b
. Alternatively, you can directly model the beta distribution as symmetrically bimodal by guessing beta(0.5,0.5)
unless you have some reason to believe a
and b
are some other value besides 0.5.
Here is the implementation:
parameters {
real<lower=0,upper=1> a;
real<lower=0,upper=1> b;
vector<lower=0,upper=1>[N] bet;
}
model {
a ~ uniform(0,1);
b ~ uniform(0,1);
bet ~ beta(a,b)
}
Or, if you want to enforce symmetry:
parameters {
real<lower=0,upper=1> a;
vector<lower=0,upper=1>[N] bet;
}
model {
a ~ uniform(0,1);
bet ~ beta(a,a)
}
Or to implement it non-hierarchically:
parameters {
vector<lower=0,upper=1>[N] bet;
}
model {
bet ~ beta(0.5,0.5)
}
These assume you have multiple parameters with the same distribution. If not, you would just use real<lower=1,upper=1> bet
instead of vector<lower=1,upper=1>[N] bet
but the rest remains the same.