# Fitting a function with values in [0,1] interval including the boundary (maybe mixture)

I have a serious problem with model construction. I need to find a model for percentages, but my data includes both values inside the 0 - 100 interval and significant number of values also on the boundary.
I have no idea how to construct likelihood.
I cant use binomial from obvious reasons and beta distribution fails to initialize, because always one value will get 0. I was wondering that maybe a mixture of some kind would be good but have no idea how to construct that.

You could use a binomial where you model the log-odds of the proportion as a linear function. It’s just the same as logistic regression except you don’t use the set {0,1} as potential outcomes but rather [0,1].

``````model {
for (n in 1:N) {
n_success[n] ~ binomial(n_trial[n], mu)
}
}
``````

Obviously vectorize if you end up doing this, I write it this way for clarity.

Maybe I’m failing to see what is so obvious about why this doesn’t work.

1 Like

It is obvious that i didn’t know that you can do that! Thanks 😄