Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: out of sample lowess prediction

 From Nick Cox To "statalist@hsphsun2.harvard.edu" Subject Re: st: out of sample lowess prediction Date Wed, 8 Aug 2012 00:16:21 +0100

```I'd add an orthogonal comment.

-lowess- was for a while my favourite scatter plot smoother, but it
has been displaced in my affections. Some of its disadvantages are
minor or trivial but they add up.

1. -lowess- is based on lots of regressions, and can be _very_ slow.

2. -lowess- as implemented in Stata is just one of several
interpretations of the lowess method. This is a small problem when
explaining what you did and/or comparing it with results from other
software.

3. -lowess- can displease aesthetically because the results are often
not smooth visually, leaving all shorts of minor irregularities. It is
true that showing any main structure is the main purpose of a
smoother, but it is also true that

4. Often -lowess- will agree with other smooths for "reasonable"
problems, other smooths including restricted cubic splines and
fractional polynomials. As these other smooths are typically much
faster, are visually smooth in their result and leave some kind of
model in their wake, they have definite advantages over lowess and no

Nick

On Tue, Aug 7, 2012 at 5:34 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> Short answer is, I believe, No. Several issues of principle and practice are
> bound up here. Sufficient to say that -lowess- is based on what is possibly
> a very large number of regression results  which would be impractical to
> save.
>
> Nick
>
>
> On 7 Aug 2012, at 16:42, Eric Lewis <erikylewis@gmail.com> wrote:
>
>> Dear all,
>>
>> This seems like a simple question, but I'm having a hard time finding
>> a solution: Is it possible to do out of sample prediction with lowess?
>>
>> For example, here is some simple code where I'd like to generate out
>> of sample predictions for even-numbered observations using data only
>> from odd-numbered observations :
>>
>> * data generation
>> clear
>> set obs 11
>> gen x = .
>> gen y = .
>> forvalues i = 1(1)11 {
>>   replace x = `i' in `i'
>>   replace y = (`i')^2 in `i' if (floor((`i')/2) != ((`i')/2) )
>>    * (only generates y variables for odd numbered x's)
>> }
>> * lowess -- local linear regression
>> lowess y x, gen(new_y)
>> list x y new_y
>>
>>
>
*
*   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/
```