Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: How to Plot: One dummy, different markers for different values, over time, by individual states


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: How to Plot: One dummy, different markers for different values, over time, by individual states
Date   Thu, 9 Jul 2009 13:10:24 +0100

In Alexandra's case, the state variable will pre-exist, but -egen, group() label- may be needed to produce a numeric variable for the y axis. 

That said, it's worth pondering the syndrome that Howard Wainer has repeatedly stigmatised as "Alabama first!" -- the exact words in this case. 

Nick 
[email protected] 

Maarten buis

--- On Thu, 9/7/09, Green Alexandra wrote:
> I am trying to make a plot with a panel from 1970 to 2000
> with an annual rain-fall dummy for all states in the U.S.,
> the dummy = 1 if above a threshold amount; = -1 otherwise.
> 
> Essentially, I am hoping to generate one plot/table that
> shows all the years on the on the x-axis;
> on the y-axis, it would plot the dummy for each state on
> the SAME line, but uses a different marker symbol  for 
> when the dummy value is 1 versus when dummy is -1. 

*--------------- begin example --------------
// create some example data
drop _all
input state year unusualrain 
      1     1970 1           
      1     1971 0           
      1     1972 0           
      2     1970 1           
      2     1971 1           
      2     1972 1
      3     1970 0
      3     1971 0
      3     1972 1
end

label define state 1 "foo" ///
                   2 "bar" ///
                   3 "bla"
label value state state

// create the graph
twoway scatter state year if unusualrain == 1 || ///
       scatter state year if unusualrain == 0, ///
       ylab(1/3, valuelabel)
*-------------- end example -------------------------


*
*   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/



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