View source: R/mc_variance_function.R
| mc_variance_function | R Documentation |
Computes the variance function and its derivatives with respect to regression, dispersion, and power parameters. This function supports standard power variance functions as well as binomial responses. Intended primarily for internal use in model fitting.
mc_variance_function(
mu,
power,
Ntrial,
variance,
inverse,
derivative_power,
derivative_mu
)
mc_power(mu, power, inverse, derivative_power, derivative_mu)
mc_binomialP(mu, power, inverse, Ntrial,
derivative_power, derivative_mu)
mc_binomialPQ(mu, power, inverse, Ntrial,
derivative_power, derivative_mu)
mu |
Numeric vector of expected values. Typically obtained from
|
power |
Numeric value (for |
Ntrial |
Positive integer or numeric. Number of trials for binomial response variables. |
variance |
Character string specifying the variance function type:
|
inverse |
Logical. If |
derivative_power |
Logical. If |
derivative_mu |
Logical. If |
The function computes the variance function and its derivatives used in
the estimation of generalized linear models for multiple response variables.
For binomial responses, it accounts for the number of trials and supports
both single (binomialP) and double (binomialPQ) power specifications.
A named list containing one or more of the following elements, depending on the combination of logical arguments:
Square root of the variance function.
Inverse square root of the variance function.
Derivative of V_sqrt with respect to the power parameter.
Derivative of V_inv_sqrt with respect to the power parameter.
Derivative of V_sqrt with respect to mu.
Derivative of V_inv_sqrt with respect to mu.
Wagner Hugo Bonat
Bonat, W. H. and Jorgensen, B. (2016) Multivariate covariance generalized linear models. Journal of the Royal Statistical Society: Series C (Applied Statistics), 65:649–675.
mc_link_function
x1 <- seq(-1, 1, length.out = 5)
X <- model.matrix(~x1)
mu <- mc_link_function(beta = c(1, 0.5), X = X, offset = NULL, link = "logit")
mc_variance_function(mu = mu$mu, power = c(2, 1), Ntrial = 1,
variance = "binomialPQ", inverse = FALSE,
derivative_power = TRUE, derivative_mu = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.