Categorical Variable

Categorical Variable

A categorical variable is a variable that places observations into groups or categories. Instead of measuring “how much,” categorical variables describe “which kind.”

Examples of Categorical Variables

Variable

Example Categories

Eye color

blue, brown, green

Favorite pet

dog, cat, fish

Political party

independent, democrat, republican

Grade level

9th, 10th, 11th, 12th

Each observation belongs to one category.

Categorical vs. Quantitative Variables

Type of Variable

What It Describes

Categorical Variable

Which group or category

Quantitative Variable

How much or how many

For example:

  • Favorite ice cream flavor → categorical

  • Number of scoops eaten → quantitative

    • Related Articles

    • confounding variable

      Confounding variable is a variable that, though not measured, causes variation in both the explanatory variable and the outcome variable; also know as a "lurking variable" or a "third variable".
    • outcome variable

      Outcome variable is a variable whose variation we are trying to explain.
    • explanatory variable

      Explanatory variable is a variable we use to explain variation in an outcome variable.
    • Quantitative Variables

      A quantitative variable is a variable that measures a numerical amount or quantity. Quantitative variables answer questions like “how much?” or “how many?” Examples of Quantitative Variables Variable Example Values Height 62 inches, 70 inches Age 14 ...
    • factor()

      The factor() function will convert a quantitative variable into a factor (a categorical variable). This is often needed when categorical variables are dummy coded as numeric values so R treats them as a quantitative variable. For example, when a ...