# Can we use bounded continuous variables as predictors in regression and logistic regression?

I am currently looking at a cheminformatics problem where I am looking at the relationship between chemical structure and reactivity, e.g. how the angle at which two molecules approach each other affects the rate of the subsequent reaction. Obviously, the angle can only vary between 0° and 360°.

This is "quick check" question from a cautious non-statistician. I understand that in regression analysis, the dependent variable must be continuous and unbounded. I just wondered - do continuous predictor variables in regression need to be unbounded too? Instinctively I assume not.

• The angle can be considered unbounded, you just have to consider that, for instance, 520° = 160°. (Note that this is a "quick comment" from another non-statistician, so please take it with care) – nico May 9 '11 at 19:50
• An old question, but something about the answers puzzles me: in many circular statistics cases, it seems that you have to consider that 0 and 360 are the same and that 5 and 355 are actually closer together than 5 and 20. Does it not matter in this case? – Wayne Feb 13 '12 at 14:02

The condition that dependent variables must be "continuous and unbounded" is unusual: there is no mathematical or statistical requirement for either.

In most regression models we posit that the dependent variable be a linear combination of the independent variables plus an independent random error term of zero mean, approximately and within the ranges attained by, or potentially attained by, the independent variables. For instance, it would be fine to regress the length of the Mississippi River on time for the period 1700 - 1850 but not to project the regression back, say, a million years or forward 700 years:

In the space of one hundred and seventy-six years the Lower Mississippi has shortened itself two hundred and forty-two miles. That is an average of a trifle over one mile and a third per year. Therefore, any calm person, who is not blind or idiotic, can see that in the Old Oolitic Silurian Period, just a million years ago next November, the Lower Mississippi River was upwards of one million three hundred thousand miles long, and stuck out over the Gulf of Mexico like a fishing-rod. And by the same token any person can see that seven hundred and forty-two years from now the Lower Mississippi will be only a mile and three-quarters long, and Cairo and New Orleans will have joined their streets together, and be plodding comfortably along under a single mayor and a mutual board of aldermen. There is something fascinating about science. One gets such wholesale returns of conjecture out of such a trifling investment of fact.

(Mark Twain, Life on the Mississippi.)

In the present case it sounds like the angle is an independent variable, not the dependent one, so this question does not even arise. The problem that arises is that the angle seems to be defined only modulo 360 degrees (actually mod 180). Actually, the angle is really a latitude and varies from 0 to 180 (or -90 to 90) without "wrapping around" at all. Really, then, all that matters is how best to express this angle: does the reaction rate vary linearly with the angle or does it vary perhaps with its sine or cosine? Or maybe its tangent, which is unbounded? But that matter is addressed with appropriate exploratory analysis, perhaps by some stereochemical considerations, and standard procedures to fit and check models. Therefore this angular variable neither enjoys nor suffers from any special quality that would distinguish it from other independent variables.

• +1 for discussing the the real question: how to proper model the relationship: is it linear? angular? etc. Theory might help here. – Manoel Galdino May 9 '11 at 21:37
• @Manoel You're right about the theory. The problem is related to steric hindrance: not only does the angle matter, but (fixing an orientation of one of the molecules), the orientation of the other molecule likely matters as much or more. The approach angle and the relative orientation closely interact: it's a question of geometry. This simple analysis already provides guidance concerning how the angle of approach might be modeled and indicates it's not going to enter as a simple variable. – whuber May 9 '11 at 22:02

With respect to the question in the header With logistic regression predicting posterior probabilities, the dependent variable (outcome) is both bounded and continuous.

One train of thoughts to arrive at logistic regression in fact is thinking how to construct a regression with limits for the continuous outcome.

1. You want e.g. to do a regression directly on the probability
2. "Common" regression methods (e.g. linear regression) give you continuous output in the set of real numbers, $\mathbb R$.
3. But probabilities are in [0, 1]
4. So put a sigmoid transformation into your model to transform $\mathbb R \mapsto [0, 1]$
5. If you choose the logistic function $\frac{1}{1 + e^{-x}}$ (a standard choice of a sigmoid), you end up with logistic regression.

With respect to modeling angles in general I'd like to follow up with another question: how to model cyclic behaviour, how would I tell a model that 359° is almost the same as 0° (regardless of whether the variable is dependent or independent)?

• @cb Please note that some angles are not cyclic: the approach angle in the original question is a good example. If you have a specific follow-up question, why not post it? – whuber May 14 '11 at 18:03
• @cb Concerning your answer: the dependent variable is not continuous; it is either 0 or 1. Logistic regression is not the same as applying the logistic transformation to the independent variable and then regressing the {0,1} dependent variable on it. – whuber May 14 '11 at 18:05
• @whuber: I did not post it as own question as the original question made me curious - it is very closely related to the original question. However, if the policy here is that questions have to be their own thread, regardless how closely they relate to previous questions, I'll do that from now on. OK thanks. should I do that now, or should we leave this here where it once is. Being a chemist and no statistician, I do have follow up questions to your comment... – cbeleites May 14 '11 at 18:42
• @cb Curiosity is a great reason to post a question! You can add a link to this question if you want to give a context to your question. – whuber May 14 '11 at 18:43
• (I'm posting still here, as most of this is again more related to the chemistry of the initial question). @whuber: For me steric hindrance doesn't seem the same kind of bound as the limits that concentrations cannot be positive or that a probability must be in [0, 1]. The angle in an actual reaction may never take certain values, but those values are still part of the concept of an angle. Just like the height of a person may never take the value of 10 m, yet I wouldn't say modeling the height of persons needs a bound on the outcome. – cbeleites May 14 '11 at 19:21