Re: [R] Closed form for regression splines

From: roger koenker <rkoenker_at_uiuc.edu>
Date: Tue 06 Dec 2005 - 00:50:23 EST

you can do:

        X <- model.matrix(formula, data = your.data)

url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoenker@uiuc.edu            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820


On Dec 5, 2005, at 7:36 AM, Stephen A Roberts wrote:

>
> Greetings,
>
> I have a model fitted using bs() and need to be able to write down
> a closed form for the spline function to enable the use of the
> fitted model outside R. Does anyone know a simple way of extracting
> the piecewise cubics from the coefficients and knots? As far as I
> know they are defined by recurrence relationships, but the R
> implementation is buried in C code, and I guess in non-trivial to
> invert. I know about predict.bs() within R, but I want the full
> piecewise cubic.
>
> Steve.
>
> Dr Steve Roberts
> steve.roberts@manchester.ac.uk
>
> Senior Lecturer in Medical Statistics,
> Biostatistics Group,
> University of Manchester,
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-
> guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Dec 06 01:00:41 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:28 EST