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: Fwd: Graphs and xscale option: plotting only an excerpt of the original distribution of variables


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Fwd: Graphs and xscale option: plotting only an excerpt of the original distribution of variables
Date   Thu, 28 Nov 2013 12:37:20 +0000

I can only repeat what I said. -xscale()- will never omit data.
Missings are irrelevant here, as they can't be plotted any way.

Best to give us an example constructed from a Stata dataset we can all access.
Nick
[email protected]


On 28 November 2013 12:32, Rüdiger Vollmeier
<[email protected]> wrote:
> Dear Nic,
>
> I used the xscale(range(.1 .5)) option  which - unfortunately - does
> not work, i.e.
>
> cumul Var, gen(PTI1)
> cumul Var_2, gen(PTI2)
> cumul Var_3, gen(PTI3)
>
> stack  PTI1 Var  PTI2 Var_2 PTI3 Var_3, into(c temp) wide clear
> line PTI1 PTI2 PTI3 temp, sort xscale(range(0.1 .5))
>
>
> Any idea why (I checked whether it has something to do with missing
> values - even if I exclude them, things do not work)?
>
> 2013/11/28 Nick Cox <[email protected]>:
>> -distplot- is from the Stata Journal. Let me repeat a longstanding
>> request, explicit in the FAQ, that you explain where user-written
>> programs you refer to come from.
>>
>> As you imply, -if- and -in- with -distplot- work as usual with Stata
>> commands in selecting which observations in your data are used. There
>> is no option to select only part of the distribution functions for
>> display and (I gather) no plan to add such an option.
>>
>> Saying -xscale( r( ) )- does not work is misleading here: it is
>> standard that -xscale( r() )- cannot be used to restrict what is
>> shown, only to extend the x axis.
>>
>> The easy option for you is to use -cumul- to calculate the
>> distribution functions and then plot what you want.
>>
>> I don't see that your other statement is correct: i.e. that your
>> problem would occur
>> for any graph command. If you have access to variables holding the
>> distribution functions you can control which values are shown on a
>> graph.
>> Nick
>> [email protected]
>>
>>
>> On 28 November 2013 10:36, Rüdiger Vollmeier
>> <[email protected]> wrote:
>>> Hello,
>>>
>>> I want to plot only part of a cumulative distribution. I.e. using
>>> -distplot- to plot the following CDFs (but the basic problem is
>>> independet of the Stata command used, i.e. it would ocurr for any
>>> Stata command e.g. -scatter- or -line-).
>>>
>>> distplot Var_1 Var_2 Var_3
>>>
>>> I have the following problem: I want to see the CDFs only for some
>>> values of the variables i.e. for
>>> Var_1<=.5 & Var_1>=.1 & Var_2<=.5 & Var_2>=.1 & Var_3<=.5 & Var_3>=.1
>>>
>>> In other words, I want to see only an excerpt of the original plot.
>>>
>>> Using just the xscale option does not work, i.e. does not work:
>>>
>>> distplot Var_1 Var_2 Var_3  xsc(r(0.1,.5)) xlabel(0.10 0.25 0.30 0.33 0.50)
>>>
>>> Restricting the data is not what I want, i.e.
>>>
>>> distplot Var_1 Var_2 Var_3 if Var_1<=.5 & Var_1>=.1 & Var_2<=.5 &
>>> Var_2>=.1 & Var_3<=.5 & Var_3>=.1, xsc(r(0.1,.5)) xlabel(0.10 0.25
>>> 0.30 0.33 0.50)
>>>
>>> would plot the distribution for certain values of Var_1, Var_2 and
>>> Var_3. In contrast, I would like to plot the distribution for all
>>> values but see only part of the distribution. Any ideas how to achieve
>>> this?
>>>
>>> Best,
>>> R
>>> *
>>> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index