Invertible calibration curves: Hyperbolic segments and hyperbolic splines

A function with the form y = (+e)/(1+c) is monotonic for all values of the parameters and can be inverted easily. This function describes a rectangular hyperbola, a segment of which might be used as a calibration curve for reading from  to y and, more importantly, from y to . Methods are given for finding the hyperbolic segment that minimizes the sum of squared residuals to a set of points {(, y)} and for finding a spline of hyperbolic segments that minimizes an objective function, e.g. the sum of squared residuals. A method is also given for constructing a spline of hyperbolic segments that interpolates a set of points. An analysis of model error is given. This is a pre-print of a manuscript submitted for publication in Advanced Mathematical and Computational Tools in Metrology and Testing XII vol.12, Series “Advances in Mathematics for Applied Science”, World Scientific, Singapore. Robin Willink Wellington, New Zealand robin.willink@gmail.com Invertible calibration curves: hyperbolic segments and hyperbolic splines R. Willink1,2 1Measurement Standards Laboratory of New Zealand, PO Box 31310, Lower Hutt 5040, NZ 2University of Otago (Wellington), PO Box 7343, Wellington 6242, New Zealand E-mail: robin.willink@measurement.govt.nz Abstract A function with the form y = (a+ex)∕(1+cx) is monotonic for all values of the parameters and can be inverted easily. This function describes a rectangular hyperbola, a segment of which might be used as a calibration curve for reading from x to y and, more importantly, from y to x. Methods are given for finding the hyperbolic segment that minimizes the sum of squared residuals to a set of points {(x, y)} and for finding a spline of hyperbolic segments that minimizes an objective function, e.g. the sum of squared residuals. A method is also given for constructing a spline of hyperbolic segments that interpolates a set of points. An analysis of model error is given.


Introduction
Calibrating an instrument that produces a reading for a stimulus involves recording values of at known values of , fitting a curve to the data, and inverting the curve to obtain a function ( ) that can be used to estimate the stimulus from a future reading. The curve is fitted as ( ) but is used as ( ), so it would be advantageous to employ a function that permits inversion. Sometimes a quadratic function = + + 2 is used, with allowing some non-linearity in the form of a parabola. Inversion gives the function = − ± √ {[ 2 − 4( − ) ]∕(2 )}, which is multivalued and has a different form. However, unless theory suggests that the underlying function is quadratic, there is no reason in principle to use such an equation. Here, we describe instead the use of a segment of a hyperbola, for which the inverse is given explicitly by a function with the same form. We demonstrate the use of the hyperbola as a single function and as the form of the segment in a spline, in which there is greater flexibility and the possibility of points of inflexion.

A hyperbolic segment
A calibration curve might be chosen to have the form in which non-linearity enters through a non-zero value of . This function has the property that is expressible in terms of in the same form: the inverse of (1) is The curve could therefore be used in both forward and inverse directions without difficulty. Rearranging these equations gives a single equation of the form + + = 1, which describes a rectangular hyperbola with asymptotes parallel to the coordinate axes. Thus, over the range of the data, the curve we consider is an arc of a hyperbola. We will say that, when only a finite range of values is involved, equation (1) describes a hyperbolic segment. Examples of hyperbolic segments are given in Figure 1a.
In the sense that a rectangular hyperbola and a quadratic function are both defined by three parameters, they are as flexible as each other. But this does not mean that they are equally suited to approximating the kinds of monotonic relationships that underlie calibration problems. The ability of a quadratic function to model non-monotonic behaviour will be wasted when that function is used as a calibration curve, while this is not the case for the hyperbolic function (1). The hyperbolic function has a pole at = −1∕ , which could be problematic if the curve is to be extrapolated. However, this point seems likely to be a long way from the -values of interest, and the behaviour over the relevant range will be entirely satisfactory. Either side of the pole the function is monotonic, and far from the pole approaches the value ∕ . Thus, a hyperbolic segment can model behaviour asymptotic to a constant. Figure 1a illustrates the flexibility of this function.
In what follows we (i) give an explicit expression for the unique hyperbolic segment that passes through any three points, (ii) describe a simple way of finding the least-squares hyperbolic segment that fits > 3 points, (iii) give an explicit expression for a hyperbolic spline that interpolates > 3 points and has first derivatives matched at the points, allowing points of inflexion in the calibration curve, and (iv) describe the fitting of a least-squares spline of fewer segments to a set of points.
Subsequently, we consider some relevant aspects of an appropriate error analysis.
An equation describing a hyperbolic segment can be written in various ways. The form given in (1) facilitates inversion and shows how the standard linear expression = + is modified by non-zero . However, when fitting to data in Sections 3, 5 and 6 we will use the representation for some point ( * , * ) through which the curve must pass, while in Section 4 we will use the representation = + ∕(1 + ).

The least-squares hyperbolic segment
Let us fit a hyperbolic segment to data ( 1 , 1 ), … , ( , ) by weighted least squares with residuals in . The representation of (1) used is Unless otherwise stated, all summation is over = 1, … , .
We seek the values of the parameters , and that minimize where is the weight to be associated with the squared residual at the point ( , ). No analytical solution seems available, so the method of solution will involve a numerical search. However, we only require a line search because for any value of the solution to the resulting two-parameter problem can be found analytically if we write to obtain a linear function = + . So = ∑ − + 2 and, for any set of values, the values of and that minimize are the weighted least-squares solutions for the straight line Thus, we find the value of minimizing = ( ), record the corresponding values of and , and set = + . A suitable starting value for searching on would be the value of minimizing the weighted sum of squared residuals with the quadratic function = + (1 − ), which describes a curve very similar to (2) when | | is small. This value is tively, a simple starting value of = 0 would suffice. Figure

An interpolating hyperbolic spline
Now we consider the construction of a spline of hyperbolic segments that is continuous, has continuous first derivative, and passes through the points ( 1 , 1 ), … , ( , ) with 1 < ⋯ < and 1 < ⋯ < . This hyperbolic spline [1] will be made up of − 1 segments between the pairs of adjacent values. Similarly, the inverse function will be a hyperbolic spline made up of − 1 hyperbolic segments between the pairs of adjacent values. Both functions will be strictly monotonic. The points at which the segments of a spline meet are called knots. (The subscript will be used instead of when a point is a knot.) So we seek a function ( ) of the form such that the function is continuous and has continuous first derivative, Let us define so is the average slope in the interval from ( , ) to ( +1 , +1 ). Equating the first derivatives at the knots gives the simple but unusual recursion +1 = 2 ∕ . Putting = +1 and = +1 Thus, for any value of the derivative at the initial point 1 = ∕ | = 1 , the unique interpolating hyperbolic spline is given by By symmetry about the line of slope 1, the inverse of this function is the A similar method for constructing such a spline has been obtained by Martin et al, [1] who give their analysis by referring to a Möbius transformation ( ) = ( + )∕( + ) and associated 2 × 2 matrices. They consider + 1 points numbered from = 0, … , and they write where we have +1 ∕ +1 . So the dimensionless quantity describes the ratio of the slope at the beginning of a segment to the average slope over that segment, and setting 0 = 1 means that the first segment is straight, i.e. 1 = 0. Martin et al suggest that if the derivative at 1 is not known then it might be chosen to minimize the curvature of the function, and they measure this by the quantity Λ ≡ because curvature is associated with values of that differ from 1. In our notation, their suggestion is to set 1 This measure has the property that the same function would be obtained whether the independent variable was or . The function that would result from swapping the and values therefore describes the same relationship as the inverse function ( ) given by (5). This approach strengthens the concept of invertibility to one that involves a concept of symmetry and an invariance.
Here, we suggest (i) scaling to obtain a variablé that equalizes the extent of the function in the and directions and then (ii) minimizing the sum of a suitable statistic of the functioń ( ) and the same statistic of the inverse function (́ ). The result will be a function with the same properties of uniqueness and inversion as the spline of Martin et al. We will minimize the integrated squared second derivative, as is common in the regularization of curves. This measure of smoothness responds to all of the function, not just the single values of .
The spline with the -axis scaled so that the average slope is 1 uses the valueś = 1 + ( − 1 ) The corresponding value of iś ≡ . For the spline with scales equalized in this way,́ ( ),  For the inverse spline, (́ ), the quantitý is replaced by its reciprocal, and the corresponding integral is found to be Therefore, the quantity minimized to obtain the unique smoothest spline is ≡ ́ + ́ , and the associated value of 1 is found numerically.

The least-squares hyperbolic spline
Now we consider the construction of a monotonic least-squares hyperbolic spline to data points ( 1 , 1 ), … , ( , ) using segments with knots at (1) , … , ( +1) , where ( ) does not need to be an value. As before, 1 < ⋯ < , but now we no longer require that 1 < ⋯ < : monotonicity is imposed on the fitted function, not on the -data. The knots are free, but the spline obtained over [ 1 , ] will not depend on the -coordinates of the end knots, so without loss of generality we set (1) = 1 and ( +1) = . The data are indexed by = 1, … , and the knots by = 1, … , + 1. The spline will be given by A hyperbolic spline on segments with knots having fixed -coordinates has + 2 parameters. So, with the -coordinates of the interior knots being free, our spline is defined by a vector of 2 + 1 unknowns, ≡ ( 1 , … , 2 +1 ), which we can regard as a vector of parameters. These Also, a suitable starting vector for estimating these parameters is A set of 7 data points was generated by the mechanism ' = 0.5 + 0.5 log + random error' and a set of 9 points was generated by the mechanism ' = {1 + exp(6 − )} −0.5 + random error'.  for = 1, … , − 1. The multiplier of ( ) is a quadratic function that is equal to zero at and +1 and has its greatest value, 1, at ( + +1 )∕2. So ( ( )) takes the value zero at the knots but rises to ( ) midway between each pair of adjacent knots. Figure 4a shows the functions ( ( )) and ( ) for the data of Figure 2. of an uncertainty region applicable to every point simultaneously.) Because the calibration curve will often be used as ( ), it will often be more appropriate to calculate ( ( )). This function can be formed in exactly the same way but using the inverse spline ( ) and the values. Figure 4b shows the functions ( ( )) and ( ) for the data of Figure 2.

A practical study -inversion of a high-order polynomial
A hyperbolic spline can be constructed to mimic a reference function used in the International Temperature Scale of 1990 (ITS-90). [2] The definition of the scale in the region from 273.15 K to 1234.73 K involves the use of a platinum resistance thermometer. A ratio of resistances is related to temperature by a reference function that is a ninth-order polynomial ( ). Use of the scale requires application of the inverse functioń ( ), which is a ninth-order polynomial consistent with ( ) to within 0.13 mK, i.e. |́ ( ( )) − | ≤ 0.13 mK, as shown by the dashed line in Figure 5.
An optimization method was configured to approximate these functions by a hyperbolic spline  h ( ), which can be inverted exactly. Over this range, the difference between h ( ) and́ ( ) is less than 0.3 mK, i.e. | h ( ) −́ ( )| ≤ 0.3 mK, as shown by the solid line. The figure of 0.3 mK is comparable to the summary figure of 0.5 mK that can be associated with non-uniqueness in ITS-90 from 'subrange inconsistency'. [2] Table 1 gives defining parameters of this spline and the temperatures at the knots.

Concluding comments
A calibration curve is often formed as ( ) but used as ( ). The monotonic behaviour of a rectangular hyperbola and the ability to invert this function make the hyperbolic segment suitable for use in calibration tasks. This article has described methods for forming a calibration curve using a single hyperbolic segment or a spline of segments, either interpolating the data or fitted to the data by the principle of least squares, with residuals in the dimension. The analysis could easily be adapted to use residuals in the dimension instead.
The underlying equation, + + = 1, can be generalized to accommodate more variables, in particular, with the equation This new equation describes a rectangular hyperboloid, with each pair of variables being related in the way described in this paper. For example, if is fixed, the relationship between and is the relationship described here. Therefore, calibration functions in more than two dimensions can be constructed using the same principles. Also, an invertible spline with more derivatives matched might be built around the more difficult equation = ( + ℎ )∕(1 + ℎ ).