construct: Construction of a 'Splinets' object

View source: R/fun_construct.R

constructR Documentation

Construction of a Splinets object

Description

The function constructs a Splinets object correspond to a single spline (size=1) from a vector of knots and a matrix of proposed derivatives. The matrix is tested for its correctness like in is.splinets and adjusted using one of the implemented methods.

Usage

construct(knots, smorder, matder, supp = vector(), mthd = "RRM")

Arguments

knots

n+2 vector, the knots over which the spline is built; There should be at least 2*smorder+4 of knots.

smorder

integer, the order of smoothness;

matder

(n+2)x(smorder+1) matrix, the matrix of derivatives; This matrix will be corrected if does not correspond to a proper spline.

supp

vector, either empty or two integers representing the single interval support;

mthd

string, one of the three methods for correction of the matrix of derivative:

'CRLC'

matching mostly the highest derivative,

'CRFC'

matching mostly the function values at the knots,

'RRM'

balanced matching between all derivatives;

The default method is 'RRM', see the paper on the package for further details about the methods.

Details

The function constructs a Splinet-object only over a single interval support. Combining with the function lincom allows to introduce a multi-component support.

Value

A Splinets-object corresponding to a single spline.

References

Liu, X., Nassar, H., Podgorski, K. "Dyadic diagonalization of positive definite band matrices and efficient B-spline orthogonalization." Journal of Computational and Applied Mathematics (2022) <https://doi.org/10.1016/j.cam.2022.114444>.

Podgorski, K. (2021) "Splinets – splines through the Taylor expansion, their support sets and orthogonal bases." <arXiv:2102.00733>.

Nassar, H., Podgorski, K. (2023) "Splinets 1.5.0 – Periodic Splinets." <arXiv:2302.07552>

See Also

is.splinets for diagnostic of Splinets-objects; gather and subsample for combining and subsampling Splinets-objects, respectively, plot,Splinets-method for a plotting method for Splinets-objects; lincomb for combining splines with more complex than a single interval support sets;

Examples

#-------------------------------------------------------------#
#---Building 'Splinets' using different derviative matching---#
#-------------------------------------------------------------#
n=17; k=4
set.seed(5)
xi=sort(runif(n+2)); xi[1]=0; xi[n+1]=1 

#Random matrix of derivatives -- the noise (wild) case to be corrected
S=matrix(rnorm((n+2)*(k+1)),ncol=(k+1))

spl=construct(xi,k,S) #construction of an object, the order of knots is corrected
is.splinets(spl)[[1]] #validation

spl=construct(xi,k,S,mthd='CRFC') #another method of the derivative matching
is.splinets(spl)[[1]]

spl=construct(xi,k,S,mthd='CRLC') #one more method
is.splinets(spl)[[1]]             

#-----------------------------------------------------#
#---------Building not over the full support----------#
#-----------------------------------------------------#
set.seed(5)
n=20; xi=sort(runif(n+2));xi[1]=0;xi[n+2]=1

spl=construct(xi,k,S) #construction of a spline as the 'Splinets' object over the entire range
is.splinets(spl)[[1]] #verification of the conditions

supp=c(3,17) #definition of the single interval support
SS=matrix(rnorm((supp[2]-supp[1]+1)*(k+1)),ncol=(k+1)) #The matrix of derivatives 
                                                       #over the support range
sspl=construct(xi,k,SS,supp=supp) #construction of a spline as the 'Splinets' object 
                                  #with the given support range
is.splinets(sspl)[[1]] #Verification 
sspl@knots
sspl@supp
sspl@der

Splinets documentation built on March 7, 2023, 8:24 p.m.

Related to construct in Splinets...