Skip to content
Prev 63735 / 398498 Next

loess problems

The problem is that 90% of your data sit on the boundary.  Loess is a
nearest neighbor smoother (using (100 x span) % of the data to estimate at
each point).  If you call loess() directly with span=2/3 (the default in
scatter.smooth), or something smaller than about 0.91, you'll see that it
has trouble.   

Strangely, if you set span=.8, scatter.smooth() will also complain, but not
at the default span...  (Re-generating the data yet again does trigger the
warnings, so seems like it does catches things some of the time.)

For your second example, I think loess becomes undefined when the span is
set too small (and 1/n is surely too small):  You are asking the algorithm
to take the nearest 1/n of the data to do the smooth.  You would think that
should just mean _the_ nearest data point, but the problem is:
[1] TRUE

so you're asking the algoithm to take fewer than 1 data point to estimate at
each point.  The warnings you see for that example is pointing you in the
right direction.

Andy