# Categorical, nominal or continuous variable?

I'm trying to understand what level of measurement is best for describing the 'number of rooms in a flat' feature.

First of all, I think it's not a continuous feature, because rational values like 1.42, for example, don't make sense.

To decide whether a feature is categorical or nominal, we should try to find an ordering between values. And here is my question: should we look for an order with respect to the response feature (in my case 'Price of a property')?

We can say a '1-room flat' is cheaper than a '2-room flat', and so on. But that is not always the case. In general, maybe it's true, but there are cases when a '1-room flat' in the city centre is way more expensive than the one further away.

So, a can't decide which representation to choose - categorical or nominal.

• Categorical and base the price on constructed m2 and zone. – TKW Jun 25 '17 at 17:09

I don’t know where you’re getting this particular classification scheme from, (continuous, categorical, nominal), but it’s worth mentioning that this isn’t a great scheme for classifying data types. You’ve already encountered an example of a data type (count data/natural numbers) that doesn’t fit neatly into them.

It is also worth mentioning that a lot of people will use “nominal” and “categorical” interchangeably to describe a discrete data type with no natural ordering. Probably the most widely-accepted term to describe discrete data with a natural ordering is ordinal data.

In this case, "number of rooms in a flat" has an unambiguous ordering. In a very real and intuitive sense, a five-room flat has more rooms than a two-room flat. A one-room flat has fewer rooms than a three-room flat. It makes sense to talk about one flat having a greater or lesser number of rooms than another, and if we want to know if that ordering matters in some way, we need to preserve the ordering in our analysis.

I'd stick with continuous.

A number of 1.42 could mean that you may have a single room, but with significantly more area than the average room.

You may even have some fraction if you need to share kitchen and bathroom with others.

Those things may be easier to fit in a number than in yet another category you don't know how to order.

I'd say a discrete numerical variable.

This is the same "type" of variable as "how many children do you have" in surveys. Definitely an integer, and it doesn't necessarily mean raising five kids is $5/4$ times more expensive than raising four kids.

But it of course depends on the environment (software you are using, surveys you are giving). R differentiates a numeric (i.e. a float) from an integer.

• Nominal categories cannot be numerically organized or ranked. "The number of rooms in a flat" can definitely be organized and thus it's not nominal variable – two rooms are more than one room. An example of a nominal variable is "Country"; countries cannot be ordered according to any sort of mathematical logic. – tuomastik Jul 27 '17 at 9:36
• thanks so much @tuomastik! i've edited my answer to reflect that. – hongsy Jul 27 '17 at 9:39