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]

st: graph on marginal effects and confidence intervals


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

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/


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