Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Plotting regression constants
From
Jennifer M Keister <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Plotting regression constants
Date
Sun, 7 Aug 2011 18:32:40 +0000
Christophe,
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:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/