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: graphing median values against time


From   Donald Spady <[email protected]>
To   Statalist Statalist <[email protected]>
Subject   Re: st: graphing median values against time
Date   Sun, 30 Mar 2014 18:29:34 -0600

Nick
I had tried various combinations of that command and could not get it to work.

  here is my command
.lgraph tottend28  bvisittm1N if bvisittm1N < 55, by(aborig) xlabel(0(3)54) stat(mean)  alsocollapse((median)) addplot(lgraph tottend28  bvisittm1N if bvisittm1N <55, by(aborig))

It doesn't work.  I get the error
lgraph is not a twoway plot type
r(198);

Don
On Mar 30, 2014, at 5:14 PM, Nick Cox <[email protected]> wrote:

> Timothy explains how to do that in the help.
> 
>    addplot(plot) This allows additional twoway plots to be plotted.
> See addplot_option. Note that
>        because lgraph collapses the data before plotting in twoway,
> plots given in addplot(plot)
>        should also refer to the collapsed data. Specify in
> alsocollapse(clist) any additional data
>        that need to be collapsed.
> 
> So, if you want median as well as mean you must specify
> 
> alsocollapse(median) addplot(<whatever>)
> 
> Note that nothing obliges you to use another -line- call.
> 
> I haven't use -lgraph-, just looked at its help, but Timothy provides
> lots of functionality.
> Nick
> [email protected]
> 
> 
> On 30 March 2014 23:51, Donald Spady <[email protected]> wrote:
>> Timothy
>>  I am using your -lgraph- command and wonder if it is possible to have TWO stats created (e.g. mean and median) for the same variable(s) at the same time.  I want to plot both mean and median and cannot create an overlay to do so.
>> 
>> Many thanks
>> Don
>> On Mar 28, 2014, at 1:29 AM, Timothy Mak <[email protected]> wrote:
>> 
>>> The command -lgraph- that I wrote is for exactly this kind of problem if you don't want to create all the variables before plotting a graph.
>>> You can see it by typing:
>>> ssc des lgraph
>>> 
>>> Tim
>>> 
>>> -----Original Message-----
>>> From: [email protected] [mailto:[email protected]] On Behalf Of Donald Spady
>>> Sent: 28 March 2014 08:59
>>> To: Statalist Statalist
>>> Subject: Re: st: graphing median values against time
>>> 
>>> Nick
>>> It works.  Just as I needed. Many thanks.
>>> John: That suggestion didn't work the way I wanted it to, but thanks for the idea.
>>> 
>>> Don
>>> On Mar 27, 2014, at 5:48 PM, Nick Cox <[email protected]> wrote:
>>> 
>>>> Sure. If you use -egen-'s -median()- and -mean()- functions to get the
>>>> variables you want, then it's any graph you want.
>>>> 
>>>> As the median and mean values are repeated, don't plot them repeatedly.
>>>> 
>>>> Here are some dopey examples.
>>>> 
>>>> . webuse grunfeld
>>>> 
>>>> . egen median = median(invest), by(year)
>>>> 
>>>> . egen mean = mean(invest), by(year)
>>>> 
>>>> . egen tag = tag(year)
>>>> 
>>>> . line mean median year if tag
>>>> 
>>>> For finer subdivisions, just use more variables as arguments to -by()-.
>>>> 
>>>> Nick
>>>> [email protected]
>>>> 
>>>> 
>>>> On 27 March 2014 22:34, Donald Spady <[email protected]> wrote:
>>>>> Dear all
>>>>> I want to graph the median and mean values of a series of variables against a time variable (on the X axis) and with the option of stratifying the variables by another one (such as sex or disease state).  I think I can do this by collapsing the data but is it possible to do this while retaining the data set in its 'original' state.  I have searched the archives and the reference manuals but have not come up with anything that seems to be what I want.
>>>>> In many ways what I would like is a box plot with JUST the median (or mean) being plotted: no box, no outliers.  Is that possible.
>>>>> 
>>>>> Thanks
>>>>> Don
>>>>> *
>>>>> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index