[R] smooth.spline codes
Martin Maechler
maechler at stat.math.ethz.ch
Mon Aug 2 11:01:11 CEST 2004
>>>>> "chuanjun" == chuanjun zhang <chzhang at cs.ucr.edu>
>>>>> on Sun, 01 Aug 2004 12:29:20 -0700 writes:
chuanjun> The calculation of penalty criterion in smooth.spline
chuanjun> is " pen.crit <- sum(wbar * (ybar - fit$ty) *ybar) ",
chuanjun> but I think it should be "
chuanjun> pen.crit <- sum(wbar * (ybar - fit$ty) * (ybar-fit$ty)) "
chuanjun> right ? Why the integral of the
chuanjun> fit$ty is not included ?
First: This is only the pen.crit component of
smooth.spline()'s return value, and not the internally used
penalty criterion.
But then you are right.
chuanjun> Why the integral of the fit$ty is not included ?
Probably the idea was to use the well known trick that
\sum_i{ (y_i - \bar{y})(y_i - \bar{y}) } =
\sum_i{ (y_i - \bar{y}) * y_i }
since
\sum_i{ (y_i - \bar{y}) \bar{y} } =
\bar{y} * \sum_i{ (y_i - \bar{y}) } = 0 (because the \sum is 0).
but then whoever wrote that pen.crit <- .......... line
confused the two, 'fit$ty' and 'ybar'.
I'm fixing this for R-devel.
Note once more that this won't change anything in
smooth.spline() computation or it's more important return
value components.
I assume nobody has really used smooth.spline()'s $pen.crit
component really in a quantitative way (or they should have
found the problem as well).
Martin Maechler
More information about the R-help
mailing list