Is there an advantage to ordering a categorical variable?

I was told that it is best to order categorical variables if necessary (for example, short ones are less than average than long ones). I am wondering what is the specific advantage of considering a categorical variable as ordered rather than a simple categorical, in the context of modeling it as an explanatory variable? What does this mean mathematically (preferably in convenient conditions!)?

Many thanks!

+2
source share
3 answers

Among other things, it allows you to compare the values ​​of these factors:

> ord.fac <- ordered(c("small", "medium", "large"), levels=c("small", "medium", "large"))
> fac <- factor(c("small", "medium", "large"), levels=c("small", "medium", "large"))
> ord.fac[[1]] < ord.fac[[2]]
[1] TRUE
> fac[[1]] < fac[[2]]
[1] NA
Warning message:
  In Ops.factor(fac[[1]], fac[[2]]) : < not meaningful for factors

The documentation assumes that simulation results are of great importance:

, -.

, -, , .

+2

, (.. , , ).

, , , . ( ). , , .

, ( , ). R ordinal , ( , ).

, , , .

+1

. , , , , .. , . , / , , ; .

/ ( , , ), , ( , , ).

0
source

All Articles