Skip to contents

The method performs verification of the properties of SLOTS of an object belonging to the Splinets–class. In the case when all the properties are satisfied the logical TRUE is returned. Otherwise, FALSE is returned together with suggested corrections.

Usage

is.splinets(object)

Arguments

object

Splinets object, the object to be diagnosed; For this object to be corrected properly each support interval has to have at least 2*smorder+4 knots.

Value

A list made of: a logical value is, a Splinets object robject, and a numeric value Er.

  • The logical value is indicates if all the condtions for the elements of Splinets object to be a collection of valid splines are satisfied, additional diagnostic messages are printed out.

  • The object robject is a modified input object that has all SLOT fields modified so the conditions/restrictions to be a proper spline are satisfied.

  • The numeric value Er is giving the total squared error of deviation of the input matrix of derivative from the conditions required for a spline.

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

Splinets-class for the definition of the Splinets-class; construct for constructing such an object from the class; gather and subsample for combining and subsampling Splinets-objects, respectively; plot,Splinets-method for plotting Splinets objects;

Examples

#-----------------------------------------------------#
#--------Diagnostics of simple Splinets objects-------#
#-----------------------------------------------------#
#----------Full support equidistant cases-------------#
#-----------------------------------------------------#
#Zero order splines, equidistant case, full support
n=20; xi=seq(0,1,by=1/(n+1))
sp=new("Splinets",knots=xi) 
sp@equid #equidistance flag
#> [1] TRUE
#Diagnostic of 'Splinets' object 'sp'
is.splinets(sp)
#> 
#> 
#> 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.
#> 
#> $is
#> [1] FALSE
#> 
#> $robject
#> splines
#> Knots: 22 equaly distributed knots between 0 and 1 
#> Size: 1 spline functions
#> Order: 0 
#> Support: The full support range for each spline.
#> $Er
#> [1] 0
#> 

IS=is.splinets(sp)
#> 
#> 
#> 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.
#> 
IS[[1]] #informs if the object is a spline
#> [1] FALSE
IS$is   #equivalent to the above
#> [1] FALSE

#Third order splines with a noisy matrix of the derivative
set.seed(5)
k=3; sp@smorder=k; sp@der[[1]]=matrix(rnorm((n+2)*(k+1)),ncol=(k+1))

IS=is.splinets(sp)
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> The Taylor expansion coefficient matrix does not have the proper number of columns.
#> It is evaluated now and assigned to the output.
#> 
#> 
#> 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.
#> 
#> Spline 1 's highest derivative is not symmetrically defined at the center (the values at the two central knots should be equal).
#> Spline 1 's highest derivative values at the two central knots have been made equal by averaging the two central values in SLOT 'der'.
#> 
#> The matrix of derivatives at the knots for spline 1 does not satisfy the conditions 
#> 
#>           required for a spline (up to the accuracy SLOT 'epsilon').
#> 
#>           One of the reasons can be that SLOT 'taylor' is not correctly given.
#> The computed standard error per matrix entry is 1.303131 .
#> 
#> 
#> 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 Spline 1  has the derivative matrix corrected by the RRM method
#>  given that SLOT 'taylor' is properly given.
IS[[2]]@taylor #corrections
#>      [,1]       [,2]        [,3]         [,4]
#> [1,]    1 0.04761905 0.001133787 1.799662e-05
sp@taylor
#>      [,1]
#> [1,]    1
IS[[2]]@der #corrections
#> [[1]]
#>              [,1]        [,2]          [,3]          [,4]
#>  [1,]  0.00000000   0.0000000    0.00000000 -7.024458e+03
#>  [2,] -0.12641647  -7.9642378 -334.49798786  1.469705e+04
#>  [3,] -0.62041814  -7.2293915  365.36153367 -7.687523e+03
#>  [4,] -0.68878219   1.4527638   -0.71101105 -2.796661e-01
#>  [5,] -0.62041412   1.4185891   -0.72432849 -9.844306e+02
#>  [6,] -0.57139992   0.2679628  -47.60197450  1.003237e+03
#>  [7,] -0.59455541  -0.8613413    0.17120093  3.470285e-01
#>  [8,] -0.63537131  -0.8527954    0.18772610  7.557291e+03
#>  [9,] -0.53976211   7.7245010  360.05872310 -1.397604e+04
#> [10,] -0.01522038   9.0243000 -305.46716206  6.403647e+03
#> [11,]  0.18341751   1.7386151   -0.53160753  5.472878e-01
#> [12,]  0.26561582   1.7139209   -0.50554621  5.472878e-01
#> [13,]  0.10491122 -13.5401950 -640.16732427 -1.343290e+04
#> [14,] -0.80330481 -14.8951404  583.25961806  2.569197e+04
#> [15,] -1.07176004  -1.0095326   -0.06409093 -1.224980e+04
#> [16,] -1.11993704  -1.0145600   -0.14705771 -1.742302e+00
#> [17,] -1.16157407  -0.5905113   17.95710289  3.801874e+02
#> [18,] -1.17579757  -0.1426081    0.85483042 -3.591477e+02
#> [19,] -1.18160708  -0.1011358    0.88700587  6.756845e-01
#> [20,] -0.98749213  12.4103942  524.59725595  1.099792e+04
#> [21,] -0.19762544  12.4504025 -522.91690639 -2.199780e+04
#> [22,]  0.00000000   0.0000000    0.00000000  1.098126e+04
#> 
sp@der
#> [[1]]
#>              [,1]        [,2]        [,3]        [,4]
#>  [1,] -0.84085548  1.46796190 -0.45656894 -2.10232912
#>  [2,]  1.38435934  0.70676109  0.56222336 -0.30170228
#>  [3,] -1.25549186  0.81900893 -0.88700851 -1.27238344
#>  [4,]  0.07014277 -0.29348185 -0.46024458 -0.27966611
#>  [5,]  1.71144087  1.41858907 -0.72432849 -0.20409732
#>  [6,] -0.60290798  1.49877383 -0.06921116 -0.22561419
#>  [7,] -0.47216639 -0.65708209  1.46324856  0.34702845
#>  [8,] -0.63537131 -0.85279544  0.18772610  0.03236784
#>  [9,] -0.28577363  0.31591504  1.02202286  0.41353129
#> [10,]  0.13810822  1.10969417 -0.59183483 -0.15534848
#> [11,]  1.22763034  2.21546057 -0.11220066  0.97348539
#> [12,] -0.80177945  1.21710364 -0.92495309  0.12109014
#> [13,] -1.08039260  1.47922179  0.75330480  0.18917369
#> [14,] -0.15753436  0.95157383 -0.11260907 -0.56288507
#> [15,] -1.07176004 -1.00953265 -0.06409093  0.49841617
#> [16,] -0.13898614 -2.00047274  0.23327529 -1.74230249
#> [17,] -0.59731309 -1.76218587 -1.13658280  0.97552910
#> [18,] -2.18396676 -0.14260813  0.85483042 -0.02408287
#> [19,]  0.24081726  1.55006037 -0.57837042  0.67568448
#> [20,] -0.25935541 -0.80242318  0.49636154 -0.71030961
#> [21,]  0.90051195 -0.07457892 -0.76005793  2.38723265
#> [22,]  0.94186939  1.89566795 -0.34138627 -0.47343201
#> 

is.splinets(IS[[2]]) #The output object is a valid splinet
#> 
#> 
#> 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:  
#> 
#> $is
#> [1] TRUE
#> 
#> $robject
#> splines
#> Knots: 22 equaly distributed knots between 0 and 1 
#> Size: 1 spline functions
#> Order: 3 
#> Support: The full support range for each spline.
#> $Er
#> [1] 2.237243e-23
#> 

#-----------------------------------------------------#
#--------Full support non-equidistant cases-----------#
#-----------------------------------------------------#
#Zero order splines, non-equidistant case, full support
set.seed(5)
n=17; xi=sort(runif(n+2))
xi[1]=0 ;xi[n+1]=1 #The last knot is not in the order.
          #It will be reported and corrected in the output.  
sp=new("Splinets",knots=xi) 
#> NOTE: Knots are not in the strictly increasing order, which is required.
#> 
#>         The knots have been ordered and ties have been removed.

xi #original 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.8079352 0.8878698 1.0000000 0.9565001
sp@knots #vs. corrected ones
#>  [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.8079352 0.8878698 0.9565001 1.0000000
sp@taylor
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
#> [11,]    1
#> [12,]    1
#> [13,]    1
#> [14,]    1
#> [15,]    1
#> [16,]    1
#> [17,]    1
#> [18,]    1

#Diagnostic of 'Splinets' object 'sp'
is.splinets(sp)
#> 
#> 
#> 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.
#> 
#> $is
#> [1] FALSE
#> 
#> $robject
#> splines
#> Knots: 19 non-equaly distributed knots between 0 and 1 
#> Size: 1 spline functions
#> Order: 0 
#> Support: The full support range for each spline.
#> $Er
#> [1] 0
#> 

IS=is.splinets(sp)
#> 
#> 
#> 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.
#> 
 
nsp=IS$robject #the output spline -- a corrected version of the input
nsp@der
#> [[1]]
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
#> [11,]    1
#> [12,]    1
#> [13,]    1
#> [14,]    1
#> [15,]    1
#> [16,]    1
#> [17,]    1
#> [18,]    1
#> [19,]    1
#> 
sp@der
#> [[1]]
#>      [,1]
#> [1,]    1
#> [2,]    1
#> 

#Third order splines
nsp@smorder=3
IS=is.splinets(nsp)
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> The Taylor expansion coefficient matrix does not have the proper number of columns.
#> It is evaluated now and assigned to the output.
#> 
#> 
#> 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 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 0.3450153 .
#> 
#> 
#> 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.

IS[[2]]@taylor #corrections
#>       [,1]        [,2]         [,3]         [,4]
#>  [1,]    1 0.110453019 6.099935e-03 2.245854e-04
#>  [2,]    1 0.089761434 4.028558e-03 1.205364e-04
#>  [3,]    1 0.001660759 1.379060e-06 7.634284e-10
#>  [4,]    1 0.060717928 1.843333e-03 3.730779e-05
#>  [5,]    1 0.010691811 5.715741e-05 2.037054e-07
#>  [6,]    1 0.011114508 6.176614e-05 2.288334e-07
#>  [7,]    1 0.034004561 5.781551e-04 6.553303e-06
#>  [8,]    1 0.069121728 2.388907e-03 5.504179e-05
#>  [9,]    1 0.102987455 5.303208e-03 1.820546e-04
#> [10,]    1 0.037446782 7.011308e-04 8.751697e-06
#> [11,]    1 0.026962570 3.634901e-04 3.266876e-06
#> [12,]    1 0.004250273 9.032409e-06 1.279673e-08
#> [13,]    1 0.126045769 7.943768e-03 3.337594e-04
#> [14,]    1 0.015838864 1.254348e-04 6.622482e-07
#> [15,]    1 0.106877742 5.711426e-03 2.034748e-04
#> [16,]    1 0.079934571 3.194768e-03 8.512413e-05
#> [17,]    1 0.068630354 2.355063e-03 5.387626e-05
#> [18,]    1 0.043499875 9.461196e-04 1.371869e-05
nsp@taylor
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
#> [11,]    1
#> [12,]    1
#> [13,]    1
#> [14,]    1
#> [15,]    1
#> [16,]    1
#> [17,]    1
#> [18,]    1
IS[[2]]@der #corrections
#> [[1]]
#>            [,1]       [,2]         [,3]        [,4]
#>  [1,] 0.0000000  0.0000000    0.0000000   1212.5612
#>  [2,] 0.2723235  7.3965443  133.9310482  -4532.9778
#>  [3,] 0.9294082  1.1570255 -272.9555385 164915.0719
#>  [4,] 0.9310792  0.9311399    0.9285903      1.0000
#>  [5,] 0.9893651  0.9893653    0.9893082      1.0000
#>  [6,] 1.0000000  1.0000000    1.0000000 -21636.2875
#>  [7,] 1.0062252 -0.3252755 -239.4766832  10047.1028
#>  [8,] 0.9225514 -2.6597914  102.1706392  -1465.1489
#>  [9,] 0.9021337  0.9023158    0.8970125      1.0000
#> [10,] 1.0000000  1.0000000    1.0000000      0.0000
#> [11,] 1.0381567  1.0381479    1.0374468      1.0000
#> [12,] 1.0373264 -2.1826600 -239.9470100  -8937.7407
#> [13,] 1.0267724 -2.5741835   55.7124704  69562.4740
#> [14,] 1.0000000  1.0000000    1.0000000   -434.0683
#> [15,] 1.0159650  1.0159643    1.0158389      1.0000
#> [16,] 1.1305543  1.1302463    1.1227166      1.0000
#> [17,] 0.9335090 -9.7006120 -272.1158102  -3418.2773
#> [18,] 0.1070929 -7.3857362  339.5750532   8912.8328
#> [19,] 0.0000000  0.0000000    0.0000000  -7806.3455
#> 
nsp@der
#> [[1]]
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
#> [11,]    1
#> [12,]    1
#> [13,]    1
#> [14,]    1
#> [15,]    1
#> [16,]    1
#> [17,]    1
#> [18,]    1
#> [19,]    1
#> 
is.splinets(IS[[2]]) #verification that the correction is a valid object
#> 
#> 
#> 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:  
#> 
#> $is
#> [1] TRUE
#> 
#> $robject
#> splines
#> Knots: 19 non-equaly distributed knots between 0 and 1 
#> Size: 1 spline functions
#> Order: 3 
#> Support: The full support range for each spline.
#> $Er
#> [1] 5.382228e-23
#> 

#Randomly assigning the derivative -- a very 'unstable' function.
set.seed(5)
k=nsp@smorder; S=matrix(rnorm((n+2)*(k+1)),ncol=(k+1)); nsp@der[[1]]=S

IS=is.splinets(nsp) #the 2nd element of 'IS' is a spline obtained by correcting 'S'
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> The Taylor expansion coefficient matrix does not have the proper number of columns.
#> It is evaluated now and assigned to the output.
#> 
#> 
#> 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.286421 .
#> 
#> 
#> 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.
nsp=is.splinets(IS[[2]])
#> 
#> 
#> 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:  
#> 
nsp$is #The 'Splinets' object is correct, alternatively use 'nsp$[[1]]'.
#> [1] TRUE
nsp$robject #A correct spline object, alternatively use 'nsp$[[2]]'.
#> splines
#> Knots: 19 non-equaly distributed knots between 0 and 1 
#> Size: 1 spline functions
#> Order: 3 
#> Support: The full support range for each spline.

#-----------------------------------------------------#
#-----Splinets objects with varying support sets------#
#-----------------------------------------------------#
#-----------------Eequidistant cases------------------#
#-----------------------------------------------------#
#Zero order splines, equidistant case, support with three components
n=20; xi=seq(0,1,by=1/(n+1))
support=list(matrix(c(2,5,6,8,12,18),ncol=2,byrow = TRUE)) 
sp=new("Splinets",knots=xi,supp=support) 
is.splinets(sp)
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> The partial 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.
#> 
#> $is
#> [1] FALSE
#> 
#> $robject
#> splines
#> Knots: 22 equaly distributed knots between 0 and 1 
#> Size: 1 spline functions
#> Order: 0 
#> Support: Not the full range support, the number of support intervals varies from 3 to 3
#> $Er
#> [1] 0
#> 

IS=is.splinets(sp)
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> The partial 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.
#> 

sum(sp@supp[[1]][,2]-sp@supp[[1]][,1]+1) #the number of knots in the support
#> [1] 14
dim(IS[[2]]@der[[1]])[1]  #the number of rows in the derivative matrix
#> [1] 14
IS[[2]]@der[[1]] #the corrected object
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
#> [11,]    1
#> [12,]    1
#> [13,]    1
#> [14,]    1
sp@der #the input derivative matrix
#> [[1]]
#>      [,1]
#> [1,]    1
#> [2,]    1
#> 

#Third order splines
n=40; xi=seq(0,1,by=1/(n+1)); k=3; 
support=list(matrix(c(2,12,15,27,30,40),ncol=2,byrow = TRUE))
m=sum(support[[1]][,2]-support[[1]][,1]+1) #the number of knots in the support
SS=list(matrix(rnorm(m*(k+1)),ncol=(k+1))) #the derivative matrix at random

sp=new("Splinets",knots=xi,smorder=k,supp=support,der=SS) 

IS=is.splinets(sp)
#> 
#> 
#> 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.
#> 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 2 of spline 1 in the output 'Splinets' object.
#> 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 3 of spline 1 in the output 'Splinets' object.
#> 
#> Spline 1 support 1 's highest derivative at the central knot is not equal to zero.
#> Spline 1 support 1 's highest derivative value at the central knot has been made equal to zero.
#> 
#> The matrix of derivatives at the knots for spline 1 , support 1  does not satisfy the conditions that are required for a spline (up to the accuracy SLOT 'epsilon').
#> The computed standard error per matrix entry is 1.55822 .
#> 
#> 
#> 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 Spline 1  support 1 has the derivative matrix corrected by the RRM method.
#> Spline 1 support 2 's highest derivative at the central knot is not equal to zero.
#> Spline 1 support 2 's highest derivative value at the central knot has been made equal to zero.
#> 
#> The matrix of derivatives at the knots for spline 1 , support 2  does not satisfy the conditions that are required for a spline (up to the accuracy SLOT 'epsilon').
#> The computed standard error per matrix entry is 1.697993 .
#> 
#> 
#> 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 Spline 1  support 2 has the derivative matrix corrected by the RRM method.
#> Spline 1 support 3 's highest derivative at the central knot is not equal to zero.
#> Spline 1 support 3 's highest derivative value at the central knot has been made equal to zero.
#> 
#> The matrix of derivatives at the knots for spline 1 , support 3  does not satisfy the conditions that are required for a spline (up to the accuracy SLOT 'epsilon').
#> The computed standard error per matrix entry is 1.360743 .
#> 
#> 
#> 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 Spline 1  support 3 has the derivative matrix corrected by the RRM method.

m=sum(sp@supp[[1]][,2]-sp@supp[[1]][,1]+1) #the number of knots in the support
sp@der=list(matrix(rnorm(m*(k+1)),ncol=(k+1))) #the derivative matrix at random

IS=is.splinets(sp) #Comparison of the corrected and the original 'der' matrices
#> 
#> 
#> 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.
#> 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 2 of spline 1 in the output 'Splinets' object.
#> 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 3 of spline 1 in the output 'Splinets' object.
#> 
#> Spline 1 support 1 's highest derivative at the central knot is not equal to zero.
#> Spline 1 support 1 's highest derivative value at the central knot has been made equal to zero.
#> 
#> The matrix of derivatives at the knots for spline 1 , support 1  does not satisfy the conditions that are required for a spline (up to the accuracy SLOT 'epsilon').
#> The computed standard error per matrix entry is 1.221246 .
#> 
#> 
#> 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 Spline 1  support 1 has the derivative matrix corrected by the RRM method.
#> Spline 1 support 2 's highest derivative at the central knot is not equal to zero.
#> Spline 1 support 2 's highest derivative value at the central knot has been made equal to zero.
#> 
#> The matrix of derivatives at the knots for spline 1 , support 2  does not satisfy the conditions that are required for a spline (up to the accuracy SLOT 'epsilon').
#> The computed standard error per matrix entry is 1.457675 .
#> 
#> 
#> 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 Spline 1  support 2 has the derivative matrix corrected by the RRM method.
#> Spline 1 support 3 's highest derivative at the central knot is not equal to zero.
#> Spline 1 support 3 's highest derivative value at the central knot has been made equal to zero.
#> 
#> The matrix of derivatives at the knots for spline 1 , support 3  does not satisfy the conditions that are required for a spline (up to the accuracy SLOT 'epsilon').
#> The computed standard error per matrix entry is 1.275708 .
#> 
#> 
#> 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 Spline 1  support 3 has the derivative matrix corrected by the RRM method.
sp@der
#> [[1]]
#>              [,1]         [,2]        [,3]         [,4]
#>  [1,] -0.14264393 -0.266899439  1.39995727  1.374653325
#>  [2,]  1.41878305  0.164155956  0.01701396  0.291895737
#>  [3,]  0.48713390 -0.393458947  1.84749695  0.710591710
#>  [4,]  0.60344145 -1.843737246 -0.68633938 -0.937760920
#>  [5,]  0.21083288 -1.542288267 -0.21872403 -1.114063127
#>  [6,] -0.03329921 -0.586240360  0.68259291  0.634371955
#>  [7,]  2.02519699 -0.852138909  0.52413002 -0.231192902
#>  [8,] -0.37078675  0.778324555  0.08054998 -1.368194204
#>  [9,] -1.57823445 -0.030317074  0.05378554 -0.754907446
#> [10,] -0.12157195 -1.455657582 -0.73725899 -1.125596649
#> [11,] -1.79667682  0.093784923  0.96643806 -0.219359247
#> [12,] -0.47559154  0.982349222  0.98430685 -0.134307952
#> [13,] -0.88410232 -0.596710162  0.18729094 -0.818020611
#> [14,] -3.49805898  0.074804851  0.27298575  0.472334157
#> [15,] -0.38198337  2.197429431  1.21014609 -0.869256130
#> [16,]  0.97768813  0.795023212  0.18865716 -1.332288341
#> [17,] -0.55804095 -0.538942212  1.96249867  0.070562870
#> [18,] -0.62645515 -1.601283178  0.13871194  0.464093186
#> [19,] -0.53045123 -0.731373566 -1.57862735  0.289158499
#> [20,]  1.89762159 -0.355740791 -0.79702127 -2.884941083
#> [21,]  1.39554068 -0.985414318  1.22435388 -2.334691775
#> [22,] -0.74602587 -0.731170643 -0.36533356 -1.730891047
#> [23,] -0.30557308  1.465324083 -0.16259028  0.825009586
#> [24,]  1.16967817  1.858615318  0.56047918 -1.045039551
#> [25,]  0.30438718  0.003497027 -0.86072563 -0.877193374
#> [26,] -0.11749825 -1.343775245  1.23863449 -0.400389842
#> [27,] -0.06008553  0.151294033  0.76743575 -1.268188972
#> [28,]  1.47093895  0.290009125 -1.08740911  0.138586391
#> [29,] -1.47814761 -0.122478328  0.06750377  1.183571604
#> [30,] -0.68361295  0.125154388  1.60514057 -2.110555073
#> [31,]  0.46054060 -0.772434114  1.23222943  0.260676110
#> [32,] -0.18150193 -1.012966123 -0.37911379  0.945566826
#> [33,] -1.15881631  0.966919601 -1.34986658 -0.619960620
#> [34,]  0.40901892 -0.423327300  0.36491810 -0.009100739
#> [35,] -0.25820706 -0.831599455 -0.36359492  0.520225423
#> 
IS[[2]]@der
#> [[1]]
#>               [,1]         [,2]          [,3]          [,4]
#>  [1,]  0.000000000   0.00000000     0.0000000  7.869495e+02
#>  [2,]  0.001903023   0.23407184    19.1938908 -2.632501e+03
#>  [3,]  0.006955176  -0.08080077   -45.0134446  1.875589e+03
#>  [4,] -0.003868862  -0.62081061     0.7326374 -9.377609e-01
#>  [5,] -0.018794935  -0.60322034     0.7097652 -1.114063e+00
#>  [6,] -0.033299206  -0.58624036     0.6825929  0.000000e+00
#>  [7,] -0.047395278  -0.56966052     0.6769541 -2.311929e-01
#>  [8,] -0.061091392  -0.55355640     0.6435835 -1.368194e+00
#>  [9,] -0.059835966   1.25368162   147.5499346  6.023160e+03
#> [10,] -0.012410858   1.52653553  -125.1759138 -1.118176e+04
#> [11,]  0.000000000   0.00000000     0.0000000  5.132212e+03
#> [12,]  0.000000000   0.00000000     0.0000000 -3.235754e+04
#> [13,] -0.078247889  -9.62449036  -789.2082095  6.199852e+04
#> [14,] -0.397808697 -10.43250832   722.9507366 -2.963238e+04
#> [15,] -0.508882038  -1.61347667     0.2098585 -8.692561e-01
#> [16,] -0.548174809  -1.60861673     0.1886572 -2.118317e+00
#> [17,] -0.587358371  -1.60464541     0.1369909  7.056287e-02
#> [18,] -0.626455147  -1.60128318     0.1387119  0.000000e+00
#> [19,] -0.665468876  -1.59781395     0.1457646  2.891585e-01
#> [20,] -0.704490066  -1.60575611    -0.7970213 -3.865422e+01
#> [21,] -0.743897563  -1.62589009    -0.8539650 -2.334692e+00
#> [22,] -0.646450652  15.24816433  1384.5264272  5.680060e+04
#> [23,] -0.130620459  16.06631648 -1317.4379512 -1.107805e+05
#> [24,]  0.000000000   0.00000000     0.0000000  5.401496e+04
#> [25,]  0.000000000   0.00000000     0.0000000 -4.746495e+04
#> [26,] -0.114781056 -14.11806983 -1157.6817258  9.497826e+04
#> [27,] -0.573788324 -14.10368454  1158.8613197 -4.744883e+04
#> [28,] -0.687828663   0.04795220     1.5728928  1.385864e-01
#> [29,] -0.686190918   0.08635666     1.5762730  1.183572e+00
#> [30,] -0.683612946   0.12515439     1.6051406  0.000000e+00
#> [31,] -0.680082333   0.16438169     1.6114985  2.606761e-01
#> [32,] -0.675591410   0.20396779     1.6345611  9.455668e-01
#> [33,] -0.559487219  13.85294618  1117.5816671  4.575383e+04
#> [34,] -0.111715410  13.74099545 -1126.7616269 -9.201808e+04
#> [35,]  0.000000000   0.00000000     0.0000000  4.619723e+04
#> 
is.splinets(IS[[2]]) #verification
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> $is
#> [1] TRUE
#> 
#> $robject
#> splines
#> Knots: 42 equaly distributed knots between 0 and 1 
#> Size: 1 spline functions
#> Order: 3 
#> Support: Not the full range support, the number of support intervals varies from 3 to 3
#> $Er
#> [1] 5.729312e-22
#> 

#-----------------------------------------------------#
#----------------Non-equidistant cases----------------#
#-----------------------------------------------------#
#Zero order splines, non-equidistant case, support with three components
set.seed(5)
n=43; xi=seq(0,1,by=1/(n+1)); k=3; xi=sort(runif(n+2)); xi[1]=0; xi[n+2]=1;
support=list(matrix(c(2,14,17,30,32,43),ncol=2,byrow = TRUE))

ssp=new("Splinets",knots=xi,supp=support) #with partial support
nssp=is.splinets(ssp)$robject
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> The partial 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.
#> 
nssp@supp
#> [[1]]
#>      [,1] [,2]
#> [1,]    2   14
#> [2,]   17   30
#> [3,]   32   43
#> 
nssp@der
#> [[1]]
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
#> [11,]    1
#> [12,]    1
#> [13,]    1
#> [14,]    1
#> [15,]    1
#> [16,]    1
#> [17,]    1
#> [18,]    1
#> [19,]    1
#> [20,]    1
#> [21,]    1
#> [22,]    1
#> [23,]    1
#> [24,]    1
#> [25,]    1
#> [26,]    1
#> [27,]    1
#> [28,]    1
#> [29,]    1
#> [30,]    1
#> [31,]    1
#> [32,]    1
#> [33,]    1
#> [34,]    1
#> [35,]    1
#> [36,]    1
#> [37,]    1
#> [38,]    1
#> [39,]    1
#> 

#Third order splines
nssp@smorder=3 #changing the order of the 'Splinets' object
set.seed(5)
m=sum(nssp@supp[[1]][,2]-nssp@supp[[1]][,1]+1) #the number of knots in the support
nssp@der=list(matrix(rnorm(m*(k+1)),ncol=(k+1)))  #the derivative matrix at random
IS=is.splinets(nssp) 
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> The Taylor expansion coefficient matrix does not have the proper number of columns.
#> It is evaluated now and assigned to the output.
#> 
#> 
#> 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.
#> 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 2 of spline 1 in the output 'Splinets' object.
#> 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 3 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.627611 .
#> 
#> 
#> Correction of the LHS part of the matrix
#> There are less than 5 knots, the first 2 entries of the 5 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 5 knots, the first 2 entries of the 5 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.
#> Spline 1 , support 2  - highest derivative is not symmetric at the center (equal values at the two central knots).
#> The two values have been made equal by averaging.
#> 
#> The matrix of derivatives at the knots for spline 1 , support 2  does not satisfy the splie conditions (up to the accuracy set in SLOT 'epsilon').
#> The computed standard error per matrix entry is 1.150335 .
#> 
#> 
#> Correction of the LHS part of the matrix
#> There are less than 5 knots, the first 1 entries of the 5 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 5 knots, the first 1 entries of the 5 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 2 has the derivative matrix corrected by the RRM method.
#> Spline 1 , support 3  - highest derivative is not symmetric at the center (equal values at the two central knots).
#> The two values have been made equal by averaging.
#> 
#> The matrix of derivatives at the knots for spline 1 , support 3  does not satisfy the splie conditions (up to the accuracy set in SLOT 'epsilon').
#> The computed standard error per matrix entry is 1.441687 .
#> 
#> 
#> Correction of the LHS part of the matrix
#> There are less than 5 knots, the first 2 entries of the 5 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 5 knots, the first 2 entries of the 5 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 3 has the derivative matrix corrected by the RRM method.
IS$robject@der
#> [[1]]
#>              [,1]         [,2]          [,3]          [,4]
#>  [1,]  0.00000000   0.00000000     0.0000000 -1.929628e+04
#>  [2,] -0.07223144  -7.68032463  -544.4294521  2.973828e+04
#>  [3,] -0.51799311  -1.84007207   802.3475387 -1.381047e+05
#>  [4,] -0.51965960   0.49062561     0.9409529  1.170856e+00
#>  [5,] -0.50475579   0.51892312     0.9755291 -1.155369e+02
#>  [6,] -0.50375248   0.52059087     0.7525181 -1.317889e+00
#>  [7,] -0.47216639   0.56222336     0.6756845  0.000000e+00
#>  [8,] -0.47123174   0.56334697     0.6774436  1.059250e+00
#>  [9,] -0.46584375   0.57785065     2.3872326  1.806421e+02
#> [10,] -0.45728946   0.61213059     2.3814814 -4.000335e-01
#> [11,] -0.42897644   7.72288244  1497.5455686  1.576934e+05
#> [12,] -0.02824895   7.92633217 -1482.6921789 -1.087901e+05
#> [13,]  0.00000000   0.00000000     0.0000000  1.386755e+05
#> [14,]  0.00000000   0.00000000     0.0000000  3.805467e+03
#> [15,]  0.20945973   9.09090662   263.0404888 -2.309831e+05
#> [16,]  0.27442205   1.53955269 -1886.1760195  2.219179e+06
#> [17,]  0.27527652   0.73798142     0.3877417 -1.040391e-01
#> [18,]  0.30490246   0.75330480     0.3836081 -4.316087e+03
#> [19,]  0.31014395   0.64052034   -31.2045231  8.766823e+02
#> [20,]  0.31972965   0.08524925    -0.3599475 -3.928057e-01
#> [21,]  0.32033865   0.08262743    -0.3627974 -3.928057e-01
#> [22,]  0.32068766   0.14844113    39.7230232  1.198677e+04
#> [23,]  0.34434732   0.85483042    -1.9953870 -1.114072e+03
#> [24,]  0.34903214   0.84381186    -1.9997776 -7.959950e-01
#> [25,]  0.25682571 -14.56421432 -1434.8722730 -6.681110e+04
#> [26,]  0.18892004 -15.75261450   875.6610039  5.436200e+05
#> [27,]  0.00000000   0.00000000     0.0000000 -2.433825e+04
#> [28,]  0.00000000   0.00000000     0.0000000  1.490336e+05
#> [29,]  0.09869725  18.69400222  2360.5231706 -1.600882e+05
#> [30,]  0.71909846  34.17654465  -784.1713346  9.003958e+03
#> [31,]  1.71295715   0.02917131     1.2820225 -2.298096e-01
#> [32,]  1.71323710   0.03960047     1.2801516 -8.778185e+01
#> [33,]  1.71372073   0.04830473     0.3326189  2.767448e-01
#> [34,]  1.71449938   0.05342927     0.3368556  2.767448e-01
#> [35,]  1.71807967   0.12052555     2.6001420  4.953529e+01
#> [36,]  1.71836848   0.12660156     2.5989327 -5.173768e-01
#> [37,]  1.23335970 -54.84726795 -4125.3309911 -1.547858e+05
#> [38,]  0.47286188 -54.48517894  4185.3443903  6.887145e+05
#> [39,]  0.00000000   0.00000000     0.0000000 -1.607511e+05
#> 
is.splinets(IS$robject)$is #verification of the corrected output object
#> 
#> 
#> DIAGNOSTIC CHECK of a SPLINETS object
#> 
#> THE KNOTS:  
#> 
#> 
#> THE SUPPORT SETS:  
#> 
#> 
#> 
#> THE DERIVATIVES AT THE KNOTS:  
#> 
#> [1] TRUE