What Are Variables?
A subject is a person, place, or thing we’re interested in studying.
A variable is an attribute that describes the subject in some way.
Variables can vary from subject to subject.
For example, recall our dataset about basketball player heights from the previous section:
As another example, recall our dataset about city populations also from the previous section:
The subjects are the cities. The variable we are interested in is population. Notice how it varies from city to city.
Quantitative vs. Qualitative Variables
Variables can be classified as quantitative (sometimes called “numerical”) or qualitative (sometimes called “categorical).
Quantitative variables describe a quantity about a subject. They are numeric. For example, the population of a city is a quantitative variable. So is the height of basketball players. Both of these variables measure a numeric quantity.
Qualitative variables describe a quality about a subject. They can take on names, labels, or categories. For example, the color of hair (“blonde”, “brunette”, “grey”) or the type of a car (“SUV”, “minivan”, “sports car”) are both qualitative variables.
Continuous vs. Discrete Variables
Quantitative variables can be further classified as discrete or continuous.
Discrete: Discrete variables can only have certain values. For example:
- The number of students in a class – it could be 20 students, but it couldn’t be 20.2 students or 20.223 students.
- The number of cars in a parking lot – there could be 100 cars, but there couldn’t be 100.5 cars or 100.38 cars.
Continuous: Continuous variables can take on an infinite number of values. For example:
- body weight – you could weigh 180.332 pounds. Or you could weigh 190.5 pounds. Body weight can take on any value.
- temperature – it could be 65.55 degrees Fahrenheit outside. Or it could be 45.998 degrees Fahrenheit outside. Temperature can take on any value.
Rule of Thumb: If you are counting something, it is discrete data. (“Count the number of gummy bears in the bag”). But if you are measuring something, it is continuous data (Measuring weight, height, speed, etc.)