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, is already up and running.

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

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-----
[] On Behalf Of Christopher Baum
Sent: Sunday, October 07, 2012 8:25 PM
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 Baum   |   Boston College Economics & DIW Berlin   |
                             An Introduction to Stata Programming  |
  An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

*   For searches and help try:

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