Bookmark and Share

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

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

re: st: twoway line

From   Christopher Baum <>
To   "" <>
Subject   re: st: twoway line
Date   Sun, 7 Oct 2012 12:24:33 +0000

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:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index