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   Green Alexandra <[email protected]>
To   [email protected]
Subject   Re: st: How to Plot: One dummy, different markers for different values, over time, by individual states
Date   Fri, 10 Jul 2009 01:14:31 +0800

Many thanks to Nick and Maarten for your help!

The method, sorting the states with regard to the total number of
years with unusual rain, is precisely what I was hoping for and it's
working very well.

Thank you!
Alex


2009/7/9 Maarten buis <[email protected]>:
>
>
> --- On Thu, 9/7/09, Nick Cox wrote:
>> That said, it's worth pondering the syndrome that Howard
>> Wainer has repeatedly stigmatised as "Alabama first!" -- the
>> exact words in this case.
>
> For example your graph would probably be a lot clearer if you
> sort the states with regard to the total number of years with
> unusual rain. Below is an example that does that. To run it
> you will need to install the -egenmore- package from SSC, by
> typing in Stata -ssc install egenmore-.
>
> *----------------- begin example ----------------
> // create some example data
> drop _all
> input str10 state   year unusualrain
>      "Alabama"     1970  1
>      "Alabama"     1971 -1
>      "Alabama"     1972 -1
>      "California"  1970  1
>      "California"  1971  1
>      "California"  1972  1
>      "New York"    1970 -1
>      "New York"    1971  1
>      "New York"    1972  1
> end
>
> // creating a variable counting per state the total
> // number of years with unusual rain
> gen zero_one = unusualrain == 1 if unusualrain < .
> bys state : egen tot = total(zero_one)
>
> // create a variable for the y-asis that sorts
> // states on the total number of years with
> // unusual rain
> egen axis_state = axis(tot state), label(state)
>
> // create the graph
> twoway scatter axis_state year if unusualrain == 1 || ///
>       scatter axis_state year if unusualrain == -1,  ///
>       ylab(1/3, valuelabel)                          ///
>      legend(order( 1 "much rain" ///
>                    2 "little rain" ))
> *------------------ end example --------------------
>
> Hope this helps,
> Maarten
>
> -----------------------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
>
>
>
>
>
>
> *
> *   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/
>

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