bsplines: B-spline bases

Description Usage Arguments Value C API Author(s) Examples

Description

These functions generate B-spline basis functions. bspline.basis gives a basis of spline functions. periodic.bspline.basis gives a basis of periodic spline functions.

Usage

1
2
bspline.basis(x, nbasis, degree = 3, names = NULL)
periodic.bspline.basis(x, nbasis, degree = 3, period = 1, names = NULL)

Arguments

x

Vector at which the spline functions are to be evaluated.

nbasis

The number of basis functions to return.

degree

Degree of requested B-splines.

period

The period of the requested periodic B-splines.

names

optional; the names to be given to the basis functions. These will be the column-names of the matrix returned. If the names are specified as a format string (e.g., "basis%d"), sprintf will be used to generate the names from the column number. If a single non-format string is specified, the names will be generated by paste-ing name to the column number. One can also specify each column name explicitly by giving a length-nbasis string vector. By default, no column-names are given.

Value

bspline.basis

Returns a matrix with length(x) rows and nbasis columns. Each column contains the values one of the spline basis functions.

periodic.bspline.basis

Returns a matrix with length(x) rows and nbasis columns. The basis functions returned are periodic with period period.

C API

Access to the underlying C routines is available: see the header file ‘pomp.h’ for definition and documentation of the C API. At an R prompt, execute

1
file.show(system.file("include/pomp.h",package="pomp"))

to view this file.

Author(s)

Aaron A. King kingaa at umich dot edu

Examples

1
2
3
4
5
6
7
8
x <- seq(0,2,by=0.01)
y <- bspline.basis(x,degree=3,nbasis=9,names="basis")
matplot(x,y,type='l',ylim=c(0,1.1))
lines(x,apply(y,1,sum),lwd=2)

x <- seq(-1,2,by=0.01)
y <- periodic.bspline.basis(x,nbasis=5,names="spline%d")
matplot(x,y,type='l')

Example output

Welcome to pomp version 1.19!
pomp version 2 is now available on https://kingaa.github.io/pomp/.
This new version contains many improvements but is not backward compatible.
To allow users time to modify their codes, 'pomp' version 2 will be provided as package 'pomp2' for a short while.

Around the middle of 2019, 'pomp2' will be renamed 'pomp' version 2.1 and will be released to CRAN. Until then, 'pomp' versions < 2 will continue to be available.

See the 'pomp version 2 upgrade guide' at https://kingaa.github.io/pomp/.

pomp documentation built on May 2, 2019, 4:09 p.m.

Related to bsplines in pomp...