The function mc_twin helps to build the components of the matrix linear predictor associated with ACDE models for analysis of twin data.

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

name of the column (string) containing the twin index. It should be the same index (number) for both twins.

twin.id

name of the column (string) containing the twin index inside the pair. In general 1 for the first twin and 2 for the second twin.

type

name of the column (string) containing the indication of the twin as mz or dz. It should be a factor with only two levels mz and dz. Be sure that the reference level is mz.

replicate

name of the column (string) containing the index for more than one observation taken at the same twin pair. It is used for example in twin longitudinal studies. In that case, the replication column should contain the time index.

structure

model type options are full, flex, uns, ACE, ADE, AE, CE and E. See example for details.

data

data set.

formula

internal.

Source

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

Value

A list of matrices of dgCMatrix class.

See also

mc_id, mc_dist, mc_car, mc_rw, mc_ns, mc_dglm and mc_mixed.

Examples

id <- rep(1:5, each = 4) id.twin <- rep(1:2, 10)