[Rd] Numerics behind splineDesign

Bert Gunter gunter.berton at gene.com
Wed Aug 1 18:03:06 CEST 2012


On Wed, Aug 1, 2012 at 8:36 AM, Nathaniel Smith <njs at pobox.com> wrote:
> 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?

Ummm...  The following appears in the  ?bs man page. Why do you not
see it? Are you perhaps being too "hasty" in your reading (heh-heh)?


Hastie, T. J. (1992) Generalized additive models. Chapter 7 of
Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth
& Brooks/Cole.

-- Bert
>>> 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


Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374

More information about the R-devel mailing list