From the course: Introduction to Stata 15

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Categorical explanatory variables in OLS

Categorical explanatory variables in OLS - Stata Tutorial

From the course: Introduction to Stata 15

Start my 1-month free trial

Categorical explanatory variables in OLS

- In the previous session, we built an ordinarily squares model with only continuous explanatory variables. However, sometimes we'll have non-continuous variables. And in this session, we're going to extend our model by introducing categorical variables to our regression. Stata is particularly good at this as almost all Stata commands, including regress, support a shortcut which allows us to include categorical variables in our code without having to do a lot of data manipulation. In particular, we're going to explore Stata's automated expansion capabilities by using the i dot and the ib brackets dot prefix options. By specifying these options in front of categorical variables, we can tell Stata to treat these variables specifically as categorical variables. So let's go take a look. Here we are in Stata and I've already loaded up the order data and ran our previous regression. Let's say that we now wanted to include both the re-pay record and the variable foreign in our model Both are…

Contents