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: RE: graph on marginal effects and confidence intervals
From
"Martin Weiss" <[email protected]>
To
<[email protected]>
Subject
RE: st: RE: graph on marginal effects and confidence intervals
Date
Mon, 5 Apr 2010 13:36:42 +0200
<>
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: [email protected]
[mailto:[email protected]] On Behalf Of Mirko
Sent: Montag, 5. April 2010 13:16
To: [email protected]
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 <[email protected]> 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: [email protected]
> [mailto:[email protected]] On Behalf Of Mirko
> Sent: Montag, 5. April 2010 13:02
> To: [email protected]
> 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/