Re: [Rd] Numerics behind splineDesign

From: Nathaniel Smith <>
Date: Wed, 01 Aug 2012 16:36:02 +0100

Thanks everyone for the suggestions.

On Wed, Aug 1, 2012 at 2:39 PM, peter dalgaard <> 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 mailing list Received on Wed 01 Aug 2012 - 15:41:08 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 02 Aug 2012 - 14:20:36 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive