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   Wed, 25 Aug 2004 01:00:57 +0100 (BST)

Scott,

> sysuse auto,clear
> qui {
> reg price disp length
> betacoef
> matrix A = r(beta)
>
> gen b_disp = A[1,1]
> gen b_length = A[1,2]
> 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 hbar (mean) b_* , outergap(100) bargap(250)  ///
>     bar(`bar1') bar(`bar2') ytitle("Beta Coefficients") ///
>     blabel(bar, position(outside))

For me, this code is a definite improvement on before. It produces some
very effective -hbar- graphs and act as an aid to presenting regressions
in a more accessible way. Thanks for this.

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