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 at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: mlowess- Rescaling the Y-axis


From   "Vahid Ravaghi, Dr" <vahid.ravaghi@mcgill.ca>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: mlowess- Rescaling the Y-axis
Date   Wed, 19 Sep 2012 01:30:04 +0000

Thanks Nick for your advice. Editing the code was the ideal strategy. I managed to rescale the smoothed curve using the command 'mlowess', albeit, indirectly. I thought to share this with the Statalist, particularly those with no experience of editing codes and ado files.

I used the 'generate' option of the 'mlowess' to create var1 containing smoothed values of yvar. 

.mlowess yvar xvar1 xvar2, generate(var1) lowess(bwt(#)) 

Then I simply created a graph:

.twoway line var1 xvar1

This graph could be simply modified.

Vahid  

   

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 14 September 2012 17:41
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: mlowess- Rescaling the Y-axis

I don't know why that is surprising; it's exactly what would be expected from the documentation for -twoway lowess-. -mlowess- (SSC) is a different beast and I think you would need to do what I recommended, namely copy and edit the code. I've not tried it myself.

Nick

On 14 Sep 2012, at 19:23, "Vahid Ravaghi, Dr"  
<vahid.ravaghi@mcgill.ca> wrote:

> Thanks for your response Nick. Can you please be more specific? For 
> the lowess, to my surprise, adding 'twoway' to the command (.twoway 
> lowess var1 var2) removed all points, depicted only the smooth curve, 
> and enabled rescaling the y-axis. It does not seem to be working for 
> the mlowess though.
>
> Vahid
>
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner- 
> statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
> Sent: 14 September 2012 01:07
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: mlowess- Rescaling the Y-axis
>
> -mlowess- (SSC) is user-written, as you are asked to explain.
>
> To get what you want you would need to clone -mlowess- and remove all 
> the graphics calls except those drawing the predicted values given the 
> predictors.
>
> If they are essentially flat w.r.t. the predictors the modelling or 
> smoothing exercise is evidently finding little structure in the data.
>
> Nick
>
>
> On 13 Sep 2012, at 20:26, "Vahid Ravaghi, Dr"
> <vahid.ravaghi@mcgill.ca> wrote:
>
>> Hi Statalist
>>
>> I am trying to depict the Lowess smoothing with multiple predictors 
>> using the command 'mlowess'. Because I only needed the smoothed 
>> curve, I added the 'nopt' option to get rid of the scatterplot. This 
>> was the
>> code:
>>
>> .mlowess teeth income, nopt
>>
>> The curve lie below the value 2 of the y-axis, but the y-axis ranges 
>> from 0-25. As a result, the curve looks really small and it is hard 
>> to interpret. Changing the range of the y-axis using the' yscale'
>> and 'ylable' is not feasible due to wide range of observations. I was 
>> wondering if anyone have any suggestion to enlarge the curve either 
>> by changing the scale of the y-axis  or etc..
>>
>> Kind regards,
>>
>> Vahid Ravaghi
>> Postdoctoral Fellow
>> McGill University
>>
>>
>>
>> *
>> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index