[Rd] Numerics behind splineDesign
Nathaniel Smith
njs at pobox.com
Wed Aug 1 17:36:02 CEST 2012
Thanks everyone for the suggestions.
On Wed, Aug 1, 2012 at 2:39 PM, peter dalgaard <pdalgd at gmail.com> wrote:
>
> On Jul 31, 2012, at 15:46 , Bert Gunter wrote:
>
>> Well, I would first check the references given in the Help file!.
>> That's what they're for, no? Hastie's book is likely to more complete
>> on the algebra, I think.
How embarrassing... the help files do cite the white book (only), and
I did check it of course, but it has no more details on how the basis
functions are computed than does the help file itself, and so I must
have forgotten about it when writing my email. Still, my apologies for
the confusion.
I'm not sure what you mean by "Hastie's book", though?
>> You might also be interested in the relevant chapters of Friedman,
>> Hastie, et. al "The Elements of Statistical Learning Theory," which
>> might be a gentler exposition of the math.
>>
>> Of course, the code (or a suitable exposition of it, which may not
>> exist) is the ultimate reference.
>
> Also check out the various web resources (Google for basis spline or B-spline). I don't recall the white book chapter, but it might be a little short on the algebraic details. Another Google point is "de Boor".
And indeed, it looks like the appendix to chapter 5 of Hastie,
Tibshirani, and Friedman (2008) has a short description of the de Boor
algorithm. Excellent. For the archives, this seems to be enough to
exactly implement spline.des/splineDesign, and if anyone else is
working in Python then it turns out that there is a more-or-less
undocumented implementation of this algorithm in
scipy.interpolate.splev.
Now I just have to grovel over the R code in ns() and bs() to figure
out how exactly they pick knots and handle boundary conditions, plus
there is some code that I don't understand in ns() that uses qr() to
postprocess the output from spline.des. I assume this is involved
somehow in imposing the boundary conditions...
Thanks again everyone for your help,
-- Nathaniel
More information about the R-devel
mailing list