From therneau at mayo.edu  Thu Aug  2 15:09:38 2012
From: therneau at mayo.edu (Terry Therneau)
Date: Thu, 02 Aug 2012 08:09:38 -0500
Subject: [Rd] Rd] Numerics behind splineDesign
In-Reply-To: <mailman.25.1343901607.15222.r-devel@r-project.org>
References: <mailman.25.1343901607.15222.r-devel@r-project.org>
Message-ID: <501A7C12.90407@mayo.edu>



On 08/02/2012 05:00 AM, r-devel-request at r-project.org wrote:
> 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
The ns and bs function post-process the spline bases to get an 
orthagonal basis matrix, this is the use of qr.  I think this causes 
much more grief than it is worth, for the sake of a small increase in 
numeric stability.  For instance when you plot the spline bases, they 
don't look anything like the basis functions one would expect.  (Perhaps 
my background in numerical analysis was a hindrance here, since I know 
something about splines and thus have an expectation).

Terry Therneau



[Rd] Rd] Numerics behind splineDesign
Terry Therneau