Link functions (m.link)

Inverse link functions and transforms.

m.link.LKJcor

m.link.LKJcor(corr_matrix, eta)

Computes the LKJ correlation density.

The LKJ prior is used for modeling correlation matrices. It is controlled by a single parameter, eta. Higher values of eta imply stronger shrinkage towards the identity matrix.

Argument Type Description
corr_matrix array-like A square, symmetric correlation matrix.
eta float The shape parameter of the LKJ distribution.

Returns

  • float: The LKJ density of the input correlation matrix.

m.link.cloglog

m.link.cloglog(p)

Computes the complementary log-log transformation.

Argument Type Description
p float or array-like Input probability value(s) in the range (0, 1).

Returns

  • float or array-like: The complementary log-log transformed value(s): log(-log(1 - p)).

m.link.exp

m.link.exp(x)

Computes the exponential function.

Argument Type Description
x float or array-like Input value(s).

Returns

  • float or array-like: The exponential of the input value(s).

m.link.inv_cloglog

m.link.inv_cloglog(x)

Computes the inverse complementary log-log transformation.

Argument Type Description
x float or array-like Input value(s).

Returns

  • float or array-like: The inverse complementary log-log transformed probability value(s): 1 - exp(-exp(x)).

m.link.inv_logit

m.link.inv_logit(x)

Computes the inverse logit transformation.

Argument Type Description
x float or array-like Input value(s).

Returns

  • float or array-like: The inverse logit-transformed value(s): 1 / (1 + exp(-x)).

m.link.inv_logit_scale

m.link.inv_logit_scale(x)

Modified inverse logit function scaling between 0 and 1. From https://www.science.org/action/downloadSupplement?doi=10.1126%2Fsciadv.aax9070&file=aax9070_sm.pdf

Argument Type Description
x float or array-like Input value(s).

Returns

  • float or array-like: The inverse logit-transformed value(s): 1 / (1 + exp(-x)).

m.link.inv_probit

m.link.inv_probit(x)

Computes the inverse probit transformation.

Argument Type Description
x float or array-like Input value(s).

Returns

  • float or array-like: The probability value(s) from the cumulative distribution function of the standard normal distribution.

m.link.log

m.link.log(p)

Computes the natural logarithm.

Argument Type Description
p float or array-like Input value(s).

Returns

  • float or array-like: The natural logarithm of the input value(s).

m.link.logit

m.link.logit(x)

Computes the logit transformation.

Argument Type Description
x float or array-like Input value(s) in the range (0, 1).

Returns

  • float or array-like: The logit-transformed value(s): log(x / (1 - x)).

m.link.probit

m.link.probit(p)

Computes the probit transformation.

Argument Type Description
p float or array-like Input probability value(s) in the range (0, 1).

Returns

  • float or array-like: The probit-transformed value(s), corresponding to the quantile of the standard normal distribution.

m.link.reciprocal

m.link.reciprocal(x)

Computes the reciprocal of the input.

Argument Type Description
x float or array-like Input value(s).

Returns

  • float or array-like: The reciprocal of the input value(s): 1 / x.

m.link.sqrt

m.link.sqrt(p)

Computes the square root.

Argument Type Description
p float or array-like Input value(s).

Returns

  • float or array-like: The square root of the input value(s).

m.link.square

m.link.square(x)

Computes the square of the input.

Argument Type Description
x float or array-like Input value(s).

Returns

  • float or array-like: The square of the input value(s): x ** 2.