[R] lowess + turnpoints = doubling integers?

Bob Porter rjporter at mindspring.com
Sun Dec 29 20:53:02 CET 2002


Happy New Year, r-helpers!

I am using lowess to smooth a scatter plot,
xx<-lowess(xinput,f=.04)  #defaults for other args
 followed by
turnpoints(xx$y) #defaults for other args

I plot the smoothed result as well as turnpoints (using yy$tppos) on top of raw
data plot.
Result is exactly as expected, graphically.

For another purpose, I calcuate the difference between turnpoints (representing
time intervals between turnspoints in my applicaiton), e.g.

aduration[j]<-yy$tppos[i+1]-yytppos[i]

This also appears to work as expected, HOWEVER, a typical list of such
differences looks like:
22,33,22,11,33,44,33,33,11,33,44,66,33,22,.........
there are, in some instances, three digit measure such as 110 or 106, etc. but
the double-digit measures, although of the proper magnitude, seem to always be
double integers 11 to 99.

The double-integer results are found with f=.04 and total length of vector of
1200.  With vector of length 1100 (same input data), the results are NOT
double-integer but are ALWAYS (?) of the form x0, e.g.
70,50,50,70,100,40............  The magnitude of these latter results (22 vs 70,
for example) is evidently due to the change in the smoothing span from .04*1200
to .04*1100, but I am mystified why the results have double-integers in the
first case, and terminal zeros in the second.

My project involves applying these functions in a batch run for dozens of data
sets so I want to understand more about what is going on that yeilds these
strange double-integers or zero-terminating values.

Thanks,

Bob Porter, Tampa




More information about the R-help mailing list