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: Re: st: 'margin' and marg. effects of second-order polynomials


From   Tirthankar Chakravarty <[email protected]>
To   [email protected]
Subject   Re: Re: Re: st: 'margin' and marg. effects of second-order polynomials
Date   Wed, 29 Dec 2010 16:31:38 -0800

Yes, those two approaches are equivalent. You can see this by
constructing the example on page 979 of the manual [R] both ways -
exactly the same model is computed in both cases.

**********************************************
use http://www.stata-press.com/data/r11/margex, clear
logistic outcome treatment##group age c.age#c.age
margins, dydx(age)
logistic outcome treatment##group c.age##c.age
margins, dydx(age)
**********************************************

T

On Wed, Dec 29, 2010 at 4:18 PM, Justina Fischer <[email protected]> wrote:
> even is there was a difference,
>
> c.mpg#c.mpg = x^2
>
> what about the x then ? (my function is F = ax + bx^2 )
>
> would your approach work if you estimated (two #) :
>
> oprobit rep77 foreign length c.mpg##c.mpg
> foreach i of numlist `replev' {
>
> margins, dydx(mpg) predict(outcome(`i'))
>
> would you get the overall dF/dx  ?
>
>
>
>
>
> [email protected] schrieb: -----
>
> An: [email protected]
> Von: Tirthankar Chakravarty <[email protected]>
> Gesendet von: [email protected]
> Datum: 30.12.2010 01:12AM
> Thema: Re: Re: st: 'margin' and marg. effects of second-order polynomials
>
> Justina,
>
> Try this code to see the difference between the two methods of
> calculating the marginal effects:
> ********************************************************
> webuse fullauto, clear
> levelsof rep77, local(replev)
>
> // higher-order term not included
> oprobit rep77 foreign length mpg
> foreach i of numlist `replev' {
> margins, dydx(mpg) predict(outcome(`i'))
> }
>
> // include as continuous interactions
> oprobit rep77 foreign length c.mpg#c.mpg
> foreach i of numlist `replev' {
> margins, dydx(mpg) predict(outcome(`i'))
> }
>
> // include explicitly
> g mpgsq = mpg^2
> oprobit rep77 foreign length mpg mpgsq
> foreach i of numlist `replev' {
> margins, dydx(mpg mpgsq) predict(outcome(`i'))
> }
> ********************************************************
>
> T
>
>
> On Wed, Dec 29, 2010 at 3:57 PM, Justina Fischer <[email protected]> wrote:
>> Yes, I did - the x is continuous (so I used c.x##c.x).
>>
>> I then used
>> margin, dydx(x)
>>
>> Nevertheless, checking the marginal effects against a naive specification
>> (x
>> and x^2) I seemed to get the same marginal effects of x  as before again ?
>>
>> Justina
>>
>>
>>
>> [email protected] schrieb: -----
>>
>> An: [email protected]
>> Von: Tirthankar Chakravarty <[email protected]>
>> Gesendet von: [email protected]
>> Datum: 30.12.2010 12:53AM
>> Thema: Re: st: 'margin' and marg. effects of second-order polynomials
>>
>> Use continuous interactions:
>>
>> *************************************
>> webuse fullauto, clear
>> oprobit rep77 foreign length c.mpg#c.mpg
>> margins, dydx(mpg)
>> *************************************
>>
>> T
>>
>> On Wed, Dec 29, 2010 at 3:30 PM, Justina Fischer <[email protected]> wrote:
>>> Hi
>>>
>>> I am estimating (using oprobit, unfortunately) a functional relationship
>>> of
>>> the following kind (simplified)
>>>
>>> Pr(F) = ax + bx^2 + other stuff.
>>>
>>> I am interested in the marginal effect: dPr(F)/dx = a + 2bx
>>>
>>> Using margin, I get marginal effects as if x and x^2 were two separate
>>> variables, even though  I interact the factor x (x##x) in my
>>> specification.
>>>
>>> Is there a way to make 'margin' estimate dPr(F)/dx, taking into account
>>> the
>>> functional relationship ?
>>>
>>> Browsing the Stata archive did not help....and calculating by hand is
>>> probably rather unfeasible.
>>>
>>> Thanks
>>>
>>> Justina
>>
>>
>>
>> --
>> To every &#969;-consistent recursive class &#954; of formulae there
>> correspond
>> recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
>> belongs to Flg(&#954;) (where v is the free variable of r).
>>
>> *
>> *   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/
>>
>>
>
>
>
> --
> To every &#969;-consistent recursive class &#954; of formulae there
> correspond
> recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
> belongs to Flg(&#954;) (where v is the free variable of r).
>
> *
> *   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/
>
>



-- 
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

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