Numeric variables, also known as quantitative variables, are variables that represent numerical values.
What are Numeric Variables?
Unlike categorical variables where groups are represented by categories, numeric variables are only represented by numbers. These numbers allow for basic arithmetic operations such as addition, and subtraction to complex machine learning algorithms.
For example, what is the monthly data of the interest rate, CPI values, or measurement of body height? These are all examples of continuous variables.
A numeric variable is a broad term that is used to cover variables that involve numbers, but there are two types of numeric variables – continuous and discrete. We will explore the different types of numeric variables in the sections below.
What are Continuous Variables?
This subtype of the numeric variable can be any number or range in an interval. The interval can be “sliced” infinitely in a way that does not result in any “gaps” in the interval.
Body height for example is an example of a continuous variable, a person can be 5m, 5.8, 5.75, 5.765, 5.7654 tall, well you get the point.
Other examples of continuous variables include:
- Age: A person’s age can be 25.3 years or 42.9 years.
- Temperature: can be 23.5 degrees Celsius or 98.2 degrees Fahrenheit.
- Time: Time, such as duration or elapsed time such as 4.7 seconds or 2.3 hours
The figure below is an example of continuous variable, it shows the trend of North America oil production and consumption over 20 years. Continuous variables are great for showing trends in the data.
What are Discrete Variables?
The other type of numeric variable is the discrete variable, and it is in a sense “countable”. Most of the time, discrete variables are in the form of whole numbers, but they can present themselves as fractions or integers.
If someone asks how many pets you have in your household, you would answer I have 0, 1, 2, 3, …, pets. In this case, the discrete variable is the whole number because you can’t have a negative number of pets.
A few examples of discrete variables:
- Number of Cars in a Parking Lot: The count of cars in a parking lot is a discrete variable as it represents whole numbers, such as 0, 1, 2, 3, etc.
- Rating Scale: Such as customer satisfaction ratings from 1 to 5.
- The number of Defective Products: The count of defective products in a production batch.
The figure below illustrates the count of passengers with accompanying spouses and siblings on board the Titanic. Discrete variables, like categorical data, can be grouped into bins for easy comparison of different values.
Difference between Discrete and Continuous Variables?
We talked about both the discrete and continuous variables. Here is a summary table about the differences between discrete and continuous Variables.
Continuous Variables | Discrete Variables |
---|---|
An interval can be infinitely sliced | Countable number of responses |
Can be any number within the interval | Represented by whole, integer, fractions |
Good for measurement requiring high precision | Good for measurement that represents specific values |
Good for plotting trends | Good for plotting different bins |
Example: Age, Temperature | Example: Rating Scale, Number of page in a book |