Last data update: 2014.03.03

R: Link Functions
mc_link_functionR Documentation

Link Functions

Description

The mc_link_function is a customized call of the make.link function.

Given the name of a link function, it returns a list with two elements. The first element is the inverse of the link function applied on the linear predictor μ = g^{-1}(Xβ). The second element is the derivative of μ with respect to the regression parameters β. It will be useful when computing the quasi-score function.

Usage

mc_link_function(beta, X, offset, link)

mc_logit(beta, X, offset)

mc_probit(beta, X, offset)

mc_cauchit(beta, X, offset)

mc_cloglog(beta, X, offset)

mc_loglog(beta, X, offset)

mc_identity(beta, X, offset)

mc_log(beta, X, offset)

mc_sqrt(beta, X, offset)

mc_invmu2(beta, X, offset)

mc_inverse(beta, X, offset)

Arguments

beta

a numeric vector of regression parameters.

X

a design matrix, see model.matrix for details.

offset

a numeric vector of offset values. It will be sum up on the linear predictor as a covariate with known regression parameter equals one (μ = g^{-1}(Xβ + offset)). If no offset is present in the model, set offset = NULL.

link

a string specifying the name of the link function. Options are: "logit", "probit", "cauchit", "cloglog", "loglog", "identity", "log", "sqrt", "1/mu^2" and inverse. A user defined link function can be used (see Details).

Details

The link function is an important component of the multivariate covariance generalized linear models, since it links the expectation of the response variable with the covariates. Let β be a (p x 1) regression parameter vector and X be an (n x p) design matrix. The expected value of the response variable Y is given by

E(Y) = g^{-1}(Xβ),

where g is the link function and η = Xβ is the linear predictor. Let D be a (n x p) matrix whose entries are given by the derivatives of μ with respect to β. Such a matrix will be required for the fitting algorithm. The function mc_link_function returns a list where the first element is μ (n x 1) vector and the second is the D (n x p) matrix. A user defined function can also be used. It must be a function with arguments beta, X and offset (set to NULL if non needed). The function must return a length 2 named list with mu and D elements as a vector and a matrix of proper dimensions.

Value

A list with two elements: mu and D (see Details).

Author(s)

Wagner Hugo Bonat, wbonat@ufpr.br

See Also

model.matrix, make.link.

Examples

x1 <- seq(-1, 1, l = 5)
X <- model.matrix(~ x1)
mc_link_function(beta = c(1,0.5), X = X,
                 offset = NULL, link = 'log')
mc_link_function(beta = c(1,0.5), X = X,
                 offset = rep(10,5), link = 'identity')

Results