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?

  • 5
    $\begingroup$ Have you considered beta regression? $\endgroup$
    – Peter Flom
    May 23, 2012 at 22:45
  • $\begingroup$ 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). $\endgroup$
    – dfrankow
    May 24, 2012 at 3:47
  • $\begingroup$ 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. $\endgroup$ Apr 4, 2014 at 18:23
  • $\begingroup$ 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, $\endgroup$
    – user54518
    Aug 22, 2014 at 8:31

4 Answers 4


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.

  • 3
    $\begingroup$ 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! $\endgroup$ May 23, 2012 at 23:02
  • 7
    $\begingroup$ @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. $\endgroup$ May 23, 2012 at 23:21
  • 5
    $\begingroup$ 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. $\endgroup$
    – Dason
    May 23, 2012 at 23:28
  • 3
    $\begingroup$ 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. $\endgroup$ May 24, 2012 at 2:07
  • 2
    $\begingroup$ 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. $\endgroup$ May 24, 2012 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.

  • 1
    $\begingroup$ 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. $\endgroup$
    – Andy W
    Jun 11, 2013 at 19:53
  • 1
    $\begingroup$ 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) $\endgroup$
    – DocBuckets
    Jun 11, 2013 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.

  • $\begingroup$ -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). $\endgroup$
    – amoeba
    Feb 15, 2017 at 9:11
  • 3
    $\begingroup$ -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. $\endgroup$
    – Nick Cox
    Feb 15, 2017 at 10:20

We can use sample_weights in SVM-C or any other classifier with weights being the ratio. There would be two data points for each data point in the original case:

  1. With 1 as target variable where sample_weight is equal to ratio
  2. With 0 as target variable where sample_weight is (1-ratio).

Consider the effect of sample_weights here on SVM-C https://scikit-learn.org/stable/auto_examples/svm/plot_weighted_samples.html

We can then use the predicted probability for target value 1 as our ratio estimate. Here weights refer to the sample_weights in the fit method of sklearn

  • 3
    $\begingroup$ It is difficult to follow what you mean by "logistic regression with weights," because you haven't specified how you intend a logistic regression to be weighted. $\endgroup$
    – whuber
    Feb 26, 2020 at 16:44
  • $\begingroup$ Here I refer weights as 'sample_weights' which is how we weight each sample in our observation scikit-learn.org/stable/modules/generated/… $\endgroup$
    – Imroz Khan
    Feb 27, 2020 at 16:14
  • 2
    $\begingroup$ There is nothing like a sample weight apparent in the setting of the question. It's unclear what you mean by "proportion percentage"--your language is vague. $\endgroup$
    – whuber
    Feb 27, 2020 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.