Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: change grouping in Stata -graph- command


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: change grouping in Stata -graph- command
Date   Fri, 31 May 2013 17:42:58 +0100

Another solution uses -statplot- (SSC)

 sysuse auto, clear
 statplot rep78 headroom gear_ratio, over(foreign)
 statplot rep78 headroom gear_ratio, over(foreign) recast(bar)

The default statistic shown is the mean (surprise).

.
Nick
njcoxstata@gmail.com


On 31 May 2013 17:34, Nick Cox <njcoxstata@gmail.com> wrote:
>  In a strong sense it does. You want three paired-bar charts showing
> means, side by side. So,
>
> 1. Produce three paired-bar charts
>
> 2. Put them side by side.
>
> Here is a dopey example:
>
> sysuse auto, clear
>
> foreach v in rep78 headroom gear_ratio {
>           graph bar `v', over(foreign) title(`: var label `v'')
> name(`v')  ytitle("")
> }
>
> graph combine rep78 headroom gear_ratio2 row(1) ycommon note(Mean scores)
>
> Nick
> njcoxstata@gmail.com
>
>
> On 31 May 2013 15:06, Andrea Bennett <mac.stata@gmail.com> wrote:
>
>> Thanks a lot Billy!
>>
>> I see what you do… But I still think Stata should provide a more obvious solution to this problem…
>
>>
>>>>> I've spent hours on the following issue but seem to be unable to find the correct way to deal with such a graph:
>>>>>
>>>>> I have questionnaire data where people are ask how much they liked some aspect; e.g. three variables LOCATION, PRICE, TEMPERATURE (all 1-7 scale).
>>>>>
>>>>> Both the treatment and control group filled in the same questionnaire. I want to see graphically how the treatment and control groups differ in above dimensions.
>>>>>
>>>>> The following produces the correct data but groups in a "wrong" way. The groups are divided into treated/not-treated:
>>>>>
>>>>> graph bar location price temperature, over(treated)
>>>>>
>>>>> However, I would like to have the following:
>>>>>
>>>>> Location - not treated
>>>>> Location - treated
>>>>>
>>>>> [gap]
>>>>>
>>>>> Price - not treated
>>>>> Price - treated
>>>>>
>>>>> [gap]
>>>>>
>>>>> Temperature - not treated
>>>>> Temperature - treated
>>>>>
>>>>> I really don't see who I can produce this result. Options such as -asy- or -asc- seem to go into the right direction but are not producing the result I desire. I would think that this is a rather common feature but it seems utterly difficult to get.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index