mean_kinship | R Documentation |
This function computes a particular weighted mean kinship that arises in the context of kinship and FST estimators and in the definition of the effective sample size. This function allows for weights to be zero or even negative, but they are internally normalized to sum to one.
mean_kinship(kinship, weights = NULL)
kinship |
The kinship matrix |
weights |
Weights for individuals (optional).
If |
The weighted mean kinship matrix, equivalent to drop( weights %*% kinship %*% weights )
after normalizing weights to sum to one.
# construct a dummy kinship matrix kinship <- matrix(c(0.5, 0, 0, 0.6), nrow=2) # this is the ordinary mean mean_kinship(kinship) # weighted mean with twice as much weight on the second individual # (weights are internally normalized to sum to one) weights <- c(1, 2) mean_kinship(kinship, weights)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.