Learn R Programming

bspline (version 2.4.0)

iknots: Estimate internal knot positions equalizing jumps in n-th derivative

Description

Normalized total variation of n-th finite differences is calculated for each column in y then averaged. These averaged values are smoothed (if requested) and sampled to find knot positions which equalize the jumps of n-th derivative. If any of found knots fall inside a same x interval, TV is smoothed till no such situation occurs.

Usage

iknots(x, y, nki = 1L, n = 3L, lenfit = 12L, smooth = FALSE)

Value

Numeric vector, estimated knot positions

Arguments

x

Numeric vector

y

Numeric vector or matrix

nki

Integer scalar, number of internal knots to estimate (1 by default)

n

Integer scalar, polynomial order of B-spline (3 by default)

lenfit

Integer scalar, length of knots for linear spline to fit the total variation if greater than 0, otherwise full linear interpolation is used (12 by default)

smooth

Logical scalar, should total variation be smoothed? (FALSE by default)