Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: re: binary variables

From   Christopher Baum <>
To   <>
Subject   st: re: binary variables
Date   Thu, 3 Jun 2010 05:58:50 -0400

Natalie said

I also couldn't sort out how to make the "xtreg" command work. It gives 
me the error "not sorted r(5);", even when I sorted the data and then 
typed the "xtreg" command (maybe because there are too many variables or 
maybe because I have cross sectional data?!).

I imagine you tried to include those explicit region variables (Saarland Brandenburg MeckPomm Sachsen, etc.)  in xtreg, fe. You can't include region dummies and fit a fixed effects model.  All you need to do is

xtreg depvar indepvars, fe i(REGION)

and Stata will fit the model using the within transformation (equivalent to including dummies for each REGION).

To see that this works:

webuse grunfeld
tsset, clear
xtreg invest mvalue kstock, i(company) fe

Note that the sort order does not matter. You can randomly sort the observations in the dataset and the above FE model
will still work.


Kit Baum   |   Boston College Economics & DIW Berlin   |
                            An Introduction to Stata Programming  |
 An Introduction to Modern Econometrics Using Stata  |
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index