# Explanatory variables may bias predictions

I' m asking this question out of sheer curiosity, my teacher was not able to explain it.

If I'm using logistic regression with categorical variables they are coded like {1,2,3}. I guess it wouldn't change my results if I used {4,5,6}. But what if linearity of coding wasn't kept? (say {4,10,99})? What I deal with is just the way of coding factor variables but is it possible that the statistical inference could be "distorted" this way? Or, worst case scenario, would I be able to draw nonsense conclusions from categorical data just because they are coded in some way?

The point is that you don't code levels of categorical variables as 1,2,3 even if you call them that. You code them using dummy variables, e.g. $$\begin{array}{l c c} &x_1&x_2\\ \text{level 1} &0 & 0\\ \text{level 2} &1 & 0\\ \text{level 3} &0 & 1\\ \end{array}$$ so that when the linear predictor is given by $$\eta = \beta_0 +\beta_1 x_1 +\beta_2 x_2$$ $\beta_0$ is the log odds for level 1, $\beta_1$ is the log odds ratio between level 2 & level 1, & $\beta_2$ is the log odds ratio between level 3 & level 1. Different coding schemes can be used (see here), changing the interpretation of the coefficients but not materially changing the model (i.e. the same predictor values give the same predicted response).