Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: re: binary variables


From   Christopher Baum <[email protected]>
To   <[email protected]>
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

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
                            An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
 An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index