4
$\begingroup$

I am working on road network data (csv) and my data has 6 features. Two of these features are continues and three of them are categorical. One of the these features is number of lanes of street. This feature shows how many lanes a road has. For instance, a road has two lanes a road has 4 lanes and so on. Plus, following image shows a road which has three lanes (this is an image just to show what is my mean exactly and my data is csv file).

enter image d## Heading ##escription here

I have three questions as follows:

  1. The number of lanes is categorical or numerical? in some resources I read count data are categorical and some resources categorized them as numerical!!!! could you please let me know number of lanes is categorical or numerical?

  2. What approaches you suggest to cluster a data with various data type (mixed quantitative and qualitative)?

  3. Can I transform the continues data to categorical data and then perform clustering analysis?

$\endgroup$
2
  • 1
    $\begingroup$ Counts can be either of the three options: Scale (interval or ratio), categorical (ordinal, most likely), count. The third option, count, means it is a special quantitative feature called "frequency" which is similar but not identical to ratio scale. The choice is the investigator's and in a particular project. $\endgroup$
    – ttnphns
    Commented Aug 30, 2021 at 0:09
  • $\begingroup$ @ttnphns could you please make clear your comment by an example to me how a count data can be ordinal? $\endgroup$
    – Asa Ya
    Commented Aug 30, 2021 at 1:30

2 Answers 2

6
$\begingroup$

The word numerical means 'consisting of numbers' ('expressed in or counted by numbers' in one dictionary). Counts are clearly numerical. Indeed they have a meaningful zero and '6' is literally twice as much as '3' and three times as much as '2' ... and so forth (3 bricks + 3 bricks = 6 bricks, etc,.. so 6 bricks is twice as many bricks as 3 bricks), so if you're considering Stevens' typology, arguably ratio scale to boot.

What matters more is how you see it coming into your model.

If you're reading a book that's telling you how to treat variables based only on the division 'categorical' or not, you may sometimes be led into poor choices of analysis.

You can bin variables. You can forget the bin boundaries and make them into (ordered) categories. You can even ignore the ordering. Every one of those steps result in loss of information, and in many cases the introduction of bias, so the larger question is not whether you can, but whether you should. If you step back from "must use clustering" for a moment, what are you trying to achieve with it?

$\endgroup$
4
  • $\begingroup$ +1 The one caveat that comes to mind is when clearly categorical data are encoded as categories 0, 1, 2, etc, though number of road lanes is not such an instance. $\endgroup$
    – Dave
    Commented Aug 29, 2021 at 22:55
  • 2
    $\begingroup$ Data being on {0,1, 2, ...) doesn't make it a count, though. The variable was explicitly identified as a count in this case. $\endgroup$
    – Glen_b
    Commented Aug 30, 2021 at 0:29
  • $\begingroup$ @Glen_b Thank you so much for your clear description. I tried to change the data type to categorical because the categorical features contain text. For example, one of the road features is road type and its values are highway, local road, second road, and primary road. So I need to convert them to categorical data in order to be able to perform clustering techniques like AHC or k-median on my data. $\endgroup$
    – Asa Ya
    Commented Aug 30, 2021 at 1:41
  • 2
    $\begingroup$ Those are certainly categorical or ordered categorical, but I don't quite see how that relates to the issue of the count of the number of lanes on a given road $\endgroup$
    – Glen_b
    Commented Aug 30, 2021 at 1:52
2
$\begingroup$

In a measurement theory sense, the count of the number of lanes is a ratio variable, since it is meaningful to interpret differences between numbers of lanes and ratios of numbers of lanes. This means that you have the option of treating this variable either as a nominal, ordinal, or ratio variable in your statistical mode. The choice of whether to treat the number-of-lanes as a categorical variables is a modelling choice that will depend on the degree of flexibility you wish to have in how the number-of-lanes might be statistically related to the outcome variable. (It is not really helpful to ask if it is "numeric" --- that term largely refers to the way in which statistical computing packages store a variable, rather than referring to a measurement scale.)

For example, if you were to treat the number-of-lanes as a categorical variable, there will be no constraint on the effect of each category on the outcome. Now, there is obviously an ordinal aspect to the number-of-lanes variable, with more lanes indicating a larger type of road, so you might decide you want to constrain the effects of the categories so that they obey some kind of ordinal (or perhaps even linear) effect size on the outcome variable. This is a modelling choice you will need to make based on a combination of things; the a priori coherence of possible effects, the empirical data, diagnostic testing, etc.

$\endgroup$
1
  • $\begingroup$ Thank you so much for your response. Could you please look at [stats.stackexchange.com/questions/541937/… and let me your answer? if it is wrong that I call you in the comments, I apologize in advance and I will do not that again. $\endgroup$
    – Asa Ya
    Commented Aug 30, 2021 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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