I have noticed a slightly puzzling behaviour exhibited by
smooth.spline().  If I do

        sss <- smooth.spline(x,y)

for a certain pair of data vectors x and y, and then do

        length(sss$x)

I get the result ``18''.  However if I do

        length(unique(x))

I get ``27''.  Trying to force smooth.spline() to use more knots I
tried

        sss <- smooth.spline(x,y,all.knots=TRUE)

but again got output of length 18 again.  I then tried

        sss <- smooth.spline(x,y,nknots=27)

and got an error message.  Finally I was inspired to re-scale the
x-values.  Doing

        x <- x - min(x)
        sss <- smooth.spline(x,y)

gave me output of length 27 as expected.  Apparently smooth.spline()
is using a criterion for distinctness of x values which is based on a
tolerance relative to the size of the x's.  (I.e. a different
criterion from unique().)  While this is assuredly a Good Thing, it
might be nice to have some sort of warning in the help file to keep
young players from getting confused.

                                cheers,

                                        Rolf Turner
                                        [EMAIL PROTECTED]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to