View source: R/2_parametric_link_functions.R
make.plink | R Documentation |
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.
make.plink(link)
link |
character; see details to view the current available link functions. |
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
|
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:
Link function function(mu, lambda)
.
Inverse link function function(eta, lambda)
.
Derivative function(eta, lambda)
dmu/deta.
Second order derivative function(eta, lambda)
d2 mu/d eta2.
Derivative function(eta, lambda)
dmu/dlambda. If
the link function does not belongs to a parametric family, then it returns
NULL
.
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
.
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
.
logical; if TRUE
, the link function belongs to a parametric
family.
A name to be used for the link.
Rodrigo M. R. de Medeiros <rodrigo.matheus@live.com>
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.
### 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.