Basis

object Basis
class Object
trait Matchable
class Any

Value members

Concrete methods

def bs(x: DenseVector[Double], degree: Int, intercept: Boolean)(intKnots: Seq[Double], lb: Double, ub: Double): DenseMatrix[Double]

Construct a B-spline covariate matrix using input vector x.

Construct a B-spline covariate matrix using input vector x.

Value Params
degree

The degree of the required B-spline basis (3 for cubic, default).

intKnots

Interior knots.

intercept

Include first basis function?

lb

Lower boundary knot.

ub

Upper boundary knot.

x

A covariate vector.

def bspline(x: Double, i: Int, deg: Int, knots: Vector[Double]): Double

B-spline basis function. Evaluated using the de Boor recurrence.

B-spline basis function. Evaluated using the de Boor recurrence.

Value Params
deg

The degree of the B-spline.

i

The index of the B-spline function (starting from 0).

knots

The knot sequence.

x

The argument of the B-spline function.

Returns

The value of the B-spline function at x.

def cosine(x: DenseVector[Double], n: Int): DenseMatrix[Double]

Construct a cosine series basis matrix with n columns using input vector x.

Construct a cosine series basis matrix with n columns using input vector x.

Value Params
n

The number of cosine series basis functions required.

x

A covariate vector.

Returns

A matrix with rows matching the length of x and n columns.

def cosine(x: Double, j: Int): Double

Cosine orthogonal basis function. Normalised with sqrt(2).

Cosine orthogonal basis function. Normalised with sqrt(2).

Value Params
j

The order of the basis function (assumed >= 1).

x

The argument of the cosine function, nominally between 0 and 1.

Returns

The value of the cosine basis function at x.

def legendre(x: Double, n: Int): Double

Legendre orthogonal polynomial function. Evaluated using Bonnet's recursion.

Legendre orthogonal polynomial function. Evaluated using Bonnet's recursion.

Value Params
n

The degree of the polynomial.

x

The argument of the polynomial, nominally between -1 and 1.

Returns

The value of the nth polynomial at x.

def poly(x: DenseVector[Double], degree: Int, raw: Boolean): DenseMatrix[Double]

Construct a polynomial basis matrix with degree columns using input vector x. Defaults to orthogonal Legendre polynomials, but raw monomials can be requested.

Construct a polynomial basis matrix with degree columns using input vector x. Defaults to orthogonal Legendre polynomials, but raw monomials can be requested.

Value Params
degree

The maximum degree of the polynomial basis.

raw

Raw monomial basis (true) or orthogonal polynomials (false, default).

x

A covariate vector.

Returns

A matrix with rows matching the length of x and degree columns.