Categorical and ordinal feature data representation in regression analysis? <p>I am trying to fully understand difference between categorical and ordinal data when doing regression analysis. For now, what is clear:</p> <p><strong>Categorical feature and data example:</strong><br> Color: red, white, black <br> Why categorical: <code>red &lt; white &lt; black</code> is logically <strong>incorrect</strong></p> <p><strong>Ordinal feature and data example:</strong><br> Condition: old, renovated, new <br> Why ordinal: <code>old &lt; renovated &lt; new</code> is logically <strong>correct</strong></p> <p><strong>Categorical-to-numeric and ordinal-to-numeric encoding methods: <br></strong> One-Hot encoding for categorical data <br> Arbitrary numbers for ordinal data</p> <p><strong>Categorical data to numeric:</strong></p> <pre><code>data = {'color': ['blue', 'green', 'green', 'red']} </code></pre> <p>Numeric format after One-Hot encoding:</p> <pre><code> color_blue color_green color_red 0 1 0 0 1 0 1 0 2 0 1 0 3 0 0 1 </code></pre> <p><strong>Ordinal data to numeric:</strong></p> <pre><code>data = {'con': ['old', 'new', 'new', 'renovated']} </code></pre> <p>Numeric format after using mapping: Old &lt; renovated &lt; new → 0, 1, 2</p> <pre><code>0 0 1 2 2 2 3 1 </code></pre> <p>In my data I have 'color' feature. As color changes from white to black price increases. From above mentioned rules I probably have to use one-hot encoding for categorical 'color' data. But why I cannot use ordinal representation. Below I provided my observations from where my question arised.</p> <p>Let me start with introducing formula for linear regression: <a href="https://i.stack.imgur.com/mbiK6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mbiK6.jpg" alt="enter image description here"></a> <br>Let have a look at data representations for color: <a href="https://i.stack.imgur.com/Veb54.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Veb54.jpg" alt="enter image description here"></a> Let's predict price for 1-st and 2-nd item using formula for both data representations:<br> <strong>One-hot encoding:</strong> In this case different thetas for different colors will exist. I assume that thetas already derived from regression (20, 50 and 100). Prediction will be: </p> <pre><code>Price (1 item) = 0 + 20*1 + 50*0 + 100*0 = 20$ (thetas are assumed for example) Price (2 item) = 0 + 20*0 + 50*1 + 100*0 = 50$ </code></pre> <p><strong>Ordinal encoding for color:</strong> In this case all colors will have 1 common theta but my assigned multipliers (10, 20, 30) differ:</p> <pre><code>Price (1 item) = 0 + 20*10 = 200$ (theta assumed for example) Price (2 item) = 0 + 20*20 = 400$ (theta assumed for example) </code></pre> <p>In my model White &lt; Red &lt; Black in prices. Seem to be that correlation works correctly and it is logical predictions in both cases. For ordinal and categorical representations. So I can use any encoding for my regression regardless of the data type (categorical or ordinal)? This division in data representations is just a matter of conventions and software-oriented representations rather than a matter of regression logic itself?</p>