# What are Ordinal Variables?

Ordinal variables are variables that deal with ordinal data. As such, they are a subcategory of categorical variables. What characterizes them is that they deal with categories whose values can be compared and organized according to a specific order.

In machine learning, some algorithms can directly work with ordinal variables (for example, decision trees), while others need to transform their values into numerical ones. Although, the latter is usually a requirement from the implementation rather than the algorithm itself. For example, Python’s library scikit-learn requires all input values to be numerical. In many cases, the ordinal variable is transformed into a numerical one to be used by an algorithm and then translated back into ordinal values for data presentation.

There are several approaches for converting ordinal variables into numerical ones. Three well-known methods are ordinal encoding, one-hot encoding, and dummy variable encoding.

Conversely, numerical variables can be converted into ordinal variables by partitioning their respective ranges into bins and assigning their values.

### Why are Ordinal Variables Needed?

Ordinal variables are prevalent in research, where categorical values are considered for the study. Areas that commonly use ordinal variables are governmental studies, sociology, business, economics, finance, and many more, where data is usually collected via questionnaires, observations, or tests.

Ordinal variables are widespread in studies involving machine learning technologies. For example, business and sentiment analysis may consider features such as education level or age groups.

### Ordinal Variables and LogicPlum

LogicPlum’s platform is a modeling tool that uses artificial intelligence and machine learning technologies in an automated manner. The main advantages of this approach are speed and stored knowledge.

Speed allows for re-sampling, training, fast testing, and selecting the best model among all the tested solutions.

Stored knowledge means that the machine’s required algorithms are resolved without the need for human intervention or sound mathematical understanding from the user.

###### Additional Resources

For those who want an in-depth explanation:

- Agresti, Alan (2010)
*Analysis of Ordinal Categorical Data*, Wiley

For those looking for a good summary and an example: