Statalist


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

Re: st: RE: RE: AW: -margins- vs -adjust-


From   Jeph Herrin <jeph.herrin@yale.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: RE: AW: -margins- vs -adjust-
Date   Wed, 04 Nov 2009 12:12:39 -0500

Sticking to the dichotomous case, you can do

 logit low age lwt race i.smoke ptl ht ui
 margin smoke, dydx(*)

but NOT

 logit low age lwt race smoke ptl ht ui
 margin smoke, dydx(*)

The documentation is very clear:

" ... when you specify the estimation command, covariates that are
 logically factor variables must be Stata factor variables, and that
 includes indicator variables, binary variables, and dummies. It will
 not do to type

 . regress y ... female ...

 even if female is a 0/1 variable. You must type

 . regress y ... i.female ...

 If you violate this rule, you will not get incorrect results, but you
 will discover that you will be unable to obtain margins on female:

  . margins female
  factor female not found in e(b)
  r(111);"

It seems like -margins- could figure out that -female- is dichotomous.

J



Lachenbruch, Peter wrote:
If one puts in "if race<3" you get the same model and the margin,dydx(*) command gives the same results.

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Lachenbruch, Peter
Sent: Wednesday, November 04, 2009 8:59 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: AW: -margins- vs -adjust-

I tried this and it also worked, but race is not dichotomous.  Also, the models are estimating different things.  Has the question been answered?


. tab race

       race |      Freq.     Percent        Cum.
------------+-----------------------------------
      white |         96       50.79       50.79
      black |         26       13.76       64.55
      other |         67       35.45      100.00
------------+-----------------------------------
      Total |        189      100.00

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss
Sent: Wednesday, November 04, 2009 8:33 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: AW: -margins- vs -adjust-


<>
Works for me in both cases - whether -i.race- or -race- is specified...


*************
webuse lbw, clear

logit low age lwt i.race smoke ptl ht ui
margins, dydx(*)

logit low age lwt race smoke ptl ht ui
margins, dydx(*)
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Jeph Herrin
Gesendet: Mittwoch, 4. November 2009 17:30
An: statalist@hsphsun2.harvard.edu
Betreff: st: -margins- vs -adjust-


After getting an error with -adjust-, I discovered that it
had been deprecated in version 11. The online help says:

"adjust has been superseded by margins.  margins can do everything
  that adjust did and more."

However, as far as I can tell, this is not the case. I could use
-adjust- with models that did not include factor variables; however,
with -margins- there seems to be no option to find marginal effects
for independent variables that are not i.vars.

Is this true? Or is there a way to fool -margins- into working with
non-factor variables? Apologies if this has come up before, I could
not find anything on the list or FAQ.

If it is true, this is a complete nusiance. I do not normally
include dichotomous variables as factor variables, and am not
interested in starting now. Moreover, I have estimation results
from -xtmelogit- models that ran for days; am I going to have
to re-estimate with -i.female- instead of -female- to get marginal
effects? (-adjust- gives errors). That, or calculate my own
marginal effects from scratch.

cheers,
Jeph



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

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

*
*   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   |   What's new   |   Site index