R: Taylor representation of a B-Spline

TaylorSpline {fda} | R Documentation

## Taylor representation of a B-Spline

### Description

Convert B-Spline coefficients into a local Taylor series representation expanded about the midpoint between each pair of distinct knots.

### Usage

    TaylorSpline(object, ...)
    ## S3 method for class 'fd'
    TaylorSpline(object, ...)
    ## S3 method for class 'fdPar'
    TaylorSpline(object, ...)
    ## S3 method for class 'fdSmooth'
    TaylorSpline(object, ...)

### Arguments

`object` | a spline object possibly of some other class
`...` | optional arguments

### Details

1. Is `object` a spline object with a B-spline basis? If no, throw an error.

2. Find `knots` and `midpoints`.

3. Obtain coef(object).

4. Determine the number of dimensions of coef(object) and create empty `coef` and `deriv` arrays to match. Then fill the arrays.

### Value

a list with the following components:

`knots` | a numeric vector of knots(object, interior=FALSE)
`midpoints` | midpoints of intervals defined by unique(knots)
`coef` | A matrix of dim = c(nKnots-1, norder) containing the coeffients of a polynomial in (x-midpoints[i]) for interval i, where nKnots = length(unique(knots)).
`deriv` | A matrix of dim = c(nKnots-1, norder) containing the derivatives of the spline evaluated at `midpoints`.

### Author(s)

Spencer Graves

### See Also

`fd` `create.bspline.basis`

### Examples

    ##
    ## The simplest b-spline basis:  order 1, degree 0, zero interior knots:
    ##       a single step function
    ##
    bspl1.1 <- create.bspline.basis(norder=1, breaks=0:1)
    # ... jump to pi to check the code
    fd.bspl1.1pi <- fd(pi, basisobj=bspl1.1)
    bspl1.1pi <- TaylorSpline(fd.bspl1.1pi)

    ##
    ## Cubic spline:  4  basis functions
    ##
    bspl4 <- create.bspline.basis(nbasis=4)
    plot(bspl4)
    parab4.5 <- fd(c(3, -1, -1, 3)/3, bspl4)
    # = 4*(x-.5)
    TaylorSpline(parab4.5)

    ##
    ## A more realistic example
    ##
    data(titanium)
    #  Cubic spline with 5 interior knots (6 segments)
    # do not run this example on CRAN to save test time
    #if(!CRAN()){
    #titan10 <- with(titanium, curfit.free.knot(x, y))
    #(titan10T <- TaylorSpline(titan10) )
    #}

[Package fda version 2.4.8 Index]