Types of Variables
Statistics is the science of collecting and analyzing data. Each set of data consists of individuals, and their measured or observed information known as variables.
Let’s say we are interested in studying the number of hours a professional athlete exercises each weekday. Our dataset might look something like this:
Exercise Hours Each Weekday Example
Section titled “Exercise Hours Each Weekday Example”| Name | Monday | Tuesday | Wednesday | Thursday | Friday |
|---|---|---|---|---|---|
| Serena Williams | 3.5 | 2.0 | 4.0 | 4.5 | 2.5 |
| Tom Brady | 2.0 | 2.5 | 1.5 | 3.0 | 3.5 |
| LeBron James | 4.0 | 1.5 | 3.0 | 4.5 | 1.0 |
| Simone Biles | 1.5 | 3.5 | 2.5 | 2.0 | 4.5 |
In this example, The athletes are the individuals described by the dataset. For each individual, the data shows the number of hours the athlete exercised each weekday. Each athlete can exercise a different amount each day, hence the variables are the weekdays.
Quantitative & Qualitative Variables
Section titled “Quantitative & Qualitative Variables”We learned that a variable is a feature that may change from one individual to another, where the variable can either be quantitative or qualitative. Quantitative variables, also known as numerical variables, describe measured or counted quantities collected from each individual. Qualitative variables, also known as categorical variables, describe labels or qualities of an individual.
Examples of Variables
Section titled “Examples of Variables”| Variable | Type | Example Values |
|---|---|---|
| Height (cm) | Quantitative | 165.3, 172.9, 180.0 |
| Number of Pets | Quantitative | 0, 1, 3 |
| Eye Color | Qualitative | Blue, Brown, Green |
| Clothing Size | Qualitative | Small, Medium, Large |
One easy way to judge if a variable is quantitative or qualitative is to see if performing arithmetic operations (addition, subtraction, averaging, etc.) with the variable values make sense. If it does the variable is quantitative, if not then it is qualitative.
Let’s look back at the previous examples to test if this is true. For the variable height we can average 164.3 and 172.9 to get 168.6. Does a height of 168.6 cm make sense? Yes, so the variable is quantitative. For the variable eye color we can average blue and brown to get (blue+brown)/2. Does a eye color of (blue+brown)/2 make sense? Definitely not, so the variable is qualitative.
In the next sections we will explore the different types of quantitative and qualitative variables.
Discrete vs. Continuous Variables
Section titled “Discrete vs. Continuous Variables”Quantitative variables can be either be discrete or continuous.
Discrete variables can only take on a limited set of values in a given range. For example, the number of students in a class is a discrete variable since the number of students can only be whole numbers (0,1,2,3, etc.), you can’t have 2.5 students. As in our example, discrete variables often take on whole numbers as values, but that’s not always the case. Consider shoe sizes, which increase in increments of 0.5. You can have a shoe size of 7 or 7.5, but you can’t have a shoe size of 0.25. It can be helpful to think of discrete variables as representing measurements that can’t be subdivided into finer increments.
Continuous variables can be any value in a given range. For example, height is a continuous variable since something can be 7, 7.1, 7.11, or even 7.11111… feet tall. We can be infinitely precise and there is always a value between two measurements. It can be helpful to think of continuous variables as representing measurements that can be subdivided into finer increments.
Nominal vs. Ordinal Variables
Section titled “Nominal vs. Ordinal Variables”Qualitative variables can either be nominal or ordinal.
Nominal variables can be split into categories or qualities that have no inherent order. For example, the variable hair color can be split into categories of blonde, brunette, or black. These categories do not have an inherent order, we cannot say blonde > black or brunette < black, thus hair color cannot be meaningfully ordered.
Ordinal variables, in contrast, can be split into categories that have some inherent order. For example, the variable box size can be split into categories of big, medium, or small. We can say that big > medium and medium > small. Therefore the categories can be ordered meaningfully.
Definitions
Section titled “Definitions”-
Individuals are objects described by the set of data which may be people, animals, or things.
-
Variables are features of an individual which can take different values for different individuals.
-
Quantitative (numerical) variables describe measured or counted quantities collected from each individual.
-
Discrete variables can only take on a limited set of values in a given range. They can be counted and the values can’t be subdivided into finer increments.
-
Continuous variables can be any value in a given range. They can be measured and the values can be subdivided into finer increments.
-
-
Qualitative (categorical) variables describe the qualities of an individual where we can split the values into different categories.
-
Nominal variables can be split into categories that have no inherent order.
-
Ordinal variables can be split into categories that have some inherent order.
-
Practice Problems
Section titled “Practice Problems”-
Linda plans on taking her cat to the veterinarian for a checkup. To help identify the correct animal and avoid any mix-ups, the veterinarian asks Linda to describe her cat using both quantitative and qualitative variables.
a. What are 4 quantitative variables that Linda can use?
Solution
Note that there are many correct answers to this question, here are some examples.
Weight, age, tail length, and number of whiskers.
b. What are 4 qualitative variables that Linda can use?
Solution
Note that there are many correct answers to this question, here are some examples.
Fur color, eye color, breed, and personality (e.g. shy, outgoing, etc.).
-
How can we design better training programs for marathon runners? To answer this question, researchers conducted a study and recorded the following variables for each participant: The number of full marathons completed in the past year, average weekly running distance (kilometers), running shoe brand (Nike, Adidas, Brooks, Other), and self-rated fitness level (beginner, intermediate, advanced, elite).
a. For each variable, determine if it is quantitative or qualitative.
Solution
The variable number of full marathons completed in the past year is quantitative since it is numerical and we can count the number of marathons.The variable average weekly running distance is quantitative since it is numerical and we can measure the average weekly distance.
The variable running shoe brand is qualitative since it is categorical and we can divide the shoe brands into different categories.
The variable self-rated fitness level is qualitative since it is categorical and we can divide the fitness levels into different categories.
b. Determine if the quantitative variables are discrete or continuous.
Solution
The variable number of full marathons completed in the past year is discrete since it can only be whole number values. A runner can’t run 2.5 marathons and the variable values can’t always be subdivided into finer increments to get a meaningful value.The variable average weekly running distance is continuous since it can be any number above or equal to 0 (the given range). The variable values can also be subdivided into finer increments to get a meaningful value.
c. Determine if the qualitative variables are nominal or ordinal.
Solution
The variable running shoe brand is nominal since it’s categories can’t be meaningfully ordered. We can’t say Nike > Adidas or Brooks > Nike.The variable self-rated fitness level is ordinal since it’s categories can be ordered meaningfully. It makes sense to say Elite > Beginner or Advanced > Beginner.
-
A tech company wants to improve their company wellness and culture, they collect the following information from each employee: the number of whole sick days taken in the past year, their level of job satisfaction (low, medium, high). their resting heart rate (beats per minute) measured during an annual checkup, and the department they work under (Engineering, Marketing, HR, Sales).
a. For each variable, determine if it is quantitative or qualitative.
Solution
The variable number of whole sick days is quantitative since we can count the number of sick days and the values are numerical.The variable job satisfaction is qualitative since it is numerical we can split the values into different categories
The variable resting heart rate is quantitative since we can measure heart rate and the values are numerical.
The variable department is qualitative since it is categorical and we can divide the departments into different categories.
b. Determine if the quantitative variables are discrete or continuous.
Solution
The variable number of whole sick days is discrete since it can only be whole number values. For example, an employee can’t take 6.575 sick days and the variable values can’t always be subdivided into finer increments to get a meaningful result.The variable resting heart rate is continuous. If you answered discrete you might be confused with how heart rate is measured practically as apposed to the true values heart rate can take. In real life, a heart rate of 115 bpm is practically no different from a heart rate of 115.3 so we measure with whole numbers. However, heart rates can be any value and can be subdivided into finer increments, making it fundamentally a continuous variable.
c. Determine if the qualitative variables are nominal or ordinal.
Solution
The variable job satisfaction is ordinal since it’s categories can be meaningfully ordered. We can say high > low or medium > low.The variable department is nominal since it’s categories can’t be ordered meaningfully. It does not make sense to say Engineering > Sales or HR > Marketing.