[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Nested If / then statement in a Bar Graph
I am making a series of bar graphs in STATA, each of which plots the
magnitudes of certain parameter estimates of different variables in a
regression against each other. I want to somehow indicate on the graph
which variables are significant and which are not, so I was thinking of
changing the color of bars depending on whether or not the parameter
estimate is significantly different from zero.
In this light, after running my regression, I define:
generate nafta_b = _b[nafta_der]
scalar nafta_t = _b[nafta_der] / _se[nafta_der] (where nafta_der is one
variable whose parameter estimate I want to plot)
and I make the following graph:
graph bar (mean) nafta_b and other similar variables, ///
bar(1, bfcolor(red) blcolor(red) if nafta_t > 1.96) ///
(and other graph options)
My question is how can I get the bars to change colors, depending on
whether or not the t-statistic is greater than 1.96? The if command nested
in the bar statement doesn't work, and it won't let me put an if / then
statement outside the statement. Any ideas on what I should do?
Thank you, in advance, for your assistance with this.
* For searches and help try: