Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

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

From |
Lars Folkestad <lfolkestad@health.sdu.dk> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: Graph Mean SD of continuous variable over categorical variable - but with a twist |

Date |
Tue, 25 Oct 2011 11:25:20 +0200 |

That did the trick. Thank you! lars Den 25/10/11 10.32 skrev "Nick Cox" <njcoxstata@gmail.com>: >See also > >http://www.stata.com/statalist/archive/2011-09/msg01293.html > >for an answer on 28 September to what seems like the same question, >just asked differently. > >Nick > >On Tue, Oct 25, 2011 at 8:58 AM, Nick Cox <njcoxstata@gmail.com> wrote: >> See also >> >> SJ-5-4 gr0023 . . . . Stata tip 27: Classifying data points on >>scatter plots >> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. >>J. Cox >> Q4/05 SJ 5(4):604--606 (no >>commands) >> tips for using separate, gray-scale gradation, and text >> characters as class symbols to classify data points on >> a scatter plot >> >> for technique relevant to the "for each group" part of the question. >> In a sentence, use -separate- to separate the response into different >> variables. >> >> Nick >> >> On Tue, Oct 25, 2011 at 8:35 AM, Maarten Buis <maartenlbuis@gmail.com> >>wrote: >>> On Tue, Oct 25, 2011 at 9:02 AM, Lars Folkestad wrote: >>>> I am trying to depict the differences in mean+-SD of two continuous >>>> Variables over a categorical variable <snip> >>>> scatter mean cat || rcap upper lower cat >>> <snip> >>>> But this does not give me the option to change the colour of the >>>> Mean (dot) or the SD (bars) for each group, which visually would >>>> Be preferable. >>> >>> It does give you that possibility, you just need to find the right >>> options. That command consists of two parts separated by -||-. The >>> first part graphs mean against the categorical variable and the second >>> graphs the standard deviation bars against the categorical variable. >>> To find the options possible after the first command type in Stata >>> -help twoway scatter- and to find the options possible after the >>> second command type in Stata -help twoway rcap-. In the example below >>> I give a silly (and extremely ugly) example of how you can change the >>> way your graph looks: >>> >>> *--------------------- begin example ---------------------- >>> sysuse auto, clear >>> egen mean = mean(price) , by(rep78) >>> egen sd = sd(price), by(rep78) >>> gen upper = mean + sd >>> gen lower = mean - sd >>> >>> scatter mean rep78 , /// plots the mean against rep78 >>> msymbol(S) /// change the symbol to a solid square >>> msize(huge) /// make the marker size huge >>> color(purple) /// change the color of the symbol to purple >>> || /// start a new overlay graph >>> rcap upper lower rep78, /// plots the standard deviation against >>>rep78 >>> lpattern(longdash) /// make the line dashed >>> lwidth(thick) /// make the line thick >>> lcolor(pink) // make the the line pink >>> *---------------------- end example ----------------------- >>> (For more on examples I sent to the Statalist see: >>> http://www.maartenbuis.nl/example_faq ) >>> >> > >* >* 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/

**References**:**Re: st: Graph Mean SD of continuous variable over categorical variable - but with a twist***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**st: Re: rolling and ts operators** - Next by Date:
**RE: st: using foreach in regression models** - Previous by thread:
**Re: st: Graph Mean SD of continuous variable over categorical variable - but with a twist** - Next by thread:
**st: repeatedly shuffle number sequence** - Index(es):