Bookmark and Share

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]

Re: st: Transposing dotplot (changing axes)


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Transposing dotplot (changing axes)
Date   Tue, 30 Aug 2011 15:22:40 +0100

Thanks for the report. You've caught a subtle bug.

If any kind of missing value is more frequent than any non-missing
value or bin, that's going to be represented by the largest bin height
and a nasty side-effect will be that the other bins are shrunk
proportionally.

-stripplot- is not so stupid that it tries to graph missing values.
But it does indulge missing values to allow certain kinds of plots for
several variables. It then relies on Stata not being able to plot
those values, but the calculation mentioned above is not smart enough.

I will look at the code to try to catch this problem.

Nick

On Tue, Aug 30, 2011 at 2:48 PM, Fredrik Norström
<[email protected]> wrote:
> Thanks!
>
> Problem solved. I have 1031 observations. I only use a limited number for my plots (at most 68 individuals who got both diseases). When stripplot makes graphs it obviously base its calculations (or similar) on all observations. So my 963 missing observations screws up the graph. After your last email I included an if statement where I removed all missing observations and suddenly things are working just like I want it to. Could be worth to update stripplot so that any missing values are removed by the command itself instead of adding such statement as missing values can't be plotted anyway.
>
> Thanks again for all help!
>
> Fredrik
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
> Sent: den 30 augusti 2011 14:51
> To: [email protected]
> Subject: Re: st: Transposing dotplot (changing axes)
>
> My best guess is that you don't have enough space to show all your
> data points so that they are distinct to you. You don't say how many
> observations you have. -stripplot- is not sensitive to what variables
> are called.
>
> Nick
>
> On Tue, Aug 30, 2011 at 1:31 PM, Fredrik Norström
> <[email protected]> wrote:
>> Thanks for the dataset.
>>
>> It worked perfectly well with auto but not with my own dataset. I have one variable with 4 agegroups of same format as rep78 which 5 have groups and I have a variable with integers ranging from -15 to 15. When I try this command "stripplot mpg, over(rep78) stack h(0.5)" (I even renamed by variables to same name and tested) it will still give stack all observations at same point despite working perfectly when using the autodata. I am very puzzled that things are not working as I tried over and over again.
>
>>
>> Have you ever heard of a similar problem? Could it be a strange bug with the stripplot command or am I missing out on something very obvious?
>>
>> Regards,
>>
>> Fredrik
>>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
>> Sent: den 30 augusti 2011 12:19
>> To: [email protected]
>> Subject: Re: st: Transposing dotplot (changing axes)
>>
>> Not so. -stack- shows as many data points as observations, tied or
>> not, so long as you have enough space to show them.
>>
>> As the help says
>>
>> "stack specifies that data points with identical values are to be stacked,
>>        as in -dotplot-, except that by default there is no binning of data."
>>
>> Look at
>>
>> . sysuse auto
>> (1978 Automobile Data)
>>
>> . stripplot mpg, stack
>>
>> . stripplot mpg, stack over(foreign)
>>
>>
>>
>> Nick
>>
>>
>> On Tue, Aug 30, 2011 at 10:48 AM, Fredrik Norström
>> <[email protected]> wrote:
>>> Thanks for responses.
>>>
>>> I have multiple observations at time points, e.g. three persons who are in oldest age group with 10 years difference. By default I only get one point when I want three points. How do I solve this? Dotplot automatically gives three horizontal points when multiples. I would like to have three vertical dots to show that I got three multiple observations. As far I understand will width and stack only compress to one observation and not extend to three observations or I understand things incorrectly?
>>>
>>> Fredrik
>>>
>>> -----Original Message-----
>>> From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
>>> Sent: den 30 augusti 2011 11:36
>>> To: [email protected]
>>> Subject: Re: st: Transposing dotplot (changing axes)
>>>
>>> Maarten is correct. You can use -stripplot- to get horizontal
>>> analogues of -dotplot-. The horizontal comes by default; you will need
>>> to spell out -stack- and you may need to control bin width using
>>> -width()-.
>>>
>>> Nick
>>>
>>> On Tue, Aug 30, 2011 at 10:09 AM, Maarten Buis <[email protected]> wrote:
>>>> On Tue, Aug 30, 2011 at 11:01 AM, Fredrik Norström
>>>> <[email protected]> wrote:
>>>>> I have done a dotplot (dotplot yeardifference, over(agegroups) center) where I have agegroups and for each displayed difference in years between two disease diagnoses. My dotplot shows years on y-axes. I want to have that on x-axis, i.e. I want to transpose my dotplot. Is it possible to do that or can I generate a different stata graph so that I get my dotplots horizontally instead of vertically?
>>>>
>>>> That should be possible with Nick Cox's -stripplot-, which you can get
>>>> by typing in Stata -ssc install stripplot-.
>>>>
>>>
>>> *
>>> *   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/
>>>
>>
>> *
>> *   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/
>>
>
> *
> *   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/
>

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index