Spiegato, Home

Science and Engineering

What Is a Categorical Variable?

  • Published by Spiegato
  • 2 min read

A categorical variable, which is also referred to as a nominal variable, is a type of variable that can have two or more groups, or categories, that can be assigned. There is no order to the categories that a variable can be assigned to. In other words, the categories cannot be put in order from highest to lowest. An example of a categorical variable is race, which has many different categories but there is no ordering to them.

One way to determine the variable type is whether it is quantitative or qualitative. A quantitative variable can be measured and has a specific numeric value. Examples of quantitative variables include height, weight, age, salary, temperature, etc. Any variables that are not quantitative are qualitative, or a categorical variable. These types of variables have no numerical meaning when they are measured or observed, and include things like hair color, eye color, gender, city of birth, etc.

Categorical variables are similar to ordinal variables as they both have specific categories that describe them. The difference between a categorical variable and an ordinal variable is that the latter has an intrinsic order. For example, a survey may ask for respondents to rank statements as poor, good and excellent. These are categorical variables, but there is an obvious order, so they are in fact ordinal variables.

Data tables are usually used to analyze data that is grouped categorically. With a two way data table, two categorical variables can be measured and compared. For example, hair color and gender could be measured for a group of individuals. The categorical variables that would be observed and recorded would be whether the person is male or female and what color his or her hair is. In the table, the number of observations for each group for the two variables would be entered in rows and columns based on the data collected.

Bar charts are often used as a graphical method of analyzing categorical variable data. The data that is observed can be entered as raw numbers or as percentages, which are preferred. With a bar chart, the total for each group is shown.
In the example above, the bar chart could represent the number of males or females or the number of individuals within each category of hair color. A segmented bar chart can provide a method of showing the numbers captured during the observations instead of a straight total for each group. Using the same hair color and gender data, a segmented bar chart could show how many males and females of each hair color were observed.

Key terms in this article

Related articles

  • What are Dependent Variables?

    Dependent variables are observable phenomena which are influenced by other phenomena. In an example, for someone studying how much light impacts the…

  • What Are Cepheid Variables?

    In astronomy, Cepheid variables are variable stars whose brightness changes over a certain period in a characteristic, regular way. Normally, the outward…

  • What is a Latent Variable?

    A latent variable is one that may not be specifically recorded, declared, or otherwise manifested. In statistical analysis, computer science, and other…

  • What is an Integer Variable?

    An integer variable is a type of numeric variable in computer programming designed to store a whole number only. This differs from other numeric variable…

  • What is an Independent Variable?

    An independent variable has a variety of meanings, depending on the discipline using the term. In science, for example, it is the variable that is being…