Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: twoway line

 From "Lynn Lee" To Subject st: twoway line Date Sun, 7 Oct 2012 20:58:57 +0800

```Thank you , Kit.

If I want to plot the coefficients on years only , not margins'
coefficients, how to do that?

I tried -mat b=e(b)', but coefficients on mvalue and kstock are listed in
data set. How to exclude them?  Thank you.

Best Regards,
Lynn Lee

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Christopher Baum
Sent: Sunday, October 07, 2012 8:25 PM
To: statalist@hsphsun2.harvard.edu
Subject: re: st: twoway line

<>
Lynn said

I run an OLS regression regarding returns to education.There are 20 years,
each year has its coefficient on returns o education. So, I want to plot a
graph, with year on x-axis  , each year's coefficient  on y-axis, and
confidence interval marked on the graph. How to create a data set that store
all coefficients in it, so, I can plot this picture easily?

-------------------
set more off
webuse grunfeld,clear
reg invest mvalue kstock i.year
margins year
mat b = r(b)'
svmat b
g yr = 1934 + _n if !mi(b1)
line b1 yr if !mi(b1)
--------------------

It would be quite straightforward to create this graph with confidence
intervals, using the e(V) matrix returned from -margins- and -twoway rline-.

Kit

Kit Baum   |   Boston College Economics & DIW Berlin   |
http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming  |
http://www.stata-press.com/books/isp.html
An Introduction to Modern Econometrics Using Stata  |
http://www.stata-press.com/books/imeus.html

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```