Tired of ads? Enjoy an ad-free experience by signing up.
Pradeep Menon · · 6 min read

Data science simplified: Using qualitative variables in regression models

The last few articles of this series discussed regression models. Fernando, our data scientist who wanted to buy a car, has built a multivariate regression model with the following equation:

price = -55089.98 + 87.34 engineSize + 60.93 horse power + 770.42 width

The model predicts or estimates price (target) as a function of engine size, horsepower, and width (predictors). The model’s predictors are all numeric values. But what if there are qualitative variables? How can the qualitative variables be used in enhancing the models? How are the qualitative variables interpreted? These are the questions this article will answer.

Fernando has two such qualitative variables:

  • fuelType: The type of fuel used. The value can be gas or diesel.
  • driveWheels: The type of drive wheel. It has three values—four-wheel drive (4WD), rear-wheel drive (RWD), and front-wheel drive (FWD).

The data set looks like this:

Fernando wants to find out the impact these qualitative variables have on the price of the car.

Concept

Qualitative variables—also called categorical variables or factors—are variables that are not numerical and fits the data into categories.

Let us look at an example. The sample data has five cars and each one has a diesel or gas fuel type.

 

The fuel type is a qualitative variable. It has two levels (diesel or gas). The statistical package creates one dummy variable named fuelTypegas. The value of this variable is either 0 or 1. If the fuel type is gas, then the dummy variable is 1. If it’s diesel, then it’s 0.

Model building

Conclusion

Stay ahead in Asia’s tech landscape

You've reached your 2 free content limit for the month. Sign up for free to read the full story.

🏄 For casual readers / 👶 Free

Basic

US$0

Free forever

Get instant access to this article and more every month

0 premium content

Unlimited news briefs

5

5 articles

Ad-free reading experience

Just US$0 per day

⌛Sign up in 20s. No payment details needed.

📖 For learners / 👍 Starter

Lite

US$4.92/month

Billed annually at US$59/year

Get instant access to this article and more every month

4

4 premium content

Unlimited news briefs & articles

Ad-free reading experience

Just US$0.17 per day

Cancel anytime

Our subscriber community includes professionals from these companies:

Stay updated on the go with our mobile app.

Get latest insights with smoother, more personalized experience through TIA mobile app.

Community Writer

Pradeep Menon

Pradeep is an experienced Big Data and Data Science professional with 15+ years of experience. Pradeep works as a Cloud Solution Architect (CSA)- Advanced Analytics and AI with Microsoft.