mcglm: Fitting Multivariate Covariance Generalized Linear Models

View source: R/mc_main_function.R

mcglmR Documentation

Fitting Multivariate Covariance Generalized Linear Models

Description

Fits multivariate covariance generalized linear models. Models are specified through lists defining the linear predictors and matrix linear predictors. The user can choose among different link, variance, and covariance functions. Model fitting is based on an estimating function approach, combining quasi-score functions for regression parameters and Pearson estimating functions for covariance parameters.

Usage

mcglm(linear_pred, matrix_pred, link, variance, covariance,
       offset, Ntrial, power_fixed, data, control_initial,
       contrasts, weights, control_algorithm)

Arguments

linear_pred

A list of model formulas, one for each response. See formula for details.

matrix_pred

A list of known matrices defining the matrix linear predictor for the covariance structure. See mc_matrix_linear_predictor for details.

link

A list of link function names, one for each response. Possible values are "logit", "probit", "cauchit", "cloglog", "loglog", "identity", "log", "sqrt", "1/mu^2", and "inverse".

variance

A list of variance function names. Possible values are "constant", "tweedie", "poisson_tweedie", "binomialP", and "binomialPQ".

covariance

A list of covariance link function names. Possible values are "identity", "inverse", and "expm".

offset

A list of numeric vectors specifying offsets for each response. Use NULL if no offset is required.

Ntrial

A list of numeric vectors specifying the number of trials for binomial responses. Only used for binomialP and binomialPQ variance functions.

power_fixed

A list of logical values indicating whether the power parameter should be fixed (TRUE) or estimated (FALSE).

data

a data frame.

control_initial

A list of initial values for the fitting algorithm. If set to "automatic", initial values are generated internally using mc_initial_values.

contrasts

An optional list of contrasts passed to model.matrix.

weights

A list of numeric vectors of observation weights. Each element must have length equal to the number of observations. Missing observations should be coded as NA.

control_algorithm

A list of control parameters passed to the fitting algorithm. See fit_mcglm for details.

Value

An object of class "mcglm" representing a fitted multivariate covariance generalized linear model.

The returned object is a list produced by the fitting routine fit_mcglm, augmented with additional components used by post–estimation methods. The main components include:

beta_names

A list of character vectors giving the names of the regression coefficients for each response variable.

power_fixed

A list of logical values indicating whether the power parameters were fixed or estimated.

list_initial

A list of initial values used in the fitting algorithm.

n_obs

An integer giving the number of observations.

link

A list of link functions used in the model.

variance

A list of variance functions used in the model.

covariance

A list of covariance link functions used in the model.

linear_pred

A list of formulas defining the linear predictors.

matrix_pred

A list of matrices defining the matrix linear predictors.

list_X

A list of design matrices corresponding to the linear predictors.

observed

A matrix of observed response values, with rows corresponding to observations and columns to response variables.

Ntrial

A list containing the number of trials for each response variable, when applicable.

offset

A list of offset vectors used in the model.

sparse

A list of logical values indicating whether each matrix linear predictor is treated as sparse.

weights

A numeric vector of weights used in the fitting process.

data

The data frame used to fit the model.

con

A list of control parameters used by the fitting algorithm.

Additional components may be present for internal use by methods such as print, summary and predict.

Author(s)

Wagner Hugo Bonat, wbonat@ufpr.br

Source

Bonat, W. H. and Jorgensen, B. (2016) Multivariate covariance generalized linear models. Journal of Royal Statistical Society - Series C 65:649–675.

Bonat, W. H. (2018). Multiple Response Variables Regression Models in R: The mcglm Package. Journal of Statistical Software, 84(4):1–30.

See Also

fit_mcglm, mc_link_function and mc_variance_function.


mcglm documentation built on Jan. 9, 2026, 1:07 a.m.