I'm looking for a mathematical function that would have the following attributes:
- Reasonably smooth -- continuous to the second or third derivative, say, for values greater than zero.
- Given two values 1.0 and 1.0 it produces 1.0
- Given two values less than 1.0 (but greater than 0), such as 0.5 and 0.5 it produces a number less than either number but greater than the product of the two numbers (eg, 0.4).
- Similarly, for two values greater than 1.0 it produces a number greater than either but less than their products (less important).
- ADDED: Given one value 1.0 and another not, should produce the second value -- f(1.0, N) = N.
- Ideally (not a hard requirement), the function is associative and commutative.
- Ideally (not a hard requirement), there is a "knob" one can turn to adjust the "strength" of the function, in terms of, eg, whether f(0.5,0.5) = 0.4 or instead 0.3.
Eg, I could simply use multiplication, where 0.5 $\cdot$ 0.5 = 0.25, but that results in a number (to be used as a weighting factor) that is too small.
After some experimentation (in a "toy" Java test program):
Math.exp(-Math.pow(Math.pow(Math.abs(Math.log(A)), fudge) + Math.pow(Math.abs(Math.log(B)), fudge), 1.0/fudge));
$f(A,B)=\exp(-((|\ln A|^{\text{fudge}}+|\ln B|^{\text{fudge}})^{(1/{\text{fudge})}}))$
comes pretty close, where "fudge" is roughly 2.0, and the inputs are <= 1. However, it obviously doesn't work right for values of A and B > 1.0, and my crude attempts to extend it didn't produce a very smooth function. [I found out later that the function was reasonably smooth, only Excel was plotting it strangely due to the way I generated the input file.]
(exp, pow, abs, and log are all the mathematical functions you'd expect from their names.)
So: Is there an obvious mathematical formula that provides the desired characteristics?
Background:
This function is used to combine "adjustment factors" used to correct for the interdependence of observations in a Bayesian inference. In each step of the Bayesian calculations, a multiplier consisting of the conditional probability divided by the marginal probability is generated. That multiplier is "adjusted" by raising it to the power of the combined (using the sought-after formula) "adjustment factors" reaching it from previous terms in the equation.
(I'm not here to have this adjustment scheme critiqued or debated, I'm just giving this for background.)
I plotted, in Excel, the results (for fudge = 2.0, alpha = 1.0) from Didier Piau's scheme, close as I could understand it. (Sorry, Didier, if it's not correct.) It came out looking the same as the kludge I had cooked up earlier, though that earlier version occupied about 3 times as much code.
Since I don't understand Excel plotting very well the X axis is screwed up -- it represents B values times 10. The Y axis is the function value. (The curve fitting may be wrong in spots -- it's Excel's default.)
It certainly looks a bit peculiar, but I can't see anything specific that's wrong with it.
Musing: It kinda seems to me like there would be a name for this sort of function. It's kind of a "mean", or maybe a "product". I tried looking up "logarithmic mean", but that turned out to be something else.