# Can I use logistic regression when all of the regressors sum to 1?

Let's say I want to perform a logistic regression (binomial) as :

X ~ P1 + P2 + P3 + P4 + P5


where X is binary variable (0 or 1) and P1, P2, P3, P4, P5 are proportion of cell type ( e.g. P1 = proportion of T-cells ; P2 = proportion of B-Cells, etc..). The sum of P1, P2, P3, P4 and P5 is 1 for each observation.

Can I perform a univariate regression for each Px variable e.g X ~ P1 and a multivariate regression with all Px variables knowing that the sum of all Px is always 1 ?

• Multivariate regression means multiple responses, not multiple predictors. The fashion for calling a regression with one predictor univariate seems bizarre to me: I can think of nothing more intrinsically bivariate than the relationship between two variables.. That said, it is common to omit one predictor in these circumstances. Commented Dec 6, 2022 at 12:04
• All of the $P_i$ summing to 1 implies that the design matrix with an intercept is rank-deficient. Excluding the intercept or one of the $P_i$ will fix that.
– Sycorax
Commented Dec 6, 2022 at 12:35
• ... or regularize, e.g., using GLMNet. Commented Dec 6, 2022 at 12:55

Variables representing parts of a total, like your proportion of cell type, are called , for more information you can peruse that tag.

But in your case the solution is simple. Your design matrix will be rank-deficient, since the sum P1 + P2 + P3 + P4 + P5 will equal the intercept. That way the intercept is included in the design matrix in two different ways. The most practical (that is, interpretable) solution is to omit the intercept from the model. In R that would be something like

glm(X ~ 0 + P1 + P2 + P3 + P4 + P5, family=binomial,
data=your_data_frame)


The ~ 0 + part of the formula means omit the intercept.

User whuber points to another sort of analysis, using logratio transformation. See How to perform isometric log-ratio transformation

• This can also be accomplished by using -1 instead of 0 right? Commented Dec 6, 2022 at 13:18
• @ShawnHemelstrand: Correct. Commented Dec 6, 2022 at 13:23
• Thank you for the tip. Other question regarding P1, P2, P3, etc.. One of the regressor has a much higher value than the other ones i.e. P1 has on average 0.90 and the other P2, P3, P4 and P5 sums to the remaing 0.10. Should I scale each Px ( e.g. using R scale() function ) prior the regression ? Thanks Commented Dec 6, 2022 at 13:48
• @NicolasRosewick: I cannot see any reason to do so. For the future, please ask new questions as formally new questions and not as follow-up comments. The include more information such as sample size. Commented Dec 6, 2022 at 13:52
• @NicolasRosewick When your variables tend to be at extreme values (near 0 or 1), sometimes (often?) a suitable transformation will improve your model. See stats.stackexchange.com/a/259223/919 for details. The family of transformations discussed there will automatically solve your rank-deficiency problem, because your five variables will be transformed into four variables containing all the relevant information.
– whuber
Commented Dec 6, 2022 at 16:49