Skip to contents

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.

Value

A Splinets-object corresponding to a single spline.

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.

References

Liu, X., Nassar, H., Podg\(\mbox{\'o}\)rski, 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>.

Podg\(\mbox{\'o}\)rski, K. (2021) "Splinets – splines through the Taylor expansion, their support sets and orthogonal bases." <arXiv:2102.00733>.

Nassar, H., Podg\(\mbox{\'o}\)rski, 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
#> 
#> Using  method RRM to correct the derivative matrix entries.
#> NOTE: Knots are not in the strictly increasing order, which is required.
#> 
#>         The knots have been ordered and ties have been removed.
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> The support sets for the splines are equal to the entire range of knots.
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> The boundary zero conditions are not satisfied for spline 1 in the input 'Splinets' object.
#> Correction of the first and last rows of the derivative matrices are made in the output 'Splinets' object.
#> 
#>  The spline 1 'ths highest derivative at the central knot is zero.
#> Now it is set to zero.
#> 
#> The derivative matrix for spline 1 does not satisfy the smoothness conditions (up to the accuracy SLOT 'epsilon').
#> The standard error per matrix entry is 1.449216 .
#> 
#> 
#> Correction of the LHS part of the matrix
#> There are less than 6 knots, the first 1 entries of the 6 nd row counting from the end in the input will be changed in the output.
#> 
#> 
#> Correction of the RHS part of the matrix
#> There are less than 6 knots, the first 1 entries of the 6 nd row counting from the end in the input will be changed in the output.
#> 
#> 
#> Correction of the LHS part of the matrix
#> Correction of the RHS part of the matrix
#> The output object has the derivative matrix corrected by the RRM method.
#> 
#> The matrix derivative is now corrected by method RRM .
is.splinets(spl)[[1]] #validation
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> The support sets for the splines are equal to the entire range of knots.
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> [1] TRUE

spl=construct(xi,k,S,mthd='CRFC') #another method of the derivative matching
#> 
#> Using  method CRFC to correct the derivative matrix entries.
#> NOTE: Knots are not in the strictly increasing order, which is required.
#> 
#>         The knots have been ordered and ties have been removed.
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> The support sets for the splines are equal to the entire range of knots.
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> The boundary zero conditions are not satisfied for spline 1 in the input 'Splinets' object.
#> Correction of the first and last rows of the derivative matrices are made in the output 'Splinets' object.
#> 
#>  The spline 1 'ths highest derivative at the central knot is zero.
#> Now it is set to zero.
#> 
#> The derivative matrix for spline 1 does not satisfy the smoothness conditions (up to the accuracy SLOT 'epsilon').
#> The standard error per matrix entry is 1.449216 .
#> 
#> 
#> Correction of the LHS part of the matrix
#> There are less than 6 knots, the first 1 entries of the 6 nd row counting from the end in the input will be changed in the output.
#> 
#> 
#> Correction of the RHS part of the matrix
#> There are less than 6 knots, the first 1 entries of the 6 nd row counting from the end in the input will be changed in the output.
#> 
#> 
#> Correction of the LHS part of the matrix
#> Correction of the RHS part of the matrix
#> The output object has the derivative matrix corrected by the RRM method.
#> The zero boundary conditions are not satisfied.
#> The correction of the first and last rows of the derivative matrix has been made.
#> 
#> 
#> The highest order derivative at the central knot is not equal to zero.
#> It has been made equal to zero now.
#> 
#> Correction of the LHS part of the matrix
#> Correction of the RHS part of the matrix
#> The matrix derivative is now corrected by method CRFC .
is.splinets(spl)[[1]]
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> The support sets for the splines are equal to the entire range of knots.
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> 
#> The derivative matrix for spline 1 does not satisfy the smoothness conditions (up to the accuracy SLOT 'epsilon').
#> The standard error per matrix entry is 0.0001237886 .
#> 
#> 
#> Correction of the LHS part of the matrix
#> There are less than 6 knots, the first 1 entries of the 6 nd row counting from the end in the input will be changed in the output.
#> 
#> 
#> Correction of the RHS part of the matrix
#> There are less than 6 knots, the first 1 entries of the 6 nd row counting from the end in the input will be changed in the output.
#> 
#> 
#> Correction of the LHS part of the matrix
#> Correction of the RHS part of the matrix
#> The output object has the derivative matrix corrected by the RRM method.
#> [1] FALSE

spl=construct(xi,k,S,mthd='CRLC') #one more method
#> 
#> Using  method CRLC to correct the derivative matrix entries.
#> NOTE: Knots are not in the strictly increasing order, which is required.
#> 
#>         The knots have been ordered and ties have been removed.
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> The support sets for the splines are equal to the entire range of knots.
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> The boundary zero conditions are not satisfied for spline 1 in the input 'Splinets' object.
#> Correction of the first and last rows of the derivative matrices are made in the output 'Splinets' object.
#> 
#>  The spline 1 'ths highest derivative at the central knot is zero.
#> Now it is set to zero.
#> 
#> The derivative matrix for spline 1 does not satisfy the smoothness conditions (up to the accuracy SLOT 'epsilon').
#> The standard error per matrix entry is 1.449216 .
#> 
#> 
#> Correction of the LHS part of the matrix
#> There are less than 6 knots, the first 1 entries of the 6 nd row counting from the end in the input will be changed in the output.
#> 
#> 
#> Correction of the RHS part of the matrix
#> There are less than 6 knots, the first 1 entries of the 6 nd row counting from the end in the input will be changed in the output.
#> 
#> 
#> Correction of the LHS part of the matrix
#> Correction of the RHS part of the matrix
#> The output object has the derivative matrix corrected by the RRM method.
#> The zero boundary conditions are not satisfied.
#> The correction of the first and last rows of the derivative matrix has been made.
#> 
#> 
#> The highest order derivative at the central knot is not equal to zero.
#> It has been made equal to zero now.
#> 
#> Correction of the LHS part of the matrix
#> Correction of the RHS part of the matrix
#> The matrix derivative is now corrected by method CRLC .
is.splinets(spl)[[1]]             
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> The support sets for the splines are equal to the entire range of knots.
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> [1] TRUE

#-----------------------------------------------------#
#---------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
#> 
#> Using  method RRM to correct the derivative matrix entries.
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> The support sets for the splines are equal to the entire range of knots.
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> The full support range case.
#> SLOT 'der' do not have properly set the dimension for spline 1 in the input 'Splinets' object.
#> In the output object, it is set temporarily to the matrix of 'ones' with the proper dimension.
#> 
#> The boundary zero conditions are not satisfied for spline 1 in the input 'Splinets' object.
#> Correction of the first and last rows of the derivative matrices are made in the output 'Splinets' object.
#> 
#> The derivative matrix for spline 1 does not satisfy the smoothness conditions (up to the accuracy SLOT 'epsilon').
#> The standard error per matrix entry is 0.3198203 .
#> 
#> 
#> Correction of the LHS part of the matrix
#> Correction of the RHS part of the matrix
#> Correction of the LHS part of the matrix
#> Correction of the RHS part of the matrix
#> Correction of the LHS part of the matrix
#> Correction of the RHS part of the matrix
#> The output object has the derivative matrix corrected by the RRM method.
#> 
#> The matrix derivative is now corrected by method RRM .
is.splinets(spl)[[1]] #verification of the conditions
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> The support sets for the splines are equal to the entire range of knots.
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> [1] TRUE

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 
#> 
#> Using  method RRM to correct the derivative matrix entries.
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> The boundary zero conditions are not satisfied for spline 1 in the input 'Splinets' object.
#> Correction of the first and last rows of the derivative matrices over the support component 1 of spline 1 in the output 'Splinets' object.
#> 
#> Spline 1 support 1 's highest derivative at the central knot is not zero.
#> Now it is set to zero.
#> 
#> The matrix of derivatives at the knots for spline 1 , support 1  does not satisfy the splie conditions (up to the accuracy set in SLOT 'epsilon').
#> The computed standard error per matrix entry is 1.191293 .
#> 
#> 
#> Correction of the LHS part of the matrix
#> There are less than 6 knots, the first 3 entries of the 6 nd row counting from the end in the input will be changed in the output.
#> 
#> 
#> Correction of the RHS part of the matrix
#> There are less than 6 knots, the first 3 entries of the 6 nd row counting from the end in the input will be changed in the output.
#> 
#> 
#> Correction of the LHS part of the matrix
#> Correction of the RHS part of the matrix
#> The output object Spline 1  support 1 has the derivative matrix corrected by the RRM method.
#> The matrix derivative is now corrected by method RRM .
                                  #with the given support range
is.splinets(sspl)[[1]] #Verification 
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> [1] TRUE
sspl@knots
#>  [1] 0.0000000 0.1104530 0.2002145 0.2018752 0.2625931 0.2732849 0.2843995
#>  [8] 0.3184040 0.3875257 0.4905132 0.5279600 0.5549226 0.5591728 0.6852186
#> [15] 0.7010575 0.7207010 0.8079352 0.8421794 0.8878698 0.8902071 0.9168758
#> [22] 1.0000000
sspl@supp
#> [[1]]
#>      [,1] [,2]
#> [1,]    3   17
#> 
sspl@der
#> [[1]]
#>                [,1]         [,2]         [,3]          [,4]          [,5]
#>  [1,]  0.000000e+00  0.000000000    0.0000000  0.000000e+00 -2.491073e+06
#>  [2,] -7.895895e-07 -0.001901756   -3.4353389 -4.137072e+03  2.036150e+05
#>  [3,] -4.548393e-02 -0.240063921  120.7005838  8.226010e+03 -2.189334e+06
#>  [4,] -4.066812e-02  1.074642126   83.5148611 -1.518194e+04  1.366034e+06
#>  [5,] -2.617116e-02  1.377733343   -0.8502306  8.601130e-01 -1.553485e-01
#>  [6,]  2.019212e-02  1.349317883   -0.8210727  8.548304e-01 -5.366470e+00
#>  [7,]  1.115398e-01  1.294310650   -0.7748053  4.838908e-01  1.210901e-01
#>  [8,]  2.408173e-01  1.217103639   -0.7243285  4.963615e-01  0.000000e+00
#>  [9,]  2.858903e-01  1.190322956   -0.7061360  4.752833e-01 -5.628851e-01
#> [10,]  3.177287e-01  1.171357525   -0.7043309 -3.413863e-01 -3.028901e+01
#> [11,]  3.227009e-01  1.168360821   -0.7057976 -3.487915e-01 -1.742302e+00
#> [12,]  2.848758e-01 -4.615556858 -136.2287432 -2.150028e+03 -1.705475e+04
#> [13,]  1.966757e-01 -6.180076409   -6.8472951  1.848724e+04  1.302951e+06
#> [14,]  9.043977e-02 -4.146985387  142.6155317 -3.269715e+03 -1.107590e+06
#> [15,]  0.000000e+00  0.000000000    0.0000000  0.000000e+00  3.748202e+04
#>