What Is A Variable?

James Pithering
Latest posts by James Pithering (see all)

We come across variables every day, no matter what we are doing. Generally speaking, variables are anything that can change or be changed in an experiment or situation. 

For example, a factor that can be manipulated or controlled such as temperature is considered to be a variable (Also check out the What Is A Controlled Variable?). 

What Is A Variable

These units of data are used in scientific fields and programming languages. In computing, variables are units of data that can be assigned a value. Variable units can come in the form of numbers, text, or images. 

In this article, we are going to look into the different types of variables in various contexts and what they are used for. 

Scientific Variables

Here we are going to explore the different types of scientific variables that are used in research. When scientists ask a specific question and want to know the answers, they use variables to try and find them. 

Independent Variables

When conducting an experiment, the independent variable is considered as the one that is being changed. Going back to the previous temperature example, you might be increasing or decreasing temperature using a heat source to have an effect on the dependent variable. 

Dependent Variables

The variable that is being measured or tested is known as the dependent variable. If we’re sticking with the temperature example, the rate at which an ice cube melts when the heat source is altered would be considered to be the dependent variable. 

Computer Programming Variables

Creating variables when computer programming helps to label different data sets with names so that they can be read easily by users. These variables may be referenced or manipulated by a computer program for different reasons. 

When naming variables you must assign as accurate of a description as possible so other users can understand what the variable represents. Most programs use the ‘equals’ symbol to assign the name to a variable. 

Each computer program will have its own set of rules about the variables listed, so it’s important to remind yourself of the language that is used within each program. 

Similarly to the scientific variables mentioned above, these variables can change. For example, if you’re playing a computer game and your high score has increased this additional information will be updated under the variable of your name. 

In computer programming, there are five types of variables: constants, global variables, class variables, instance variables, and local variables. Each of these represents different types of data such as data that can’t change.

Statistical Variables

In this context, a variable is a characteristic, number, or numerical value that is quantifiable. Another type of variable is also known as a data item. 

For example, age, sex, height, weight, job title, income, and grade point averages are all examples of variables. With these types of variables, their values can change over time and vary between data units. People in different areas can earn more or less money over a 10-year time period. 

With different variables, there are different ways to measure and categorize them. Anything that can be measured by quantity such as age or height are numeric variable. These types of variables can be further split into two categories: continuous and discrete. 

What Is A Variable

Continuous Variables

Continuous variables encompass numerical values such as speed and distance and can take on an unlimited number of values between the lowest and highest points. These types of data are very useful in inferential statistics

These variables can be split into smaller parts or numerical values. As a result, they can contain fractional and decimal values and can be measured using a scale. 

Commonly, these variables are represented using histograms and scatter plots as they can handle the continuous levels of data and allow for decimal places. 

Discrete Variables

Discrete variables are integers that you can count, such as how many pairs of shoes you own. As a result, discrete data can only be described as a specific value. If you have 10 pairs of shoes, you have ten pairs. Any missing shoes wouldn’t count as 10.5 pairs of shoes, because they wouldn’t make up a pair. 

Bar charts are commonly used to display discrete data as they emphasize the differences between the values. 

To make these a little easier to understand, you count discrete data and measure continuous data. 

Ordinal Variables

Data that isn’t numerical can also be collected. Quantitative data refers to a quality or characteristic data units such as hair color or birthplace. 

An ordinal variable is a category, this means that we can make observations which can be organized in a logical ranked order later on. When ranking these variables, they can be of a different value to one another but these don’t necessarily mean they will be of numeric value. 

For example, if you were conducting a customer satisfaction survey then you may use categories such as ‘agree’ ‘disagree’ and ‘somewhat agree’ and so on. These different categories convey important information without relying on numerical patterns to do so. 

Nominal Variables

Nominal variables are also categorical variables. With nominal variables, they cannot be ranked as ordinal variables can, the data either represents one category or another without being ‘better’ than the other.

These categories could be things like sex, hair color, or eye color. No one hair color is different from another in terms of size or what the category represents (such as satisfaction).  

Final Thoughts

Variables are important to understand no matter the context they are being used in. There are multiple situations in which a variable may be used, such as computer programming, scientific experiments or statistical analysis. 

Hopefully, this article has given you a better understanding of the different types of variables and where these can be used.

Leave a Comment