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 on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: graph on marginal effects and confidence intervals


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: graph on marginal effects and confidence intervals
Date   Mon, 5 Apr 2010 13:10:47 +0200

<>

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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index