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, statalist.org is already up and running.


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

Re: st: Understanding Factor variables - is order significant ?


From   Richard Williams <richardwilliams.ndu@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Understanding Factor variables - is order significant ?
Date   Tue, 25 May 2010 22:43:14 -0500

At 09:19 PM 5/25/2010, Michael N. Mitchell wrote:
Dear Richard

  I think I need to use my glasses!

Yes, Richard, you are exactly on target. It relates to the use of -#- instead of -##- .

My previous answer is still true, in the sense that when you do a#b and b#a, that you get a different reference "cell", and thus it is re-scrambling the coding.

I agree with everything you say. But, it still isn't clear to me why it should make a difference whether you use b1.ra#b0.dm versus b0.dm#b1.ra. Tweaking your example, the following yield identical or equivalent results for regress but not for poisson:

sysuse auto, clear
generate bigtrunk = trunk > 15
generate biglen = length > 190
regress mpg bigtrunk#biglen
regress mpg b1.bigtrunk#b0.biglen
regress mpg b0.biglen#b1.bigtrunk
poisson mpg bigtrunk#biglen, nolog
poisson mpg b1.bigtrunk#b0.biglen, nolog
poisson mpg b0.biglen#b1.bigtrunk, nolog

Use of ## in the last 2 commands avoids the problem, but why is there a problem in the first place?

-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index