mc_ns: Non-structured Covariance Model

View source: R/mc_ns.R

mc_nsR Documentation

Non-structured Covariance Model

Description

Constructs the components of the matrix linear predictor associated with a fully non-structured covariance model in multivariate covariance generalized linear models. This specification allows each pair of observations within a unit to have its own covariance parameter, resulting in a highly flexible but parameter-intensive model.

Due to the quadratic growth in the number of parameters, this structure is typically suitable only for datasets with a small number of repeated measurements per unit.

Usage

mc_ns(id, data, group = NULL, marca = NULL)

Arguments

id

A character string giving the name of the column in data that identifies the observational units (e.g., subjects). Each unit must have the same number of observations. For time series or spatial data without replication, the same identifier should be used for all observations.

data

A data.frame containing the variables referenced by id and, optionally, group.

group

An optional character string giving the name of a column in data that defines groups for which different covariance structures may be specified. If NULL, a single non-structured covariance model is used for all units.

marca

An optional character string specifying the level of group for which the non-structured covariance components are excluded (i.e., set to zero). This allows selective activation of the non-structured covariance according to group membership.

Details

The function requires a balanced design, meaning that all units identified by id must have the same number of observations. An error is raised otherwise. When group and marca are provided, covariance components are generated only for units not belonging to the specified level marca; for those units, the corresponding blocks are set to zero.

Value

A list of symmetric block-diagonal matrices, each representing one covariance component of the non-structured matrix linear predictor. The length of the list is equal to n(n - 1) / 2, where n is the number of observations per unit. Each element of the list is a sparse matrix of class "dgCMatrix" obtained by stacking unit- specific covariance blocks along the diagonal. These matrices are used internally to construct the dispersion linear predictor in mcglm.

Author(s)

Wagner Hugo Bonat, wbonat@ufpr.br

Source

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

See Also

mc_id, mc_dglm, mc_dist, mc_ma, mc_rw, mc_mixed


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