| integral.dierckx {DierckxSpline} | R Documentation |
Calculates the integral of a spline function s(x) of degree k, which is given in its normalized b-spline representation
integral(x, ...) ## S3 method for class 'dierckx': integral(x, from = NULL, to = NULL, ...)
x |
An object of class dierckx. |
from |
Lower integration bound. If NULL, the minimum knot
value is used. |
to |
Upper integration bound. If NULL, the maximum knot
value is used. |
... |
ignored |
s(x) is considered to be identically zero outside the interval
(t(k+1),t(n-k)), where t are the knot values. For this reason,
from and to are forced to be in or on the boundaries of
the knots.
The value of the integral.
Sundar Dorai-Raj
Dierckx, P. (1991) Curve and Surface Fitting with Splines, Oxford Science Publications.
curfit, deriv.dierckx, spline, smooth.spline
x <- seq(0, 1, 0.1) y <- (1 - x)^3 z <- curfit(x, y, knots = seq(0, 1, 0.2)) plot(x, y, type = "p") lines(x, fitted(z), col = "blue") (answer <- integrate(function(x) (1 - x)^3, 0, 1)) #0.25 with absolute error < 2.8e-15 integral(z)-answer$value # 0 (ans2 <- integrate(function(x) (1 - x)^3, 0.5, 0.6)) #0.009225 with absolute error < 1.0e-16 integral(z, 0.5, 0.6)-ans2$value # 6e-9