The function returns the Splinets
-object that gathers two input Splinets
-objects together.
The input objects have to be of the same order and over the same knots.
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 the Splinets
-objects;
construct
for constructing such an object;
subsample
for subsampling Splinets
-objects;
plot,Splinets-method
for plotting Splinets
-objects;
Examples
#-------------------------------------------------------------#
#-----------------Grouping into a 'Splinets' object-----------#
#-------------------------------------------------------------#
#Gathering three 'Splinets' objects using three different
#method to correct the derivative matrix
set.seed(5)
n=13;xi=sort(runif(n+2)); xi[1]=0; xi[n+2]=1; k=4
S=matrix(rnorm((n+2)*(k+1)),ncol=(k+1))
spl=construct(xi,k,S) #constructing the first correct spline
#>
#> 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 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.421221 .
#>
#>
#> 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 has the derivative matrix corrected by the RRM method.
#>
#> The matrix derivative is now corrected by method RRM .
spl=gather(spl,construct(xi,k,S,mthd='CRFC')) #the second and the first ones
#>
#> Using method CRFC 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 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.421221 .
#>
#>
#> 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 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 .
spl=gather(spl,construct(xi,k,S,mthd='CRLC')) #the third is added
#>
#> Using method CRLC 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 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.421221 .
#>
#>
#> 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 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
#>
#>
#> 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 2 does not satisfy the smoothness conditions (up to the accuracy SLOT 'epsilon').
#> The standard error per matrix entry is 2.100912e-07 .
#>
#>
#> 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 has the derivative matrix corrected by the RRM method.
#> [1] FALSE
spl@supp #the entire range for the support
#> list()
#Example with different support ranges, the 3rd order
set.seed(5)
n=25; xi=sort(runif(n+2)); xi[1]=0; xi[n+2]=1; k=3
supp=list(t(c(2,12)),t(c(4,20)),t(c(6,25))) #support ranges for three splines
#Initial random matrices of the derivative for each spline
SS1=matrix(rnorm((supp[[1]][1,2]-supp[[1]][1,1]+1)*(k+1)),ncol=(k+1))
SS2=matrix(rnorm((supp[[2]][1,2]-supp[[2]][1,1]+1)*(k+1)),ncol=(k+1))
SS3=matrix(rnorm((supp[[3]][1,2]-supp[[3]][1,1]+1)*(k+1)),ncol=(k+1))
spl=construct(xi,k,SS1,supp[[1]]) #constructing the first correct spline
#>
#> 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.502577 .
#>
#>
#> 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.
#> The matrix derivative is now corrected by method RRM .
nspl=construct(xi,k,SS2,supp[[2]])
#>
#> 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.705421 .
#>
#>
#> 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.
#> The matrix derivative is now corrected by method RRM .
spl=gather(spl,nspl) #the second and the first ones
nspl=construct(xi,k,SS3,supp[[3]])
#>
#> 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 - 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 1 does not satisfy the splie conditions (up to the accuracy set in SLOT 'epsilon').
#> The computed standard error per matrix entry is 1.573415 .
#>
#>
#> Correction of the LHS part of the matrix
#> Correction of the RHS part of the matrix
#> 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.
#> The matrix derivative is now corrected by method RRM .
spl=gather(spl,nspl) #the third is added
is.splinets(spl)[[1]]
#>
#>
#> DIAGNOSTIC CHECK of a SPLINETS object
#>
#> THE KNOTS:
#>
#>
#> THE SUPPORT SETS:
#>
#>
#>
#> THE DERIVATIVES AT THE KNOTS:
#>
#> [1] TRUE
spl@supp
#> [[1]]
#> [,1] [,2]
#> [1,] 2 12
#>
#> [[2]]
#> [,1] [,2]
#> [1,] 4 20
#>
#> [[3]]
#> [,1] [,2]
#> [1,] 6 25
#>
spl@der
#> [[1]]
#> [,1] [,2] [,3] [,4]
#> [1,] 0.00000000 0.0000000 0.0000000 7.376173e+03
#> [2,] 0.03165921 3.2162362 217.8233855 -9.462063e+03
#> [3,] 0.27589971 -0.8270676 -352.0838223 2.125572e+05
#> [4,] 0.27420288 -1.1186648 0.9223759 -1.112723e-01
#> [5,] 0.26365595 -1.1099394 0.9213227 5.850208e-01
#> [6,] 0.24779384 -1.0966331 0.9297336 0.000000e+00
#> [7,] 0.20798455 -1.0625232 0.9202542 -2.570614e-01
#> [8,] 0.19667686 -1.0526812 0.9207778 4.896542e-02
#> [9,] 0.18172825 -1.9346457 -159.6258732 -1.444478e+04
#> [10,] 0.07179023 -3.1158175 90.1545008 7.345496e+03
#> [11,] 0.00000000 0.0000000 0.0000000 -1.304286e+03
#>
#> [[2]]
#> [,1] [,2] [,3] [,4]
#> [1,] 0.000000000 0.0000000 0.000000e+00 1.462326e+07
#> [2,] 0.011163811 20.1663459 2.428570e+04 -3.767611e+06
#> [3,] 0.757428221 81.2667804 -1.137497e+04 7.912416e+05
#> [4,] 1.142096526 -0.4971283 7.211323e-01 -7.157829e-01
#> [5,] 1.124248824 -0.4710226 6.947372e-01 -9.546746e+05
#> [6,] 0.924780073 -55.0303220 -1.020651e+04 1.365346e+06
#> [7,] -0.004834481 -84.1384399 4.968645e+03 -1.461014e+05
#> [8,] -0.950724335 0.3489009 5.314578e-01 -1.380929e+00
#> [9,] -0.925414106 0.3823373 4.360056e-01 0.000000e+00
#> [10,] -0.905819360 0.4028189 3.851283e-01 -1.019869e+00
#> [11,] -0.448346629 31.4768554 1.461854e+03 3.438589e+04
#> [12,] -0.091871178 30.1944274 -1.703836e+03 -2.986684e+05
#> [13,] 0.242195051 -1.7239825 -8.981582e-01 4.547622e+04
#> [14,] 0.195393804 -1.7472843 -8.302975e-01 2.516846e+00
#> [15,] 0.187932242 -1.7703135 -1.000628e+01 -2.158916e+03
#> [16,] 0.001415052 -0.2680215 3.384352e+01 3.478879e+02
#> [17,] 0.000000000 0.0000000 0.000000e+00 -2.136739e+03
#>
#> [[3]]
#> [,1] [,2] [,3] [,4]
#> [1,] 0.0000000000 0.0000000 0.0000000 -7.113758e+04
#> [2,] -0.0352333701 -7.3520195 -1022.7461681 5.666283e+04
#> [3,] -0.5281669971 -6.5407974 1066.7436463 -9.980994e+04
#> [4,] -0.5574594866 -0.8402538 -0.4053771 -3.358705e-01
#> [5,] -0.5668236098 -0.8447802 -0.4091101 4.559846e+00
#> [6,] -0.5957566354 -0.8560555 -0.2540546 -6.354459e-01
#> [7,] -0.6555705573 -0.8751342 -0.2979777 7.887325e+03
#> [8,] -0.5363993894 8.9242946 393.1699923 -2.446686e+04
#> [9,] -0.1150638602 3.5360923 -646.7205569 6.104205e+04
#> [10,] -0.1017971062 0.1101963 0.2853175 1.081431e+00
#> [11,] -0.0974611000 0.1216387 0.3258136 1.081431e+00
#> [12,] -0.1001082101 -0.5422015 -49.5674319 -1.850463e+03
#> [13,] -0.1027584500 -0.6808970 -15.6968236 7.969044e+03
#> [14,] -0.2755217830 -1.7608660 -1.4393172 1.131137e+02
#> [15,] -0.3035930998 -1.7837882 -1.4551026 -9.966184e-01
#> [16,] -0.3387884854 -1.7932483 0.4919197 9.911783e+01
#> [17,] -0.4936086568 -1.7592515 0.2875176 -2.343141e+00
#> [18,] -0.4452279029 7.7520301 555.2101074 1.620487e+04
#> [19,] -0.0007748643 0.9945450 -851.0047201 -3.077704e+04
#> [20,] 0.0000000000 0.0000000 0.0000000 3.640906e+05
#>