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.

extended.shared(id, rho = 1, theta = 1, ...)

# S3 method for pedigreeList
extended.shared(id, rho = 1, theta = 1, ...)

# S3 method for pedigree
extended.shared(id, rho = 1, theta = 1, ...)

Arguments

id

either a pedigree object or pedigreeList object

rho

The correlation between spouses

theta

The partial path coefficient from parents to offspring

Any number of optional arguments. Not used at the moment

Value

a matrix of shared environment coefficients

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

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, 0, 2, 2, 4, 0, 6, 8, 0, 10, 11), dad =c(0, 0, 0, 0, 0, 1, 1, 3, 0, 5, 7, 0, 9, 12), sex =c(1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2)) tped <- with(test1, pedigree(id, dad, mom, sex)) extended.shared(tped)
#> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #> 1 1.00 1.00 0.00 0.00 0.00 1.00 1.00 0.00 0.0 0.500 0.500 0.0 0.2500 0.2500 #> 2 1.00 1.00 0.00 0.00 0.00 1.00 1.00 0.00 0.0 0.500 0.500 0.0 0.2500 0.2500 #> 3 0.00 0.00 1.00 1.00 0.00 0.00 0.00 1.00 0.0 0.000 0.500 0.0 0.0000 0.2500 #> 4 0.00 0.00 1.00 1.00 0.00 0.00 0.00 1.00 0.0 0.000 0.500 0.0 0.0000 0.2500 #> 5 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.0 0.500 0.000 0.0 0.2500 0.0000 #> 6 1.00 1.00 0.00 0.00 0.00 1.00 1.00 0.00 0.0 0.500 0.500 0.0 0.2500 0.2500 #> 7 1.00 1.00 0.00 0.00 0.00 1.00 1.00 0.00 0.0 0.500 0.500 0.0 0.2500 0.2500 #> 8 0.00 0.00 1.00 1.00 0.00 0.00 0.00 1.00 0.0 0.000 0.500 0.0 0.0000 0.2500 #> 9 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.0 0.000 0.000 0.0 0.5000 0.0000 #> 10 0.50 0.50 0.00 0.00 0.50 0.50 0.50 0.00 0.0 0.500 0.250 0.0 0.2500 0.1250 #> 11 0.50 0.50 0.50 0.50 0.00 0.50 0.50 0.50 0.0 0.250 0.500 0.0 0.1250 0.2500 #> 12 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.0 0.000 0.000 1.0 0.0000 0.5000 #> 13 0.25 0.25 0.00 0.00 0.25 0.25 0.25 0.00 0.5 0.250 0.125 0.0 0.3750 0.0625 #> 14 0.25 0.25 0.25 0.25 0.00 0.25 0.25 0.25 0.0 0.125 0.250 0.5 0.0625 0.3750