Link functions
Link functions
A link function \(g(x)\) is a smooth, monotonic function of \(x\).
For all link functions, we implement
- the link \(g(x)\)
- the inverse \(g^{-1}(x)\)
- the derivative of the link function \(\frac{\partial g(x)}{\partial x}\).
- the first derivative of the inverse of the link function \(\frac{\partial g(x)^{-1}}{\partial x}\). The choice of the inverse is justified by Equation (7) in Hirsch, Berrisch & Ziel (2024).
The link functions implemented in ondil
implemenent these as class methods each. Currently, we have implemented the identity-link, log-link and shifted log-link functions.
Overview of Link Functions
Link Function | Description |
---|---|
IdentityLink |
Implements the identity link function \(g(x) = x\). |
LogLink |
Implements the logarithmic link function \(g(x) = \log(x)\). |
LogShiftValueLink |
Log link function with a shift value added to the inverse transformation. |
LogShiftTwoLink |
Log link function ensuring \(\hat{\theta} > 2\). |
LogIdentLink |
Combines identity and log transformations. |
LogitLink |
Implements the logit link function \(g(x) = \log(x/(1-x))\). |
SqrtLink |
Implements the square root link function \(g(x) = \sqrt{x}\). |
SqrtShiftValueLink |
Square root link function with a shift value added to the inverse transformation. |
SqrtShiftTwoLink |
Square root link function ensuring \(\hat{\theta} > 2\). |
InverseSoftPlusLink |
Implements the inverse softplus link function. |
InverseSoftPlusShiftValueLink |
Inverse softplus link function with a shift value added to the inverse transformation. |
InverseSoftPlusShiftTwoLink |
Inverse softplus link function ensuring \(\hat{\theta} > 2\). |
Shifted Link Functions
Some link functions implement shifted versions. The shifted link function is implemented in the sense that the shift is added to the inverse transformation. This way, we can ensure that distribution parameters can be modelled on the continuous space of the \(\eta = g(\theta)\), but in the inverse transform fullfill certain additional constraints. A common example is the \(t\) distribution, where we can use a LogShift2Link
or SqrtShift2Link
to ensure that \(\hat{\theta} = g^-1(\eta) > 2\) and the variance exists.
Base Class
ondil.base.LinkFunction
Bases: ABC
The base class for the link functions.
link_support
abstractmethod
property
The support of the distribution.
inverse_derivative
abstractmethod
Calculate the first derivative for the inverse link function
link_derivative
abstractmethod
Calculate the first derivative of the link function
API Reference
ondil.link.IdentityLink
Log-Link Functions
ondil.link.LogLink
ondil.link.LogShiftValueLink
Bases: LinkFunction
The Log-Link function shifted to a value \(v\).
This link function is defined as \(g(x) = \log(x - v)\). It can be used to ensure that certain distribution paramters don't fall below lower bounds, e.g. ensuring that the degrees of freedom of a Student's t distribtuion don't fall below 2, hence ensuring that the variance exists.
ondil.link.LogShiftTwoLink
Bases: LogShiftValueLink
The Log-Link function shifted to 2.
This link function is defined as \(g(x) = \log(x - 2)\). It can be used to ensure that certain distribution paramters don't fall below lower bounds, e.g. ensuring that the degrees of freedom of a Student's t distribtuion don't fall below 2, hence ensuring that the variance exists.
ondil.link.LogIdentLink
Bases: LinkFunction
The Logident Link function.
The LogIdent Link function has been introduced by Narajewski & Ziel 2020 and can be used to avoid the exponential inverse for large values while keeping the log-behaviour in small ranges. This can stabilize the estimation procedure.
Logit Link Functions
ondil.link.LogitLink
Bases: LinkFunction
The Logit Link function.
The logit-link function is defined as \(g(x) = \log (x/ (1-x))\).
Square Root Link Functions
ondil.link.SqrtLink
Bases: LinkFunction
The square root Link function.
The square root link function is defined as \(\(g(x) = \sqrt(x)\)\).
ondil.link.SqrtShiftValueLink
Bases: LinkFunction
The Sqrt-Link function shifted to a value \(v\).
This link function is defined as \(\(g(x) = \sqrt(x - v)\)\). It can be used to ensure that certain distribution paramters don't fall below lower bounds, e.g. ensuring that the degrees of freedom of a Student's t distribtuion don't fall below 2, hence ensuring that the variance exists.
ondil.link.SqrtShiftTwoLink
Bases: SqrtShiftValueLink
The Sqrt-Link function shifted to 2.
This link function is defined as \(\(g(x) = \sqrt(x - 2)\)\). It can be used to ensure that certain distribution paramters don't fall below lower bounds, e.g. ensuring that the degrees of freedom of a Student's t distribtuion don't fall below 2, hence ensuring that the variance exists.
Inverse SoftPlus Link Functions
ondil.link.InverseSoftPlusLink
Bases: LinkFunction
The softplus is defined as $$ \operatorname{SoftPlus(x)} = \log(1 + \exp(x)) $$ and hence the inverse is defined as $$ \log(\exp(x) - 1) $$ which can be used as link function for the parameters on the positive real line. The behavior of the inverse softplus is more graceful on large values as it avoids the exp of the log-link and converges towards a linear behaviour.
The softplus is the smooth approximation of \(\max(x, 0)\).