Prakriti Bhardwaj
Prakriti Bhardwaj

Reputation: 21

Region fixed effects in OLS

What is the Stata code for adding region fixed-effects in ordinary least squares regression? My dependent variable is volume of sale of a product and independent one is dummy variable, 1 for red pamphlet, 0 for blue pamphlet distributed to a sample of people over five districts. I want to include region fixed effects in the model. I tried generating dummy variables for the five regions and adding the dummies in the model. Is this approach correct? If not, which one is?

reg pamph sale income plotsize region1 region2 region3 region4 region5

Upvotes: 2

Views: 1391

Answers (1)

Arthur Morris
Arthur Morris

Reputation: 1348

There are a number of ways to control for group fixed effects. The simplest (IMO) in your situation is to use a factor variable. For example:

webuse nlswork
reg ln_w grade age i.ind_code 

In your case this would look like:

reg pamph sale income plotsize i.region

Assuming that region is a variable with a unique id for each region.

Other options are areg (see help areg) or reghdfe (see here):

areg ln_w grade age, absorb(ind_code)
reghdfe ln_w grade age, absorb(ind_code)

Note on the dummy variable trap in Stata.

Stata checks for collinear regressors and drops them. Interested readers (and commenters) can review the output of the reg examples above to see this in action. If you would like to control the base level you can substitute ib[level code] (where level code is the id of the group you would like to assign as the base level), and this will be the group dropped by Stata.

See "Base Levels" under Prefix Commands in the Stata manual for more details.

Upvotes: 5

Related Questions