This package provides implementations for first- and second-order differences Whittaker-Henderson smoothing and interpolation.
To install Whittaker.jl
, start Julia and run:
Pkg.add("Whittaker")
To interpolate a missing value using first-order differences, the following code can be used:
using Whittaker
y = [1.0, 1.2, 0, 1.6, 1.8]
w = [1.0, 1.2, 0, 1.6, 1.8]
lambda = 0.0001
z = whittaker1(y, w, lambda)
# z = [1.00002, 1.2, 1.4, 1.6, 1.79998]
In order to use second-order differences, use:
z = whittaker2(y, w, lambda)
# z = [0.999997, 1.20001, 1.4305, 1.64575, 1.80004]
Note You can use whittaker1!
and whittaker2!
to smooth and interpolate in-place.
The code is based on 'Smoothing and interpolation with finite differences' [Eilers P. H. C, 1994].