Learn R Programming

MESS (version 0.5.12)

common.shared: Compute a common shared environment matrix

Description

Compute the common shared environment matrix for a set of related subjects. The function is generic, and can accept a pedigree, or pedigreeList as the first argument.

Usage

common.shared(id, ...)

# S3 method for pedigreeList common.shared(id, ...)

# S3 method for pedigree common.shared(id, ...)

Value

a matrix of shared environment coefficients

Arguments

id

either a pedigree object or pedigreeList object

...

Any number of optional arguments. Not used at the moment

Author

Claus Ekstrom claus@rprimer.dk

Details

When called with a pedigreeList, i.e., with multiple families, the routine will create a block-diagonal-symmetric `bdsmatrix' object. Since the [i,j] value of the result is 0 for any two unrelated individuals i and j and a `bdsmatix' utilizes sparse representation, the resulting object is often orders of magnitude smaller than an ordinary matrix. When called with a single pedigree and ordinary matrix is returned.

See Also

pedigree, kinship,

Examples

Run this code

library(kinship2)
test1 <- data.frame(id  =c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14),
                    mom =c(0, 0, 0, 0, 2, 2, 4, 4, 6,  2,  0,  0, 12, 13),
                    dad =c(0, 0, 0, 0, 1, 1, 3, 3, 3,  7,  0,  0, 11, 10),
                    sex =c(1, 2, 1, 2, 1, 2, 1, 2, 1,  1,  1,  2,  2,  2))
tped <- with(test1, pedigree(id, dad, mom, sex))
common.shared(tped)

Run the code above in your browser using DataLab