make.plink: Create Non-parametric and Parametric Link Functions

View source: R/2_parametric_link_functions.R

make.plinkR Documentation

Description

This function has the same spirit as the make.link {stats} function which creates links for GLM families. However, it additionally allows the use of parametric link functions as, for example, the Aranda-Ordaz link function.

Usage

make.plink(link)

Arguments

link

character; see details to view the current available link functions.

Details

We assume that the link functions belonging to a parametric family are indexed by a positive parameter lambda. When the link function does not belong to this family (e.g., the logit function), then, by default, lambda = NULL. Otherwise, lambda must be specified.

The available link functions are

Link function Abbreviation Is it a parametric link function?
Logit "logit" FALSE
Probit "probit" FALSE
Cauchit "cauchit" FALSE
Log-Log "loglog" FALSE
Complement log-log "cloglog" FALSE
Identity "identity" FALSE
Aranda-Ordaz "aordaz" TRUE
Power logit "plogit" TRUE
Power pobit "pprobit" TRUE
Power cauchit "pcauchit" TRUE
Power log-log "ploglog" TRUE
Power complement log-log "pcloglog" TRUE
Reversal power logit "rplogit" TRUE
Reversal power pobit "rpprobit" TRUE
Reversal power cauchit "rpcauchit" TRUE
Reversal power log-log "rploglog" TRUE
Reversal power complement log-log "rpcloglog" TRUE
Reversal Aranda-Ordaz "raordaz" TRUE

Value

Given a link abbreviation, it returns a link function (linkfun); an inverse link function (linkinv); the first and the second derivatives of mu with respect to eta (mu.eta and mu2.eta2, respectively); the first and the second derivatives of mu with respect to lambda (rho and rho2, respectively); a logical value which is TRUE if the link function belongs to a parametric family (plink); and the lowercase name of link function (name). More specifically, it returns a list with the following components:

linkfun

Link function function(mu, lambda).

linkinv

Inverse link function function(eta, lambda).

mu.eta

Derivative function(eta, lambda) dmu/deta.

mu2.eta2

Second order derivative function(eta, lambda) d2 mu/d eta2.

rho

Derivative function(eta, lambda) dmu/dlambda. If the link function does not belongs to a parametric family, then it returns NULL.

rho2

Second order derivative function(eta, lambda) d2 mu/d lambda2. If the link function does not belongs to a parametric family, then it returns NULL.

rho.eta

Second order derivative function(eta, lambda) d2 mu/dlambda deta. If the link function does not belongs to a parametric family, then it returns NULL.

plink

logical; if TRUE, the link function belongs to a parametric family.

name

A name to be used for the link.

Author(s)

Rodrigo M. R. de Medeiros <rodrigo.matheus@live.com>

References

Bazán, J. L., Torres-Avilés, F., Suzuki, A. K., & Louzada, F. (2017). Power and reversal power links for binary regressions: An application for motor insurance policyholders. Applied Stochastic Models in Business and Industry, 33(1), 22–34.

Examples

### Non-parametric link functions
curve(make.plink("logit")$linkinv(x), xlim = c(-10, 10), ylim = c(0, 1),
      main = "Non-parametric link functions",
      xlab = expression(eta), ylab = "Inverse")
curve(make.plink("probit")$linkinv(x), add = TRUE, col = 2)
curve(make.plink("cauchit")$linkinv(x), add = TRUE, col = 3)
curve(make.plink("loglog")$linkinv(x), add = TRUE, col = 4)
curve(make.plink("cloglog")$linkinv(x), add = TRUE, col = 6)
legend("bottomright", legend = c("logit", "probit", "cauchit", "loglog", "cloglog"),
       lty = 1, col = c(1,2,3,4,6), bty = "n")

### Aranda-Ordaz
curve(make.plink("aordaz")$linkinv(x, 0.5), xlim = c(-10, 10), ylim = c(0, 1),
      main = "Aranda-Ordaz link function", xlab = expression(eta), ylab = "Inverse")
curve(make.plink("aordaz")$linkinv(x, 1), add = TRUE, col = 2)
curve(make.plink("aordaz")$linkinv(x, 3), add = TRUE, col = 3)
curve(make.plink("aordaz")$linkinv(x, 6), add = TRUE, col = 4)
legend("bottomright", legend = c(expression(lambda == 0.5),
                                 expression(lambda == 1),
                                 expression(lambda == 3),
                                 expression(lambda == 6)),
       lty = 1, col = c(1,2,3,4), bty = "n")

### Reversal Aranda-Ordaz
curve(make.plink("raordaz")$linkinv(x, 0.5), xlim = c(-10, 10), ylim = c(0, 1),
      main = "Reversal Aranda-Ordaz link function", xlab = expression(eta), ylab = "Inverse")
curve(make.plink("raordaz")$linkinv(x, 1), add = TRUE, col = 2)
curve(make.plink("raordaz")$linkinv(x, 3), add = TRUE, col = 3)
curve(make.plink("raordaz")$linkinv(x, 6), add = TRUE, col = 4)
legend("bottomright", legend = c(expression(lambda == 0.5),
                                 expression(lambda == 1),
                                 expression(lambda == 3),
                                 expression(lambda == 6)),
       lty = 1, col = c(1,2,3,4), bty = "n")

### Power logit
curve(make.plink("plogit")$linkinv(x, 0.5), xlim = c(-10, 10), ylim = c(0, 1),
      main = "Power logit link function", xlab = expression(eta), ylab = "Inverse")
curve(make.plink("plogit")$linkinv(x, 1), add = TRUE, col = 2)
curve(make.plink("plogit")$linkinv(x, 3), add = TRUE, col = 3)
curve(make.plink("plogit")$linkinv(x, 6), add = TRUE, col = 4)
legend("bottomright", legend = c(expression(lambda == 0.5),
                                 expression(lambda == 1),
                                 expression(lambda == 3),
                                 expression(lambda == 6)),
       lty = 1, col = c(1,2,3,4), bty = "n")


### Reversal power logit
curve(make.plink("rplogit")$linkinv(x, 0.5), xlim = c(-10, 10), ylim = c(0, 1),
      main = "Reversal power logit link function", xlab = expression(eta), ylab = "Inverse")
curve(make.plink("rplogit")$linkinv(x, 1), add = TRUE, col = 2)
curve(make.plink("rplogit")$linkinv(x, 3), add = TRUE, col = 3)
curve(make.plink("rplogit")$linkinv(x, 6), add = TRUE, col = 4)
legend("bottomright", legend = c(expression(lambda == 0.5),
                                 expression(lambda == 1),
                                 expression(lambda == 3),
                                 expression(lambda == 6)),
       lty = 1, col = c(1,2,3,4), bty = "n")


rdmatheus/ugrpl documentation built on July 13, 2024, 10:24 p.m.