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]

RE: Re: st: RE: problem with factor variable and margins.


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   RE: Re: st: RE: problem with factor variable and margins.
Date   Wed, 17 Mar 2010 19:16:48 +0100

<>


" I am curious if you would get this
same error if you did 

set varabbrev, off"




I cannot see much of a difference, whether -varabbrev- is on or off:


*************
clear*
set obs 10000
 
gen nainc_ainc=rnormal()
gen byte nainc= /* 
*/ irecode(_n,0,1000,3000, 5000,10000)
gen x1=rnormal()
gen y=2+ nainc+2*nainc_ainc+x1+ rnormal() 

//abbrev on
qui set varabbrev on
query other
qui reg y x1 i.nainc nainc_ainc
margins, dydx(nainc_ainc nainc)

//abbrev off
qui set varabbrev off
query other
qui reg y x1 i.nainc nainc_ainc
margins, dydx(nainc_ainc nainc)

*************


HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Christopher Baum
Sent: Mittwoch, 17. März 2010 18:35
To: [email protected]
Subject: re: Re: st: RE: problem with factor variable and margins.

<>
Rich said

I think I have tracked down the problem.  In addition to the factor 
variable nainc, I have a continuous variable nainc_ainc as a regressor 
(which is the indicator times a continuous variable).  The margins 
command then got confused and assumed that nainc was an abbreviation for 
nainc_ainc, which did appear in the results and subsequent tests.  When 
I rename nainc_ainc as n2ainc_ainc, my problem goes away -- a marginal 
effect for the discrete change in the factor variable nainc does indeed 
show up in the results.

If I am right in diagnosing why the rename solves the problem, this 
means there is a bug in stata's margins.  It is not reporting an 
ambiguous abbreviation, it is simply picking one.  Should I report it to 
stata's tech staff, or is that something you do, Martin?


Although there may indeed be a need for revision of -margins- code, I am
curious if you would get this
same error if you did 

set varabbrev, off


I would recommend

set varabbrev off, permanent

Kit Baum   |   Boston College Economics and 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/


*
*   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