Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I wonder what are the better approaches to categorize continuous data (e.g. age) than dividing them with the use of quantiles and cut function (in R). I have heard about using trees to divide data in the way which takes into consideration how a division would differentiate a response variable, but I cannot find any quick reasonable explanation for that. I want to categorize my data with the aim of using them in multinomial logit model.

Is there any other approach to do it? (Little off-topic: I use R so I would be grateful for some package references or something like this.)

share|improve this question

1 Answer 1

up vote 5 down vote accepted

In general, the better approach is not to categorize a continuous variable at all without really good reasons. You are discarding information, as seen by the fact that the categorization cannot be reversed to recover the original. Usually the resulting categorical variable(s) are more difficult to handle in any case than a single continuous variable.

One argument sometimes used for categorization is that measurements may be unreliable, but throwing away information just degrades a variable further.

Specifically, here the motive is stated to be to use a multinomial logit model. You can use age as a continuous predictor in a multinomial logit model, so you presumably want a categorized age to be a response in such a model. The substantive logic is not obvious there either; it is the passage of time, not predictors, makes people (or organisms or organisations) one age rather than another. I can think of examples where age makes sense as a response, e.g. age of prey in ecology, but I'd be surprised at age being a defensible choice of response in most problems. You gave age as an example, but the question applies more broadly: is your chosen response a suitable choice scientifically?

Note that how to do what you ask in R is off-topic here.

share|improve this answer
Thank you for your response. Well, age is not my reposne variable, but one of the independent variables in the model. I am working with quite large data set (> 100k obs and 10 vars). 3 of the independent variables are numeric (age is one of them) and using all of them while building a model causes a memory error in my computer (Reached total allocation of 16301Mb: see help(memory.size)). So I decided to categorize them. After categorization I am able to build model ("working model", let's say). –  Marciszka Mar 9 at 11:30
I can see no reason why using age as a continuous predictor should cause this problem as compared with categorizing it. A dataset of this size is not really large by modern standards. Your problem is really a problem with your use of R and should be asked directly by describing the data and the R command used: it is not clear why the program needs several Gb to do its work! The problem may well have a statistical misunderstanding at its heart, so you could try posting it separately here, but I doubt there is enough information in your comment to diagnose the mistake. –  Nick Cox Mar 9 at 11:38
Ok, I am going to investigate it further. Thank you! –  Marciszka Mar 9 at 11:40
Try creating a reproducible example and posting to stackoverflow. Also Hadley Wickham provides an overview of memory usage in R. –  jthetzel Mar 9 at 11:55
I cannot think of a way that doing a worse analysis by categorizing a nice continuous variable would save memory or computer time. –  Frank Harrell Mar 9 at 13:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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