Dealing with 0,1 values in a beta regression

I have some data in [0,1] which I would like to analyze with a beta regression. Of course something needs to be done to accommodate the 0,1 values. I dislike modifying data to fit a model. also I don't believe that zero and 1 inflation is a good idea because I believe in this case one should consider the 0's to be very small positive values (but I don't want to say exactly what value is appropriate. A reasonable choice I believe would be to pick small values like .001 and .999 and to fit the model using the cumulative dist for the beta. So for observations y_i the log likelihood LL_iwould be

 if  y_i < .001   LL+=log(cumd_beta(.001))
else if y_i>.999  LL+=log(1.0-cum_beta(.999))
else LL+=log(beta_density(y_i))


What I like about this model is that if the beta regression model is valid this model is also valid, but it removes a bit of the sensitivity to the extreme values. However this seems to be such a natural approach that I wonder why I don't find any obvious references in the literature. So my question is instead of modifying the data, why not modify the model. Modifying the data biases the results (based on the assumption that the original model is valid), whereas modifying the model by binnning the extreme values does not bias the results.

Maybe there is a problem I am overlooking?

• It isn't really possible to give a good answer to this question without knowing more about the particular problem. The key question is whether the exact zeros and ones are generated by a different process to that which generates the data in (0,1). A classic example is rainfall, where there are exact zeros reflecting days where it doesn't rain. In your application are zeros and ones "special" in some way? – Dikran Marsupial Oct 10 '12 at 11:31
• Related/duplicate: stats.stackexchange.com/questions/48028. – amoeba Feb 17 '17 at 23:06

4 Answers

According to this paper, an appropriate transformation is

$$x' = \frac{x(N-1) + s}{N}$$

"where N is the sample size and s is a constant between 0 and 1. From a Bayesian standpoint, s acts as if we are taking a prior into account. A reasonable choice for s would be .5."

This will squeeze data that lies in $[0,1]$ to be in $(0,1)$. The above quote, and a mathematical reason of the transformation is available in the paper's supplementary notes.

• +1 .. But could you fix the first link or at least cite the paper so we can find it independently? – whuber Jun 28 '12 at 21:19
• But that does not answer my question. I am well aware that one can transform the data. My questions is why not transform the model instead? – dave fournier Jun 29 '12 at 13:00
• Dave, then please edit your question to reflect this: currently, it reads as if you are looking for a way to transform the data. In the process it would help for you to indicate what you think the difference is between a data transformation and a change of model, because if there is one, it is subtle. – whuber Jun 29 '12 at 13:23
• @davefournier, If you read the paper Cam sites it in part addresses your question. They also give alternate model recommendations (see page 69), and part of the recommendations hinge on the nature of the data. Your adjusted likelihood looks like the "mixed discrete-continous process" (mentioned towards the end of page 69). It may also be the case the Tobit model will be satisfactory given your data, although it would be best to see other references for the appropriateness of the Tobit model, like Scott Long's book on categorical regression. – Andy W Jun 29 '12 at 15:43
• But they don't take this approach. They propose a different model, a mixed discrete continuous process. That is very different from binning the extreme values. As I said before if the beta model is valid then the binning model is valid. If the discrete continuous model is valid then the beta model is invalid. I suspect that they were mostly driven in their analysis by the kinds of mixed models they could fit with their software. The binned beta mixed model is a bit more difficult to fit. – dave fournier Jun 29 '12 at 15:59

Dave,

A common approach to this problem is to fit 2 logistic regression models to predict whether a case is 0 or 1. Then, a beta regression is used for those in the range (0,1).

The beta distribution follows from the sufficient statistics $(\log(x), \log(1-x))$. Do those statistics make sense for your data? If you have so many zeros and ones, then it seems doubtful that they do, and you might consider not using a beta distribution at all.

If you were to choose the sufficient statistic $x$ instead (over your bounded support), then I believe you end up with a truncated exponential distribution, and with $(x,x^2)$ a truncated normal distribution.

I believe that both are easily estimated in a Bayesian way as they are both exponential families. This is a modification of the model as you were hoping.

I think the actual "correct" answer to this question is zero-one inflated beta regression. This is designed to handle data that vary continuously on the interval [0,1], and allows many real 0's and 1's to be in the data. This approach fits three separate models in a bayesian context, similar to what @B_Miner proposed.

Model 1: Is a value a discrete 0/1, or is the value in (0,1)? Fit with a bernoulli distribution.

Model 2: Fit discrete subset with a bernoulli distribution.

Model 3: Fit (0,1) subset with beta regression.

For prediction, the first model results can be used to weight the predictions of models 2 and 3. This can be implemented within the zoib R package, or home-brewed in BUGS/JAGS/STAN/etc.