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: st: margins with logarithmic offsets


From   "Dimitriy V. Masterov" <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: margins with logarithmic offsets
Date   Mon, 12 Aug 2013 14:32:15 -0700

Joerg,

That's a handy way of doing that. Thanks!

It would be nice fix for a future Stata update.

DVM


On Sun, Aug 11, 2013 at 7:19 AM, Joerg Luedicke
<[email protected]> wrote:
> You could constrain the coefficient of the logged offset variable
> yourself in which case -margins- can access it:
>
> *--------------------------------------------------------
> webuse dollhill3, clear
> gen ln_pyears = ln(pyears)
> constrain define 1 _b[ln_pyears] = 1
> poisson deaths i.smokes i.agecat ln_pyears, constraint(1)
> margins, dydx(smokes) at(ln_pyears == `=ln(20000)')
> *--------------------------------------------------------
>
> Joerg
>
>
> On Fri, Aug 9, 2013 at 6:19 PM, Dimitriy V. Masterov <[email protected]> wrote:
>> I have two questions about evaluating marginal effects at a specific
>> value of the logarithmic offset variable. Adding the at option to the
>> margins command gives offset not found in list of covariates error.
>>
>> I did not find anything on this issue in the documentation, but there
>> was an old Stata FAQ about the mfx (an ancestor of margins) that
>> suggested merely replacing like this:
>>
>> webuse dollhill3, clear
>> poisson deaths i.smokes i.agecat, exposure(pyears)
>> margins, dydx(smokes)
>> replace pyears =20000
>> margins, dydx(smokes)
>>
>> 1) Is there a less clunky way to do this?
>> 2) Does this correspond to -margins, dydx(smokes) at(pyears ==20000)-?
>>
>> Stata mfx FAQ link:
>> http://www.stata.com/support/faqs/statistics/marginal-effects-after-offset/
>> *
>> *   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/
*
*   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/


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