Login  Register

MonotonicLogCubicNaturalSpline doesn't preserve monotonicity

Posted by Jag on Jan 18, 2013; 11:31am
URL: http://quantlib.414.s1.nabble.com/MonotonicLogCubicNaturalSpline-doesn-t-preserve-monotonicity-tp13926.html

I am using MonotonicLogCubicNaturalSpline with extrapolation set to TRUE, and it seems to lose monotonicity between the first & second X-Value.

The input values are all strictly decreasing. But the output is decreasing until it reaches the second X-Value[183], at which point it increases from 0.999045 to 0.999354. The output is not even matching at the first X Value. Input for X=91 is 0.999657 but, the interpolation is sending back 0.999357.
Please see the input & output below.

Any help will be much appreciated!


Input:
X Value [91] -  Y Value [0.999657]
X Value [183] - Y Value [0.999354]
X Value [274] - Y Value [0.999045]
X Value [365] - Y Value [0.998726]
X Value [457] - Y Value [0.99837]
X Value [548] - Y Value [0.997918]
X Value [639] - Y Value [0.997302]
X Value [731] - Y Value [0.996525]
X Value [1096] - Y Value [0.991699]
X Value [1461] - Y Value [0.982502]
X Value [1826] - Y Value [0.968062]
X Value [2192] - Y Value [0.94841]
X Value [2557] - Y Value [0.92509]
X Value [2922] - Y Value [0.899574]
X Value [3287] - Y Value [0.872604]
X Value [3653] - Y Value [0.844616]
X Value [4383] - Y Value [0.78806]
X Value [5479] - Y Value [0.708377]
X Value [7305] - Y Value [0.59849]
X Value [9131] - Y Value [0.509214]
X Value [10958] - Y Value [0.43323]
X Value [14610] - Y Value [0.325498]
X Value [18263] - Y Value [0.258686]


Output:
[1] - 0.999653
[2] - 0.99965
[3] - 0.999647
[4] - 0.999644
[5] - 0.99964
[6] - 0.999637
[7] - 0.999634
[8] - 0.999631
[9] - 0.999627
.
.
.
[87] - 0.99937
[88] - 0.999367
[89] - 0.999364
[90] - 0.99936
[91] - 0.999357
[92] - 0.999354
.
.
.
.
[180] - 0.999053
[181] - 0.999049
[182] - 0.999045
[183] - 0.999354
[184] - 0.99935
[185] - 0.999347
[186] - 0.999344
[187] - 0.99934