Description Usage Arguments Value See Also Examples
Computes the covariance matrix of each group. The effect of sexual dimorphism can be removed by using, for each group, the average of the covariance matrix of males and the covariance matrix of females.
1 |
X |
a data matrix with variables in columns and group names as row names |
groups |
a character / factor vector containing grouping variable |
sex |
NULL (default). A character / factor vector containing sex variable, to remove sexual dimorphism by averaging males and females in each group |
use |
an optional character string giving a method for computing covariances in the presence of missing values. This must be (an abbreviation of) one of the strings "everything", "all.obs", "complete.obs", "na.or.complete", or "pairwise.complete.obs". |
A (p x p x m) array of covariance matrices, where p is the number of variables and m the number of groups.
1 2 3 4 5 6 7 8 9 10 11 | # Data matrix of 2D landmark coordinates
data("Tropheus.IK.coord")
coords <- which(names(Tropheus.IK.coord) == "X1"):which(names(Tropheus.IK.coord) == "Y19")
proc.coord <- as.matrix(Tropheus.IK.coord[coords])
# Covariance matrix of each population
S.phen.pop <- cov.group(proc.coord, groups = Tropheus.IK.coord$POP.ID)
# Covariance matrix of each population, pooled by sex
S.phen.pooled <- cov.group(proc.coord,
groups = Tropheus.IK.coord$POP.ID, sex = Tropheus.IK.coord$Sex)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.