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 \(\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.
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)
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 (\(\mu = g^{-1}(X\beta + offset)\)). If no offset is present in the model, set offset = NULL. |
link | a string specifying the name of the link function.
Options are: |
A list with two elements: mu and D (see 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 \(\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 mc_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.
x1 <- seq(-1, 1, l = 5) X <- model.matrix(~ x1) mc_link_function(beta = c(1,0.5), X = X, offset = NULL, link = 'log')#> $mu #> [1] 1.648721 2.117000 2.718282 3.490343 4.481689 #> #> $D #> (Intercept) x1 #> 1 1.648721 -1.648721 #> 2 2.117000 -1.058500 #> 3 2.718282 0.000000 #> 4 3.490343 1.745171 #> 5 4.481689 4.481689 #> attr(,"assign") #> [1] 0 1 #>#> $mu #> [1] 10.50 10.75 11.00 11.25 11.50 #> #> $D #> (Intercept) x1 #> 1 1 -1.0 #> 2 1 -0.5 #> 3 1 0.0 #> 4 1 0.5 #> 5 1 1.0 #> attr(,"assign") #> [1] 0 1 #>