# Regression for an outcome (ratio or fraction) between 0 and 1

I am thinking of building a model predicting a ratio $a/b$, where $a \le b$ and $a > 0$ and $b > 0$. So, the ratio would be between $0$ and $1$.

I could use linear regression, although it doesn't naturally limit to 0..1. I have no reason to believe the relationship is linear, but of course it is often used anyway, as a simple first model.

I could use a logistic regression, although it is normally used to predict the probability of a two-state outcome, not to predict a continuous value from the range 0..1.

Knowing nothing more, would you use linear regression, logistic regression, or hidden option c?

• Have you considered beta regression? – Peter Flom - Reinstate Monica May 23 '12 at 22:45
• Many thanks to all who answered. I will have to study up and choose. Sounds like a beta is a decent place to start, especially if I can observe a good fit (perhaps by eye). – dfrankow May 24 '12 at 3:47
• I've seen this done using GLM (poisson link function). The numerator a would be the count data (the outcome) and the denominator b would be the offset variable. You would then need separate a and b values for each subject/observation. I'm just not sure if this is the most valid option. I find the Beta distribution an interesting option - one that I had not heard of. However, I find it difficult to grasp, being a non-statistician. – MegPophealth Apr 4 '14 at 18:23
• Thank you all of you for your deep and useful analysis, I am currently facing almost the same challenge, but instead of predicting a continuous ratio range between 0-1, I rather want to build a regression model to predict patients utility range between -1 and 1. This is quite tricky, I couldn't find any link function appropriate to build a regression model with a continuous dependent range between -1 and 1. So guys just want to have clue about what could be done. Thanks, – user54518 Aug 22 '14 at 8:31
• For the moment, there is a trivial answer: rescaling response $y$ by $(y+1)/2$ brings any link for $[0,1]$ in range, after which you can rescale for reporting predictions if you so wish. – Nick Cox Aug 22 '14 at 8:49

You should choose "hidden option c", where c is beta regression. This is a type of regression model that is appropriate when the response variable is distributed as Beta. You can think of it as analogous to a generalized linear model. It's exactly what you are looking for. There is a package in R called betareg which deals with this. I don't know if you use R, but even if you don't you could read the 'vignettes' anyway, they will give you general information about the topic in addition to how to implement it in R (which you wouldn't need in that case).

Edit (much later): Let me make a quick clarification. I interpret the question as being about the ratio of two, positive, real values. If so, (and they are distributed as Gammas) that is a Beta distribution. However, if $a$ is a count of 'successes' out of a known total, $b$, of 'trials', then this would be a count proportion $a/b$, not a continuous proportion, and you should use binomial GLM (e.g., logistic regression). For how to do it in R, see e.g. How to do logistic regression in R when outcome is fractional (a ratio of two counts)?

Another possibility is to use linear regression if the ratios can be transformed so as to meet the assumptions of a standard linear model, although I would not be optimistic about that actually working.

• Would you mind elaborating on why beta regressions would be preferable in this case? That's a recommendation I see fairly often here, but I don't really see anyone elaborating on the rationale - that would be nice to have! – Matt Parker May 23 '12 at 23:02
• @MattParker, Beta is the distribution of continuous proportions--if that's what you have as your response variable, then Beta is the appropriate distribution to use. It's really that simple. The fitted value from a logistic regression is a probability (which is obviously continuous), but the distribution is binomial (some number of Bernoulli trials w/ success probability $p$) if your response variable is not a set of Bernoulli trials, then LR is not appropriate. – gung - Reinstate Monica May 23 '12 at 23:21
• I would be careful saying that a beta is "the" appropriate distribution to use. It's fairly flexible and it might be appropriate but it doesn't cover all cases. So while it's a good suggestion and may very well be what they want - you can't really say that it's the appropriate distribution solely on the fact that it's a continuous response between 0 and 1. – Dason May 23 '12 at 23:28
• A triangular distribution on [0,1] represents a continuous distribution on proportions that is not a beta. There could be many others. The beta is a nicw flexible family but there is nothing magic about it. You do make a good point about logistic regression because it is usuaLLY applied to binary data. – Michael R. Chernick May 24 '12 at 2:07
• Perhaps I should try to seem less dogmatic. What I meant is that you examine your DV & use the distribution it follows. True, there are other distributions of continuous proportions. Technically, Beta is the ratio of a Gamma over the sum of it + another Gamma. In a given situation, a different distribution could be superior; eg Beta cannot take the values 0 or 1, only (0, 1). Nonetheless, Beta is well understood and very flexible with just 2 parameters to fit. I argue that when dealing w/ a DV that is a continuous proportion it is typically the best place to start. – gung - Reinstate Monica May 24 '12 at 2:27

Are these paired samples or two independent populations?

If independent populations, you might consider log(M) = log(B) + $X_i$*log(ratio). M is your measurement (a vector containing all values of A and B) and X is a vector $X_i$ = 1 if $M_i$ is a value of A, $X_i$ = 0 if $M_i$ is a value of B.

Your intercept of this regression will be log(B) and your slope will be log(ratio).

See more here:

Beyene J, Moineddin R. Methods for confidence interval estimation of a ratio parameter with application to location quotients. BMC medical research methodology. 2005;5(1):32.

EDIT: I have written an SPSS addon to do just this. I can share it if you're interested.

• Out of curiosity which method did you use (delta, Fieller or GLM)? It slays me a bit that the BMC article did not do some simulations of the coverage of the different estimators (although to dream up a realistic simulation would be annoying). I was reminded because I recently came across a paper that does the delta method (with no real justification), although it does cite the BMC article. – Andy W Jun 11 '13 at 19:53
• Back when I wrote this comment, I used REGRESSION after log-transforming the data. Since then I've written a more sophisticated version that uses GLM. I deal with light emission measurements and my testing suggested gamma regression with a log-link was the least prone to runaway uncertainty on the parameters. For most of my real data, the answers from using normal, negative-binomial, and gamma with log-link were all really similar (at least to the precision I needed) – DocBuckets Jun 11 '13 at 21:52

Not true. The data for logistic regression is binary 0 or 1 but the model predicts p say the probability of success given the predictors $X_i$, $i=1,2,..,k$ where $k$ is the number of predictor variables in the model. Actually because of the logit function the linear model predicts the value of log($\frac{p}{1-p}$). So to get the prediction for p you just do the inverse transformation $p=\frac{\exp(x)}{[1+\exp(x)]}$ where $x$ is the predicted logit.

• -1. I don't see how this answers the question (and in addition $p$ is used to refer to two different things in this answer). – amoeba says Reinstate Monica Feb 15 '17 at 9:11
• -1. I agree with @amoeba. I am puzzled why this was ever upvoted. It does not bear on the question, which doesn't assume binary data 0 or 1 at all but is focused on measured proportions which are between 0 and 1 inclusive. – Nick Cox Feb 15 '17 at 10:20