Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Herman Haugland <herman.haugland@gmail.com> |
To | Statalist - Send questions <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: How to correctly code categorical variables effects in FE/RE model |
Date | Tue, 20 Aug 2013 15:45:20 +0200 |
Thank you very much Nick and Maarten! One related question, how would you report those year effects? I am asking because I am basing my analysis on studies that just say: Year effects? Yes/No. Is that the correct way to do it? I mean, I code the year effects, I get the values for my variables of interest, and then: a) Should I conclude based on the values of those variables of interest only? OR b) Should I say something about the coefficients for the years? One last newbie question, for the years, does it matter whether I take the real value of the year (e.g. 1991), or should I code them as categorical variables? I suppose is the same, since years have a natural order, but I just want to make sure I am doing it right. Thanks for your time and consideration. Med vennlig hilsen / Best regards, Herman Haugland ________________ Contact Information: Tel: +47 930 289 69 E-mail: herman.haugland@gmail.com LinkedIn: /in/hermanhaugland On Tue, Aug 20, 2013 at 3:36 PM, Maarten Buis <maartenlbuis@gmail.com> wrote: > On Tue, Aug 20, 2013 at 3:18 PM, Herman Haugland wrote: >> Suppose that I want to test for the year effects in the regression. >> I, so far, have been doing the following: >> >> xtreg y x i.year, fe >> >> But reading here (sorry for citing Wikipedia): >> http://en.wikipedia.org/wiki/Categorical_variable#Effects_coding >> >> It seems I am doing it the wrong way. >> >> How would you correctly code categorical variables (year) effects in Stata? > > You did it right. Effect coding is just another way of representing > exactly the same model. Say we have two groups (years), 1 and 2 and > they are of equal size and year 1 has a value of 3 and year 2 a value > of 5. We could say the overall mean is 4 and year 1 defiates -1 from > that mean and year 2 deviates +1 from that mean. That would be effect > coding. We could also say that year 1 has a value of 3 and year two > deviates +2 from that value. That would be the default with factor > variable notation. Notice that these are just different ways of saying > exactly the same thing. > > You could get effect coding with -contrast-, which can sometimes help > as that comparison fits a particular application better. It is > certainly not a case of "correct" versus "incorrect" way of doing > things, as the models are just mathematically equivalent. > > -- Maarten > > --------------------------------- > Maarten L. Buis > WZB > Reichpietschufer 50 > 10785 Berlin > Germany > > http://www.maartenbuis.nl > --------------------------------- > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/