mc_twin: Twin Model Covariance Structures

View source: R/mc_twin.R

mc_twinR Documentation

Twin Model Covariance Structures

Description

Constructs the components of the matrix linear predictor for twin data analysis under ACDE-type models. The function generates covariance structures suitable for monozygotic (MZ) and dizygotic (DZ) twins and supports several biologically motivated and flexible model parameterizations.

Usage

mc_twin(id, twin.id, type, replicate = NULL, structure, data)

mc_twin_bio(id, twin.id, type, replicate = NULL, structure, data)

mc_twin_full(id, twin.id, type, replicate, formula, data)

Arguments

id

A string indicating the name of the column in data that identifies the twin pair. The same identifier must be shared by both twins in a pair.

twin.id

A string indicating the name of the column in data that identifies the twin within each pair. Typically coded as 1 and 2.

type

A string indicating the name of the column in data that identifies the zygosity type. This variable must be a factor with exactly two levels: "mz" and "dz", where "mz" is taken as the reference level.

replicate

An optional string indicating the name of the column in data that identifies replicated observations within the same twin pair, such as time points in longitudinal twin studies. If provided, it is treated as a factor.

structure

A string specifying the covariance structure to be constructed. Available options are "full", "flex", "uns", "ACE", "ADE", "AE", "CE" and "E".

data

A data frame containing all variables referenced by the model.

formula

Internal argument used to define flexible and unstructured covariance models. Not intended for direct user specification.

Details

For biologically motivated structures ("ACE", "ADE", "AE", "CE", "E"), the function builds covariance matrices based on classical twin modeling assumptions. For flexible and unstructured options ("full", "flex", "uns"), the covariance structure is constructed using matrix linear predictors.

Value

A list of sparse matrices of class dgCMatrix, representing the components of the matrix linear predictor to be used in the matrix_pred argument of 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_dist, mc_car, mc_rw, mc_ns, mc_dglm, mc_mixed.


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