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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: RE: graph on marginal effects and confidence intervals


From   Mirko <mirko.moro@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: graph on marginal effects and confidence intervals
Date   Mon, 5 Apr 2010 12:46:37 +0100

Thanks a lot Martin.


On 5 April 2010 12:36, Martin Weiss <martin.weiss1@gmx.de> wrote:
>
> <>
>
> Sounds like a case for Roger Newson`s packages:
>
>
>
> *******
> sysuse auto, clear
> regress mpg i.foreign##c.weight i.rep78 headroom
> margins, dydx(weight) over(foreign) post
>
> cap which parmest
> if _rc ssc inst parmest
> cap which eclplot
> if _rc ssc inst eclplot
>
> parmest , saving(myfile, replace)
> u myfile, clear
> replace parm="domestic" if parm=="0.foreign"
> replace parm="foreign" if parm=="1.foreign"
> encode parm, gen(myparm)
>
> eclplot estimate min95 max95 myparm, /*
>  */  rplottype(rcap) yli(0)  /*
>  */ xlabel(1(1)2, angle(45))
> *******
>
>
> HTH
> Martin
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Mirko
> Sent: Montag, 5. April 2010 13:16
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: RE: graph on marginal effects and confidence intervals
>
> Here we go:
>
> sysuse auto, clear
> regress mpg i.foreign##c.weight i.rep78 headroom
> margins, dydx(weight) over(foreign) post
> mat b=e(b)
> gen x = _n in 1/3
> gen mem = b[1,1] in 1
> replace mem= b[1,2] in 2
> twoway (rscatter mem mem x), xlabel(1(1)2) yline(0)
>
>
> On 5 April 2010 12:10, Martin Weiss <martin.weiss1@gmx.de> wrote:
>>
>> <>
>>
>> What is " b[1,1]" in your first code segment? Sounds like you are
> referring
>> to a -matrix- but I cannot see where it is actually defined.
>>
>>
>> HTH
>> Martin
>>
>>
>> -----Original Message-----
>> From: owner-statalist@hsphsun2.harvard.edu
>> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Mirko
>> Sent: Montag, 5. April 2010 13:02
>> To: statalist@hsphsun2.harvard.edu
>> Subject: st: graph on marginal effects and confidence intervals
>>
>> Dear all,
>>
>> I would like to plot marginal effects (of interaction terms) with
>> their confidence interval.
>>
>> Graphing marginal effects it is easy enough (although I am sure there
>> are more efficient ways of doing this by using -mat- or something like
>> that):
>>
>> sysuse auto, clear
>> regress mpg i.foreign##c.weight i.rep78 headroom
>> margins, dydx(weight) over(foreign) post
>> gen x = _n in 1/3
>> gen mem = b[1,1] in 1
>> replace mem= b[1,2] in 2
>> twoway (rscatter mem mem x), xlabel(1(1)2) yline(0)
>>
>> Confidence intervals could be add to that graph as bars by including
>> -(rcap up low x)- to the -twoway- command; where up and low are upper
>> and lower confidence intervals, respectively:
>>
>> twoway (rcap up low x) (rscatter mem mem x), xlabel(1(1)2) yline(0)
>>
>> The problem is how can I "capture" the confidence intervals from
>> -margins- and generate up and low variables?
>>
>> Any suggestion would be greatly appreciated.
>>
>> Best wishes,
>> Mirko
>> *
>> *   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   |   Site index