View source: R/mt_link_function.R
mt_link_function | R Documentation |
The mt_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 \mu = g^{-1}(X\beta).
The
second element is the derivative of \mu
with respect to the
regression parameters \beta
.
It will be useful when computing the quasi-score function.
mt_link_function(beta, X, offset, link)
mt_logit(beta, X, offset)
mt_probit(beta, X, offset)
mt_cauchit(beta, X, offset)
mt_cloglog(beta, X, offset)
mt_loglog(beta, X, offset)
mt_identity(beta, X, offset)
mt_log(beta, X, offset)
mt_sqrt(beta, X, offset)
mt_invmu2(beta, X, offset)
mt_inverse(beta, X, offset)
beta |
a numeric vector of regression parameters. |
X |
a design matrix, see |
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 ( |
link |
a string specifying the name of the link function.
Options are: |
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 \beta
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\beta),
where g
is the link function and \eta
= X\beta
is the linear predictor. Let D
be a (n x p)
matrix whose entries are given by the derivatives of \mu
with respect to \beta
. Such a matrix will be required for the
fitting algorithm. The function mt_link_function
returns a
list where the first element is \mu
(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.
A list with two elements: mu and D (see Details).
Wagner Hugo Bonat, wbonat@ufpr.br
model.matrix
,
make.link
.
x1 <- seq(-1, 1, l = 5)
X <- model.matrix(~ x1)
mt_link_function(beta = c(1,0.5), X = X,
offset = NULL, link = 'log')
mt_link_function(beta = c(1,0.5), X = X,
offset = rep(10,5), link = 'identity')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.