0
$\begingroup$

I would like to generate synthetic data which are ordinal, i.e. ordered, in Python. But how would I do this? What are the differences in generating ordinal data vs categorical data?

I'm reading the paper "Automatic Discovery of the Statistical Types of Variables in a Dataset," by Valera and Ghahramani. In it, they write: "We account for categorical data by sampling a multinomial variable with $R$ categories, where the probability of the categories is sampled from a Dirichlet distribution....To account for ordinal observations, we first sample the first variable in our dataset from a uniform distribution in the interval $(0,R)$, which we randomly divide into $R$ categories that correspond to the ordinal variable in our dataset."

Can someone help me understand the latter part about generating ordinal data? Thank you!

$\endgroup$
0
$\begingroup$

Ordinal data deals with categories, which themselves are ordered by meaning somehow, but we cannot strictly talk about the distance between the categories. In the example below, you can see that the ordinal data runs from awesome to terrible, with 5 categories explaining an entire ordinal range:

ordinal example

Having a look at the paper, it seems the define a uniform distribution $U(a, b)$ (probably continuous), which they then divide into some random categories, let's say 5, to follow the table above. So if we set the bound of the distribution, $a = 0$ and $b = 1$, we might randomly create five categories, such as:

Category :  a      b
----------------------
Awesome  : 0.00 - 0.09
Great    : 0.10 - 0.44
OK       : 0.45 - 0.46
Bad      : 0.47 - 0.59
Terrible : 0.60 - 1.00

We can see that they are ordinal, because they numerical values do signify some kind of meaningful order, but the size of the categories is not necessarily uniform. The authors generated them randomly.

$\endgroup$
  • $\begingroup$ Interesting, thanks for your response. Do you know how to randomly generate the cutoffs, e.g. 0.09 in your example? Also, if the sizes of the categories are uniform, then it's no longer ordinal? What kind of variable is it? Thanks! $\endgroup$ – Rohan Kadakia Jun 18 '18 at 19:15
  • $\begingroup$ A simple suggestion: just randomly pick a number between 0 and 1, say a, then randomly pick a number between a and 1, say b, and randomly pick a number between b and 1, and so on. You could also pick 11 random numbers between e.g. 1-100, then sort them and scale them between 0-1. If this answer helped, please update/mark as solved :-) $\endgroup$ – n1k31t4 Jun 18 '18 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.