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]

AW: st: AW: tabplot how to get rid of Graphs by ?


From   "Kaulisch, Marc" <kaulisch@forschungsinfo.de>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   AW: st: AW: tabplot how to get rid of Graphs by ?
Date   Fri, 7 Jun 2013 13:20:30 +0000

Hi Nick,

awesome solution as usual. I applied it successfully - stupid me that I have not thought about it earlier - at least it revealed a bug (or inconvenience) in tabplot ;-)

Thanks a lot.


Marc

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nick Cox
Gesendet: Freitag, 7. Juni 2013 14:29
An: statalist@hsphsun2.harvard.edu
Betreff: Re: st: AW: tabplot how to get rid of Graphs by ?

OK. I have an initial guess at what the problem might be.

In essence, -tabplot- has no special logic to calculate results for the total graph implied by -by(, total)-. I would call that an undocumented limitation. If you wanted to call it a bug you would have a good case. I think I need to document it.

What you want may possibly be better approached with a trick. I will illustrate with the auto data. I get the impression that you are fluent enough in Stata to work out the equivalent for your problem.


sysuse auto, clear

expand 2

replace rep78 = 6 in 75/L

 label def rep78 6 "Total"

 label val rep78 rep78

gen himpg = mpg > 30

tabplot himpg foreign, by(rep78) percent(foreign rep78) showval

That way "all observations" just becomes an extra category.

Nick
njcoxstata@gmail.com


On 7 June 2013 12:39, Kaulisch, Marc <kaulisch@forschungsinfo.de> wrote:
> Hi Nick,
>
> a quick try with addplot was not successful - as you suggest as well 
> ;-)
>
> Added value of total sub-option: I think it could have a great added value if I can show the a) total results and b) these for each value of by variable.
> So in my (own data) example:
> The satisfaction regarding supervision is broken down by gender and (with by-) by discipline. With -total- I would like to add the total of satisfaction by gender to the graph.
>
> Marc
>
>
> -----Ursprüngliche Nachricht-----
> Von: owner-statalist@hsphsun2.harvard.edu 
> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nick Cox
> Gesendet: Freitag, 7. Juni 2013 13:08
> An: statalist@hsphsun2.harvard.edu
> Betreff: Re: st: AW: tabplot how to get rid of Graphs by ?
>
> Sorry, I am still completely lost.
>
> With -tabplot- -by()- provides a third variable, so you what are seeing is a graph of a three-way tabulation.
>
> You have not addressed my comment that what the -total- sub-option adds is of no use or interest any way.
>
> The -addplot()-  option was added just in case anyone wanted it and could find a way of using it, but my instinct is that it will not help you here. -tabplot- is based on using temporary variables for everything and you have no scope for accessing any of those from the command line.
>
> If you were able and willing to send me, privately, some or all of your data and what commands you have been trying, I could make one more attempt to understand you, but it might not be immediate.
>
>
> Nick
> njcoxstata@gmail.com
>
>
> On 7 June 2013 11:56, Kaulisch, Marc <kaulisch@forschungsinfo.de> wrote:
>> Hi Nick,
>>
>> thanks for your reply. The problem I have is that with by(, total) all 16 graphs are combined into total (at least if I understand help by_options correctly). This seem to imply that also the showval are repeated (in my case 16 times) within the total. The values are basically not readable anymore. Either I would like to suppress the showval for the total only or that the total is not overlaying all 16 graphs but produces a new one that provides the total data .
>> As I do not see any options to get both things done with the twoway_options - I try the addplot option.
>>
>> Marc
>>
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: owner-statalist@hsphsun2.harvard.edu
>> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nick Cox
>> Gesendet: Freitag, 7. Juni 2013 12:03
>> An: statalist@hsphsun2.harvard.edu
>> Betreff: Re: st: AW: tabplot how to get rid of Graphs by ?
>>
>> Sorry, but I don't understand the question.
>>
>> If you add the suboption -total-  to -by()-
>>
>> 1. -tabplot- itself does nothing special. You are just relying on 
>> what
>> -twoway- does in those circumstances.
>>
>> 2. In your example, the values shown for the -total- case are totals over percents, and so just 100% in every instance. That's reassuring, but it's not interesting or informative.
>>
>> Nick
>> njcoxstata@gmail.com
>>
>>
>> On 7 June 2013 10:28, Kaulisch, Marc <kaulisch@forschungsinfo.de> wrote:
>>> Hi Nick,
>>>
>>> a brief follow-up:
>>> In my own dataset the by-variable has 16 values. If I add the total option then the values are not readable in the total.
>>> So my question is: Is possible to present the total percent and not each single percent of the 16 different values? If this is not possible would it be possible to suppress the showval for the total only?
>>>
>>> My own example simplified:
>>> Webuse auto, clear
>>> Tabplot foreign rep78, by(make, total) showval percent(foreign make)
>>>
>>> Thanks!
>>>
>>> Marc
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: owner-statalist@hsphsun2.harvard.edu
>>> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nick 
>>> Cox
>>> Gesendet: Freitag, 7. Juni 2013 01:08
>>> An: statalist@hsphsun2.harvard.edu
>>> Betreff: Re: st: AW: tabplot how to get rid of Graphs by ?
>>>
>>> That's correct. -tabplot- is one of mine but here the answer is just to use details of Stata's standard -by()- syntax for -twoway.
>>>
>>> Nick
>>> njcoxstata@gmail.com
>>>
>>> On 6 June 2013 23:21, Kaulisch, Marc <kaulisch@forschungsinfo.de> wrote:
>>>
>>>> Okay, I found it myself. Reading the manual more carefully helps:
>>>> Solution is:
>>>> webuse rate2, clear
>>>> tabplot pop, percent showval by(rada, note(""))
>>>
>>> Kaulisch, Marc
>>>
>>>> I have a small question: I would like to do some graphs with tabplot (from ssc).
>>>> Example code is:
>>>> webuse rate2, clear
>>>> tabplot pop, percent showval by(rada) note("") caption("") 
>>>> title("")
>>>> subtitle("")
>>>>
>>>> With this code I get a caption, note or whatever saying Graphs by Radiologist A's assessment.
>>>> Is there any way that I can get rid of this caption/note/title?
>>>>
>>>> I know that I can use the Graph Editor to delete it and play the record again and again - but I think it would be smoother to do it within the code itsef.
>>> *
>>> *   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/
>>>
>>> *
>>> *   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/
>>
>> *
>> *   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/
>>
>> *
>> *   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/
>
> *
> *   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/
>
> *
> *   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/

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

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