Types of variables

Anshu Trivedi
4 min readJan 1, 2022

Type of Variables used in Data Science and statistics

Table of Content:

  1. Variables in statistics
  2. Why is it necessary to be aware of different type of variables?
  3. Quantitative and Qualitative variables
  4. Scales of measurement
  5. Difference in interval and ratio scales
  6. Discrete and continous variables

Variables in statistics

Variables are properties with varing values. For example ‘employee_name’ is property which holds different names of distinct employees. So, employee_name is variable.

Why is it necessary to be aware of different type of variables?

Nature or type of variable helps to draw many inferences about specific feature. For example if one feature is ‘income’ then we can easily conclude that all observation values for ‘income’ are either continous or discrete, how to visualise ‘income’ feature property for better comprehensenablity or what type of graphs can be used , what statistics can be applied on this feature etc.

Also, it is helpful in encoding categorical or ordinal and nominal type of variables in machine learning modelling. If we have good understanding of variable types we can easily identify between nominal and ordinal types and encode them with suitable encoding method accordingly. I often see the chaos in deciding the encoding method for categorical variables.Also categorical is used for both ordinal and nominal types together.

So, it helps in applying suitable statistis for inferences, visualisation and most suitable encoding method.

Quantitative and Qualitative variables

Variables describe either quantity or quality. For example ‘wine_taste’ descrives as bad, good or normal is quality of wine. ‘wine_volume’ is quantity as we are measure wine that is how much of wine 1L or 2L ettc.

Comparison between quantitative and Qualitaive variables

Quantitative variables can be measured on ordinal, interval, or ratio scales.

Qualitative variables are measured on nominal scale.

Better way to understand and to avoid any confusion see differences in below table:

fig: Differences in quantitative and qualitative variables

Scales of measurement

There are 4 scales of measurement i.e nominal, ordinal,interval and ratio.

  1. Nominal
  2. Ordinal
  3. Interval and Ratio Scale

Nominal Scale:

For any variable measured on nominal scale we can tell whether two individuals are different, we can’t tell the direction of difference, we can’t tell the size of difference , we can’t measure quantitaive varibles on nominal scale but we can measure qualitative varibles on this scale.

example: ‘Gender’, ‘owns_house’

Ordinal scale:

For any variable measured on ordinal scale we can tell whether two individuals are different, we can tell the direction of difference, we can’t tell the size of difference , we can measure quantitaive varibles on ordinal scale but we can’t measure qualitative varibles on this scale.

example: ‘t_shirt_number’, ‘education’

Interval Scale and Ratio Sale:

For any variable measured on Interval or Ratio scale we can tell whether two individuals are different, we can tell the direction of difference, we can tell the size of difference , we can measure quantitaive varibles but we can’t measure qualitative varibles on this scale.

example: ‘age’_groups, ‘product_price’

Summarising all measure scales in this table on basis of nature of variable

fig: identify measurement scale based on given properties in table

Difference in interval and ratio scales

What sets apart ratio scales from interval scales is the nature of the zero point. On a ratio scale, the zero point means no quantity .On an interval scale, however, the zero point doesn’t indicate the absence of a quantity. It actually indicates the presence of a quantity. Another important difference between the two scales is given by the way we can measure the size of the differences. On a ratio scale, we can quantify the difference in two ways. One way is to measure a distance between any two points by simply subtracting one from another. The other way is to measure the difference in terms of ratios. On an interval scale, however, we can measure meaningfully the difference between any two points only by finding the distance between them (by subtracting one point from another).

fig: Difference in interval and ratio scale

Discrete and continous variables

Generally, if there’s no possible intermediate value between any two adjacent values of a variable, we call that variable discrete.

Generally, if there’s an infinity of values between any two values of a variable, we call that variable continuous.

Whether a variable is discrete or continuous is determined by the underlying nature of the variable being considered, and not by the values obtained from the measurement.

I hope it helped you all. Let me know any correction needed or suggestion. If liked the article, don’t forget to clapp and show support.

--

--

Anshu Trivedi

Data Scientist-Analyst|Data science|Computer Vision