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]

st: Plotting nonparametric reg. line alng with linear prediction line


From   "Ivica Rubil" <[email protected]>
To   <[email protected]>
Subject   st: Plotting nonparametric reg. line alng with linear prediction line
Date   Wed, 26 Oct 2011 12:12:36 +0200

Thanks Nick.
To be more specific, i just want the standard nonparametric stuff like
Nadaraya-Watson or local linear regression. How would either of these
fit in what you sent:
scatter y x || lfit y x || line ynpfitted x, sort


--
Ivica Rubil
Ekonomski institut / The Institute of Economics, Zagreb
Trg J. F. Kennedyja 7, 10 000 Zagreb, Croatia
tel. +385-1-2362-269
fax. +385-1-2335-165
[email protected]
www.eizg.hr


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 26. listopad 2011 10:14
To: [email protected]
Subject: Re: st: Plotting nonparametric reg. line alng with linear
prediction line

-rcspline- from SSC is an example of a scatterplot smoother. (Deep
down, it is just another linear regression, but it is flexible in the
way that most nonparametric enthusiasts seek.) You could combine that
with a linear fit in this way.

. sysuse auto
(1978 Automobile Data)

. rcspline mpg weight, addplot(lfit mpg weight)

. rcspline mpg weight, lcolor(orange) addplot(lfit mpg weight,
lcolor(blue))

The line colors are changed in the last example, because with default
defaults (-scheme s2color-) the lines come out as red and green, a
graphic combination better avoided because it is problematic for many
readers. (I use -set scheme s1color-, in my profile.do.)

Nick

On Wed, Oct 26, 2011 at 8:26 AM, Nick Cox <[email protected]> wrote:
> As there are many nonparametric regression methods, you may need to be
> more specific, but
>
> scatter y x || lfit y x || line ynpfitted x, sort
>
> is a general recipe where -ynpfitted- is the prediction or smoothing
> from your nonparametric method.
>
> Nick
>
> On Wed, Oct 26, 2011 at 8:02 AM, Ivica Rubil <[email protected]> wrote:
>
>> is there anybody who knows how to plot the scatter points, the linear
>> prediction line and a nonparametric regression line on together on
one
>> graph. I plotted scattered points and the linear proediction line,
but I
>> cannot add the nonparametric regression line. Any suggestions?
>
*
*   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