Class DoubleRangeLimitTransform

  • All Implemented Interfaces:
    ParameterLimitsTransform

    public class DoubleRangeLimitTransform
    extends Object
    implements ParameterLimitsTransform
    Limit transform.

    If a model parameter $x$ is constrained to be between two values $a \geq x \geq b$, the function to transform it to an unconstrained variable is $y$ is given by $$ \begin{align*} y &= \tanh^{-1}\left(\frac{x - m}{s}\right)\\ m &= \frac{a + b}{2}\\ s &= \frac{b - a}{2} \end{align*} $$ with the inverse transform $$ \begin{align*} x &= s\tanh(y) + m\\ \end{align*} $$

    • Constructor Detail

      • DoubleRangeLimitTransform

        public DoubleRangeLimitTransform​(double lower,
                                         double upper)
        Creates an instance.
        Parameters:
        lower - Lower limit
        upper - Upper limit
        Throws:
        IllegalArgumentException - If the upper limit is not greater than the lower limit
    • Method Detail

      • inverseTransform

        public double inverseTransform​(double y)
        If $y > 25$, this returns $b$. If $y < -25$ returns $a$. A function to transform an unconstrained fitting parameter (y*) to a constrained model parameter (y) - i.e. y = f^-1(y*)
        Specified by:
        inverseTransform in interface ParameterLimitsTransform
        Parameters:
        y - Fitting parameter
        Returns:
        Model parameter
      • transform

        public double transform​(double x)
        A function to transform a constrained model parameter (y) to an unconstrained fitting parameter (y*) - i.e. y* = f(y)
        Specified by:
        transform in interface ParameterLimitsTransform
        Parameters:
        x - Model parameter
        Returns:
        Fitting parameter
        Throws:
        IllegalArgumentException - If $x > b$ or $x < a$
      • inverseTransformGradient

        public double inverseTransformGradient​(double y)
        If $|y| > 25$, this returns 0. The gradient of the function used to transform from a fitting parameter that can take any value, to a model parameter that is only allows to take certain values.
        Specified by:
        inverseTransformGradient in interface ParameterLimitsTransform
        Parameters:
        y - fitting parameter
        Returns:
        the gradient
      • transformGradient

        public double transformGradient​(double x)
        The gradient of the function used to transform from a model parameter that is only allows to take certain values, to a fitting parameter that can take any value.
        Specified by:
        transformGradient in interface ParameterLimitsTransform
        Parameters:
        x - Model parameter
        Returns:
        the gradient
        Throws:
        IllegalArgumentException - If $x > b$ or $x < a$
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object