Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Nested If / then statement in a Bar Graph


From   "Clive Nicholas" <[email protected]>
To   [email protected]
Subject   Re: st: RE: Nested If / then statement in a Bar Graph
Date   Tue, 24 Aug 2004 04:43:37 +0100 (BST)

Scott Merryman replied to Alexander Rothenburg:

> sysuse auto,clear
> qui {
> reg price disp length
> gen b_disp = _b[disp]
> gen b_length = _b[length]
> scalar t_disp = _b[disp] / _se[disp]
> scalar t_length = _b[length] / _se[length]
>
> if abs(t_disp) > 1.96 {
> 	local bar1 "1, bfcolor(red) blcolor(red)"
> }
> else {
> 	local bar1 "1, bfcolor(blue) blcolor(blue)"
> }
>
> if abs(t_length) > 1.96 {
> 	local bar2 "2, bfcolor(red) blcolor(red)"
> }
> else {
> 	local bar2 "2, bfcolor(blue) blcolor(blue)"
> }
>
> }
> graph bar (mean) b_* , bargap(30) ///
> 	 bar(`bar1') bar(`bar2') ytitle("Parameter Estimate") ///
> 	blabel(bar, position(outside))

This is pretty neat, Scott, but what if you want to change this to show
the graph as, say, thin(ish) horizontal bars? I changed -bar- to -hbar-
everywhere in the code, but it threw up error messages, so obviously I was
doing something wrong! That said, I was able to add extra bars for extra
variables without too much difficulty.

That leads to the second question. If you're like me and you're running a
model with 50 variables, presumably there's no quick-and-dirty workaround.

Third, what if Alex wanted to use beta-weights as opposed to b-scores?
Unfortunately, -ereturn list- doesn't leave these behind even if you enter

. reg price disp length, beta

but, again, maybe there's a workaround here, too. Thanks also to Alex for
putting the question.

CLIVE NICHOLAS        |t: 0(044)191 222 5969
Politics              |e: [email protected]
Newcastle University  |http://www.ncl.ac.uk/geps
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index