6
$\begingroup$

I have data containing some continuous and some categorical variables. I want to do logistic regression on them. I am getting confused over the distinction between categorical and continuous variables. I know that a categorical variable "is a variable that can take on one of a limited, and usually fixed, number of possible values. Still, I am having trouble distinguishing some of these variables".

If I understand correctly the answers given here, non numerical data cannot be continuous, but are some numerical variables categorical?

For instance, one of the variables is "number of days during which have done something". This variable has many possible outputs (from number of days = 1 to 10,000). The number of possible values is limited, yet very big. Is it a categorical or a continuous variable?

$\endgroup$
6
  • $\begingroup$ What if I told you that -- since all numbers and symbols in a real-life computing environment must be represented in a finite number of bits -- all variables are categorical? $\endgroup$
    – Hong Ooi
    Commented Jul 19, 2013 at 11:38
  • 2
    $\begingroup$ @Hong Ooi Your comment confounds a conceptual definition, useful in the modeling process, with a matter of computation. They are not equivalent. For instance, when we model the sampling distribution of a mean with a Normal distribution, it is irrelevant that the 32-bit or 64-bit numeric representations we compute with are finite in number. The Normal distribution remains continuous despite that. More relevant here is "why do we even care?" In logistic regression the dependent variable must be binary and how we choose to characterize the IVs is determined by their meanings. $\endgroup$
    – whuber
    Commented Jul 19, 2013 at 14:00
  • $\begingroup$ @whuber sure, but the OP didn't mention theoretical concepts like random variables either. Now you've got me explaining teh joke. $\endgroup$
    – Hong Ooi
    Commented Jul 19, 2013 at 14:13
  • $\begingroup$ @whuber There is a very serious literature in philosophy of math on finitism. It's kind of like hyperreal numbers which can remove the need for a concept of the infinitesimal or limit operation in calculus. Obviously, in an applied sense, people don't care about the distinction, but the philosophical problem of whether all variables are categorical and that there is no such thing as a continuous quantity (even in semantic structures in modeling) is taken very seriously in POM. $\endgroup$
    – ely
    Commented Aug 15, 2013 at 18:34
  • 1
    $\begingroup$ Thanks, @EMS. In the present context, though, I think the issue is neither mathematical nor philosophical, but one of practical data analysis. If you conceive of this variable as being continuous then you will take a modeling approach that parsimoniously uses non-linear re-expressions and perhaps splines to identify (or create) relationships with other variables. These allow for a certain amount of interpolation, too. If you conceive of it as categorical you cannot do any of this: you will study the association of each category separately and there is no possibility of interpolation. $\endgroup$
    – whuber
    Commented Aug 15, 2013 at 18:40

2 Answers 2

12
$\begingroup$

There is, as far as I know, no taxonomy of variables that captures all the contrasts that might be important for some theoretical or practical purpose, even for statistics alone. If such a taxonomy existed, it would probably be too complicated to be widely acceptable.

It is best to focus on examples rather than give numerous definitions. Number of days is a counted variable. It qualifies as discrete rather than continuous, and it is possible that the discreteness is important, particularly if most values are small. Some statistical people might want to insist that only models that apply to discrete variables should be used for such a variable.

At the same time, it is often the case that models and methods treat such a variable as approximately continuous. Population size is a yet more obvious example. Human populations can be in billions and many procedures effectively treat such variables as continuous, regardless of the familiar fact that people are individuals.

In contrast, a variable such as temperature is in principle continuous, but as a matter of convention temperatures may only be reported to the nearest degree or tenth of a degree, so the number of possible values may be rather small in practice. This does not usually worry anyone; it would certainly be perverse to call such a variable categorical. There are some contexts in which the discreteness of reported temperature is important: in reading mercury thermometers by eye and guessing at the last digit, people show idiosyncratic preferences for or against certain digits of the ten possibilities 0 to 9.

Also, what do we do with categories? Answer: we count them. We count males, females; unemployed, employed, retired, students; whatever. So, often we are modelling category counts.

In short, discrete counts are a common kind of variable, as well as continuous and categorical variables.

$\endgroup$
3
$\begingroup$

I think that for your purposes the distinction between categorical, ordinal and scalar variables is more relevant, where a scalar variable may have either discrete or pseudo-continuous values, but the units in which they are measured have identical sizes or intervals. For example, very few people need to consider the number of quanta, atoms, photons, etc. as their numbers in everyday measurements are so vast. Really it comes down to what you consider reasonable for the purposes of your study, so for example I would regard a range of 1-10000 with intervals of one as continuous and would probably even consider a range of 1-50 similarly, but not lesser ranges (the cut-off point is subjective and depends in part on the topic and purpose). What you are describing as categorical is more likely to still be scalar.

Categorical variables have values that have no ordinal relationship, e.g. colours, sex, marital status.

Ordinal values indicate the relative magnitudes of relationships or responses, such as in Likert scales where responses such as very happy, happy, neutral, sad, very sad can be recorded and assigned values of 1-5, but there is no definite interval between each response.

Scalar variables have units of fixed length, e.g. numbers of items, feet, centimetres, nanometres, etc. and may or not be considered continuous or discrete, depending on your viewpoint as explained earlier.

$\endgroup$
3
  • $\begingroup$ For me, scalar implies contrast with vector, matrix or tensor, which is quite separate from your sense here. Do you have references for this terminology in statistical literature? Also, the definition that categorical excludes ordinal is certainly disputable (contradicted by Agresti's Categorical data analysis and several other texts). $\endgroup$
    – Nick Cox
    Commented Jul 19, 2013 at 10:00
  • $\begingroup$ Scale is the term that SPSS uses, which is what I should have written myself. SPSS also uses the terms ordinal and nominal, where I have effectively used categorical as a synonym for nominal, since that was the term used by the original poster. I agree that a named range could also be described as a category and will be more careful in my nomenclature in future, thanks $\endgroup$ Commented Jul 19, 2013 at 15:17
  • $\begingroup$ This illustrates a persistent problem, of terminology. I have been sensitive to this issue of data types for 40 years or so, and read about it in several literatures, yet the jargon "scale variables" is new to me. $\endgroup$
    – Nick Cox
    Commented Jul 19, 2013 at 15:45

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.