19
$\begingroup$

Suppose I want to build a model to predict some kind of ratio or percentage. For example, let's say I want to predict the number of boys vs. girls who will attend a party, and features of the party I can use in the model are things like amount of advertising for the party, size of the venue, whether there will be any alcohol at the party, etc. (This is just a made-up example; the features aren't really important.)

My question is: what's the difference between predicting a ratio vs. a percentage, and how does my model change depending on which I choose? Is one better than the other? Is some other function better than either one? (I don't really care about the specific numbers of ratio vs. percentage; I just want to be able to identify which parties are more likely to be "boy parties" vs. "girl parties".) For example, I'm thinking:

  • If I want to predict a percentage (say, # boys / (# boys + # girls), then since my dependent feature is bounded between 0 and 1, I should probably use something like a logistic regression instead of a linear regression.
  • If I want to predict a ratio (say, # boys / # girls, or # boys / (1 + # girls) to avoid dividing-by-zero errors), then my dependent feature is positive, so should I maybe apply some kind of (log?) transformation before using a linear regression? (Or some other model? What kind of regression models are used for positive, non-count data?)
  • Is it better generally to predict (say) the percentage instead of the ratio, and if so, why?
$\endgroup$
  • $\begingroup$ Depending on your particular application and what you are trying to model, you should consider using Compositional Data Analysis (en.wikipedia.org/wiki/Compositional_data); there are some subtle things to consider when the features (independent variables) sum to unity. Please see the work of John Aitchison. $\endgroup$ – ctbrown Nov 14 '14 at 0:56
8
$\begingroup$

I've never seen a regression model for ratios before, but regression for a percentage (or more commonly, a fraction) is quite common. The reason may be that it's easy to write down a likelihood (probability of the data given your parameter) in terms of a fraction or probability: each element has a probability $p$ of being in category $A$ (vs. $B$). The estimate of $p$ is then the estimated fraction.

Note however: it's not standard to make a linear model for a fraction; more common is a generalized linear model, which is a linear model along with an invertible, nonlinear 'link' function that controls the range of the desired model (here $[0,1]$).

The most common model for fractions is (as you noted) logistic regression, which allows you to use regressors on the real line but have a fraction constrained to live on [0,1]. However, logistic regression is technically a model for binary data, meaning you observe a series of events where each input (set of independent variables) produces an independent observation of $0$ or $1$. For the case where you just have a population divided into two different classes (i.e., and you don't have separate regressors for each member of the population), you might want binomial regression.

That being said, there's probably nothing to stop you from writing down a generalized linear model (GLM) for ratios. (Logistic and binomial regression are also GLMs). You'd need to pick a function mapping from the input space to the space of possible ratios (e.g., $\log$), then write down your likelihood in terms of the resulting ratio.

$\endgroup$
14
$\begingroup$

Echoing the first answer. Don't bother to convert - just model the counts and covariates directly.

If you do that and fit a Binomial (or equivalently logistic) regression model to the boy girl counts you will, if you choose the usual link function for such models, implicitly already be fitting a (covariate smoothed logged) ratio of boys to girls. That's the linear predictor.

The primary reason to model counts directly rather than proportions or ratios is that you don't lose information. Intuitively you'd be a lot more confident about inferences from an observed ratio of 1 (boys to girls) if it came from seeing 100 boys and 100 girls than from seeing 2 and 2. Consequently, if you have covariates you'll have more information about their effects and potentially a better predictive model.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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