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: Plotting regression constants

From   Jennifer M Keister <>
To   "" <>
Subject   st: Plotting regression constants
Date   Sun, 7 Aug 2011 18:32:40 +0000


Thank you for your (extremely prompt) response!

I think we are part-way there on this problem, but I still have a few issues.  I am pretty unfamiliar with writing code directly in Stata, so please enlighten any rookie mistakes I am making in my syntax.  Let me provide a little more information than I did in my original post.

Prior to my posting, I have been using the following syntax to estimate a set of equations:
foreach v of varlist *var {
quietly svy: reg `v' <covariates>
estimates store `v'var, title(`v')
estout *var using vartable.txt, cells(b(star fmt(3)) se(fmt(3))) starlevels(* 0.10 ** 0.05 *** 0.01) keep(_cons)

As mentioned, I would like to produce a graph of the constants rather than this set of numerical columns produced by the -estout-command.

I have tried the syntax you suggest for a single equation:
quietly svy: reg `v' <covariates>
mat b = e(b)
local eqlist : coleq b
di "`eqlist'"
local eqlist : list uniq eqlist
di "`eqlist'"
gen b_cons=.
local i=1
foreach x of local eqlist {
replace b_cons=_b[`x':_cons] if _n==`i++'

graph box b_cons

This gives me graph with a y-axis with a range from the lower to upper quartiles, and a horizontal line at the median value for the constant.  I was hoping I could produce a more traditional box-and-whisker plot.  Is there a way to do this?

Also, is there a way to wed the plotting syntax you suggest into the estimation loop I have been using, so that I can look at a graphic version of the -estout- table I've produced thus far and see the constants for all of the equations?

Best regards and many thanks,

Jen Keister

*   For searches and help try:

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