Learn R Programming

geoBayes (version 0.3.0)

linkfcn: Calculate the link function for exponential families

Description

Link function for the exponential family.

Usage

linkfcn(mu, linkp, family = c("gaussian", "binomial", "poisson", "Gamma",
  "GEV.binomial", "GEVD.binomial", "Wallace.binomial"))

linkinv(z, linkp, family = c("gaussian", "binomial", "poisson", "Gamma", "GEV.binomial", "GEVD.binomial", "Wallace.binomial"))

Arguments

mu
Numeric. The mean of the response variable.
z
Numeric. The linear predictor.
linkp
The link function parameter. A scalar but for the binomial family is also allowed to have the character values "logit" or "probit".
family
The distribution of the response variable.

Value

  • A numeric array of the same dimension as the function's first argument.

Details

linkfcn maps the mean of the response variable mu to the linear predictor z. linkinv is its inverse.

Note that the logit link for the binomial family is defined as the quantile of the logistic distribution with scale 0.6458.

For the Gaussian family, if the link parameter is positive, then the extended link is used, defined by $$z = \frac{sign(\mu)|\mu|^\nu - 1}{\nu}$$ In the other case, the link function is the same as for the Poisson and gamma families.

For the Poisson and gamma families, the Box-Cox transformation is used, defined by $$z = \frac{\mu^\nu - 1}{\nu}$$

For the GEV binomial family, the link function is defined by $$\mu = 1 - \exp{-\max(0, 1 + \nu z)^{\frac{1}{\nu}}}$$ for any real $\nu$. At $\nu = 0$ it reduces to the complementary log-log link.

The Wallace binomial family is a fast approximation to the robit family. It is defined as $$\mu = \Phi(\mbox{sign}(z) c(\nu) \sqrt{\nu \log(1 + z^2/\nu)})$$ where $c(\nu) = (8\nu+1)/(8\nu+3)$

See Also

comparebinlinks

Examples

Run this code
mu <- seq(0.1, 0.9, 0.1)
linkfcn(mu, 7, "binomial")       # robit(7) link function
linkfcn(mu, "logit", "binomial") # logit link function

mu <- seq(-3, 3, 1)
linkfcn(mu, 0.5, "gaussian")     # sqrt transformation
linkinv(linkfcn(mu, 0.5, "gaussian"), 0.5, "gaussian")
curve(linkfcn(x, 0.5, "gaussian"), -3, 3)

Run the code above in your browser using DataLab