Title: | Data Smoothing by Interpolating Cubic Splines |
---|---|
Description: | We construct the explicit form of clamped cubic interpolating spline (both uniform - knots are equidistant and non-uniform - knots are arbitrary). Using this form, we propose a linear regression model suitable for real data smoothing. |
Authors: | Juraj Hudak, Viliam Kacala, Csaba Torok, Lubomir Antoni |
Maintainer: | Lubomir Antoni <[email protected]> |
License: | GPL-2 |
Version: | 1.2.8 |
Built: | 2024-11-06 03:10:58 UTC |
Source: | https://github.com/cran/ICSsmoothing |
collision (nuclear
physics).277 measurements of the cross sections for
collision (nuclear physics).
CERN
CERN
A data frame with 277 elements.
https://link.springer.com/article/10.1007/BF02683433
cics_explicit
constructs the explicit form of non-uniform clamped interpolating cubic spline
(via Hermite cubic spline) for nodes uu
, function values yy
and exterior-node derivatives
d
.
cics_explicit( uu, yy, d, clrs = c("blue", "red"), xlab = NULL, ylab = NULL, title = NULL )
cics_explicit( uu, yy, d, clrs = c("blue", "red"), xlab = NULL, ylab = NULL, title = NULL )
uu |
a vector of arbitrary nodes (ordered ascendingly), with magnitude |
yy |
a vector of function values pertaining to nodes in |
d |
a vector of two values of derivative, in the first and the last node of |
clrs |
a vector of colours that are used alternately to plot the graph of spline's components. |
xlab |
a title (optional parameter) for the |
ylab |
a title (optional parameter) for the |
title |
a title (optional parameter) for the plot. |
a list with components
spline_coeffs |
matrix, whose |
spline_polynomials |
list of NcICS's components string representations. |
B |
|
gamma |
|
aux_BF |
A basis function of the spline |
aux_tridiag_inverse |
An inverse of the tridiagonal matrix used for spline derivatives construction |
cics_explicit( uu = c(1, 2.2, 3, 3.8, 7), CERN$y[1:5], d=c(0,-2), xlab="X axis", ylab="Y axis" ) uu <- c(0, 1, 4, 6); yy <- c(4, 5, 2, 1.8); sp <- cics_explicit(uu, yy, c(1,0)) sp$spline_polynomials ### <~~> ### Spline components' coefficients explicit_spline(sp$B, sp$gamma) sp$spline_coeffs == .Last.value
cics_explicit( uu = c(1, 2.2, 3, 3.8, 7), CERN$y[1:5], d=c(0,-2), xlab="X axis", ylab="Y axis" ) uu <- c(0, 1, 4, 6); yy <- c(4, 5, 2, 1.8); sp <- cics_explicit(uu, yy, c(1,0)) sp$spline_polynomials ### <~~> ### Spline components' coefficients explicit_spline(sp$B, sp$gamma) sp$spline_coeffs == .Last.value
cics_explicit_smooth
constructs the non-uniform clamped interpolating spline with k
components that smoothes
given data set {(xx[i],yy[i]), i=1..length(xx)}
.
cics_explicit_smooth( xx, yy, uu, clrs = c("blue", "red"), d, xlab = NULL, ylab = NULL, title = NULL )
cics_explicit_smooth( xx, yy, uu, clrs = c("blue", "red"), d, xlab = NULL, ylab = NULL, title = NULL )
xx |
a vector of data set's |
yy |
a vector of data set's |
uu |
a vector of arbitrary nodes, based on which we construct the smoothing spline. uu[1] and uu[length(uu)] must be equal to xx[1] and xx[length(xx)], respectively. |
clrs |
a vector of colours that are used alternately to plot the graph of spline's components. |
d |
a vector (optional parameter) that contains two values of derivative, in the first and the last
node from |
xlab |
a title (optional parameter) for the |
ylab |
a title (optional parameter) for the |
title |
a title (optional parameter) for the plot. |
a list with components
est_spline_coeffs |
|
est_spline_polynomials |
list of string representations of smoothing NcICS. |
est_gamma |
vector of estimated smoothing spline's coefficients (function values and exterior-node derivatives). |
aux_BF |
A basis function of the spline |
aux_tridiag_inverse |
An inverse of the tridiagonal matrix used for spline derivatives construction |
aux_M |
An estimation matrix used to compute |
cics_explicit_smooth( xx = CERN$x, yy = CERN$y, d = c(0, 1), uu = c(1, sort(runif(20,1,277)), 277), xlab = "X axis", ylab = "Y axis" ) yy <- c(1, 2, 3, 4, 3, 2, 2, 3, 5, 6, 7, 6, 5, 5, 4, 3, 2, 1, 0) xx <- c(1:length(yy)) uu <- c(1,7,10,19) sp <- cics_explicit_smooth(xx,yy,uu) ### We can change the derivatives at the end nodes: sp <- cics_explicit_smooth(xx,yy, uu, d=c(3,-7/10)) ### CERN: uu <- c(1, 15, 26, 63, 73, 88, 103, 117, 132, 200, 203, 219, 258, 277) sp <- cics_explicit_smooth( xx = CERN$x, yy = CERN$y, d = c(1, 0), uu )
cics_explicit_smooth( xx = CERN$x, yy = CERN$y, d = c(0, 1), uu = c(1, sort(runif(20,1,277)), 277), xlab = "X axis", ylab = "Y axis" ) yy <- c(1, 2, 3, 4, 3, 2, 2, 3, 5, 6, 7, 6, 5, 5, 4, 3, 2, 1, 0) xx <- c(1:length(yy)) uu <- c(1,7,10,19) sp <- cics_explicit_smooth(xx,yy,uu) ### We can change the derivatives at the end nodes: sp <- cics_explicit_smooth(xx,yy, uu, d=c(3,-7/10)) ### CERN: uu <- c(1, 15, 26, 63, 73, 88, 103, 117, 132, 200, 203, 219, 258, 277) sp <- cics_explicit_smooth( xx = CERN$x, yy = CERN$y, d = c(1, 0), uu )
cics_unif_explicit
constructs the explicit form of uniform clamped interpolating cubic spline
(via Hermite cubic spline) for nodes uu
, function values yy
and exterior-node derivatives
d
.
cics_unif_explicit( uumin, uumax, yy, d, clrs = c("blue", "red"), xlab = NULL, ylab = NULL, title = NULL )
cics_unif_explicit( uumin, uumax, yy, d, clrs = c("blue", "red"), xlab = NULL, ylab = NULL, title = NULL )
uumin |
a starting node. |
uumax |
an ending node. |
yy |
a vector of function values pertaining to nodes in |
d |
a vector of two values of derivative, in the first and the last node of |
clrs |
a vector (optional parameter) of colours that are used alternately to plot the graph of spline's components. |
xlab |
a title (optional parameter) for the |
ylab |
a title (optional parameter) for the |
title |
a title (optional parameter) for the plot. |
A list of spline components
spline_coeffs |
matrix, whose |
spline_polynomials |
list of UcICS's components string representations. |
B |
|
gamma |
|
aux_BF |
A basis function of the spline |
aux_tridiag_inverse |
An inverse of the tridiagonal matrix used for spline derivatives construction |
yy <- c(4, 5, 2, 1.8); sp <- cics_unif_explicit(0, 6, yy, c(2, 0.9)) sp$spline_polynomials ### <~~> ### Spline components' coefficients explicit_spline(sp$B, sp$gamma) sp$spline_coeffs == .Last.value
yy <- c(4, 5, 2, 1.8); sp <- cics_unif_explicit(0, 6, yy, c(2, 0.9)) sp$spline_polynomials ### <~~> ### Spline components' coefficients explicit_spline(sp$B, sp$gamma) sp$spline_coeffs == .Last.value
cics_unif_explicit_smooth
constructs the uniform clamped interpolating spline with k
components that smoothes
given data set {(xx[i],yy[i]), i=1..length(xx)}
.
cics_unif_explicit_smooth( xx, yy, k, clrs = c("blue", "red"), d, xlab = NULL, ylab = NULL, title = NULL, plotTF = TRUE )
cics_unif_explicit_smooth( xx, yy, k, clrs = c("blue", "red"), d, xlab = NULL, ylab = NULL, title = NULL, plotTF = TRUE )
xx |
a vector of data set's |
yy |
a vector of datanvidi set's |
k |
a chosen number of components of smoothing UcICS (integer |
clrs |
a vector of colours that are used alternately to plot the graph of spline's components. |
d |
a vector (optional parameter) that contains two values of derivative, in the first and the last computed node. If missing, values of derivative are estimated by given linear regression model. If present, their contribution is removed from linear model and only function values are estimated. |
xlab |
a title (optional parameter) for the |
ylab |
a title (optional parameter) for the |
title |
a title (optional parameter) for the plot. |
plotTF |
a boolean value (optional parameter), if TRUE then plot. |
a list with components
nodes |
vector of equidistant nodes, based on which we construct the smoothing spline. |
est_spline_coeffs |
|
est_spline_polynomials |
list of string representations of smoothing UcICS. |
est_gamma |
vector of estimated smoothing spline's coefficients (function values and exterior-node derivatives). |
aux_BF |
A basis function of the spline |
aux_tridiag_inverse |
An inverse of the tridiagonal matrix used for spline derivatives construction |
aux_M |
An estimation matrix used to compute |
cp <- cics_unif_explicit_smooth( xx = CERN$x, yy = CERN$y, k = 19, #23, d = c(1, 0), xlab = "X axis", ylab = "Y axis" )
cp <- cics_unif_explicit_smooth( xx = CERN$x, yy = CERN$y, k = 19, #23, d = c(1, 0), xlab = "X axis", ylab = "Y axis" )
C^2
in its explicit form S=B * gamma
.The function computes the coefficients of the cubic polynomials as spline components of the clamped interpolating cubic spline of class C^2
in its explicit form S=B * gamma
.
explicit_spline(B, gamma)
explicit_spline(B, gamma)
B |
a |
gamma |
a vector of spline coefficients - function values and exterior-node derivatives that takes part in the explicit form |
a matrix with four columns, whose i
-th row contains the coefficients of the splines's i
-th component.
# See functions cics_explicit, cics_unif_explicit and the vignette.
# See functions cics_explicit, cics_unif_explicit and the vignette.
Forecasting demo using cics_unif_explicit_smooth.
forecast_demo()
forecast_demo()
a forecast result
# Plots as well as the process of computation of future derivatives and values using extrapolation. ud <- forecast_demo()
# Plots as well as the process of computation of future derivatives and values using extrapolation. ud <- forecast_demo()
hermite_bf_matrix
constructs matrix of Hermite basis functions' coefficients on
[u
,v
], that is the matrix of 4 cubic polynomials' coefficients of
one-component Hermite cubic spline.
hermite_bf_matrix(u, v)
hermite_bf_matrix(u, v)
u |
a left border of interval [ |
v |
a right border of interval [ |
The matrix of 4 Hermite basis functions' coefficients.
hermite_bf_matrix(0,1) hermite_bf_matrix(-2,3)
hermite_bf_matrix(0,1) hermite_bf_matrix(-2,3)
tridiag_inv_general
constructs inverse of a general tridiagonal matrix T
of order n
,
using Usmani's theorem.
tridiag_inv_general(T, n)
tridiag_inv_general(T, n)
T |
a tridiagonal matrix. |
n |
an order of given tridiagonal matrix. |
The inverse of matrix T.
tridiag_inv_general(matrix(c(1, 4, 0, -9), 2, 2), 2) tridiag_inv_general(matrix(c(1, 3, 5, -2, 0, 8, 7, 6, 6), 3, 3), 3)
tridiag_inv_general(matrix(c(1, 4, 0, -9), 2, 2), 2) tridiag_inv_general(matrix(c(1, 3, 5, -2, 0, 8, 7, 6, 6), 3, 3), 3)
tridiag_inv_unif_by_sums
constructs inverse of a regular tridiagonal matrix T
_n
(a
,b
,a
)
with constant entries by a special algorithm using sums of matrix elements.
tridiag_inv_unif_by_sums(n, a, b)
tridiag_inv_unif_by_sums(n, a, b)
n |
an order of given tridiagonal matrix. |
a |
a value of tridiagonal matrix elements that are off-diagonal. |
b |
a value of tridiagonal matrix diagonal elements. |
The inverse of matrix T
_n
(a
,b
,a
).
tridiag_inv_unif_by_sums(5, 1, 4) tridiag_inv_unif_by_sums(9, 10, -1)
tridiag_inv_unif_by_sums(5, 1, 4) tridiag_inv_unif_by_sums(9, 10, -1)