Skip to content

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 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 ROLCH implemenent these as class methods each. Currently, we have implemented the identity-link, log-link and shifted log-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

rolch.abc.LinkFunction

Bases: ABC

The base class for the link functions.

derivative abstractmethod

derivative(x: np.ndarray) -> np.ndarray

Calculate the first derivative of the link function

inverse abstractmethod

inverse(x: np.ndarray) -> np.ndarray

Calculate the inverse of the link function

link(x: np.ndarray) -> np.ndarray

Calculate the Link

API Reference

Bases: LinkFunction

The identity link function.

The identity link is defined as \(g(x) = x\).

Bases: LinkFunction

The log-link function.

The log-link function is defined as \(g(x) = \log(x)\).

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.

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.

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.

Bases: LinkFunction

The square root Link function.

The square root link function is defined as \(\(g(x) = \sqrt(x)\)\).

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.

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.