norder: Order of a B-spline

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/norder.R

Description

norder = number of basis functions minus the number of interior knots.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
norder(x, ...)
## S3 method for class 'fd'
norder(x, ...)
## S3 method for class 'basisfd'
norder(x, ...)
## Default S3 method:
norder(x, ...)

#norder.bspline(x, ...)

#NOTE:  The following is required by CRAN rules that
# function names like "as.numeric" must follow the documentation
# standards for S3 generics, even when they are not.
# Please ignore the following line:
## S3 method for class 'bspline'
norder(x, ...)

Arguments

x

Either a basisfd object or an object containing a basisfd object as a component.

...

optional arguments currently unused

Details

norder throws an error of basisfd[['type']] != 'bspline'.

Value

An integer giving the order of the B-spline.

Author(s)

Spencer Graves

See Also

create.bspline.basis

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
bspl1.1 <- create.bspline.basis(norder=1, breaks=0:1)

stopifnot(norder(bspl1.1)==1)

stopifnot(norder(fd(0, basisobj=bspl1.1))==1)

stopifnot(norder(fd(rep(0,4)))==4)

stopifnot(norder(list(fd(rep(0,4))))==4)
## Not run: 
norder(list(list(fd(rep(0,4)))))
Error in norder.default(list(list(fd(rep(0, 4))))) :
  input is not a 'basisfd' object and does not have a 'basisfd'
component.

## End(Not run)

stopifnot(norder(create.bspline.basis(norder=1, breaks=c(0,.5, 1))) == 1)

stopifnot(norder(create.bspline.basis(norder=2, breaks=c(0,.5, 1))) == 2)

# Defaut B-spline basis:  Cubic spline:  degree 3, order 4,
# 21 breaks, 19 interior knots.
stopifnot(norder(create.bspline.basis()) == 4)

## Not run: 
norder(create.fourier.basis(c(0,12) ))
Error in norder.bspline(x) :
  object x is of type = fourier;  'norder' is only defined for type = 'bsline'

## End(Not run)

fda documentation built on May 2, 2019, 5:12 p.m.