cov.B: Between-group covariance matrix

Description Usage Arguments Value See Also Examples

Description

Computes the between-group covariance matrix. The effect of sexual dimorphism can be removed by using, for each group, the average of the mean of males and the mean of females.

Usage

1
cov.B(X, groups, sex = NULL, center = FALSE, weighted = FALSE)

Arguments

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

center

either a logical value or a numeric vector of length equal to the number of columns of X

weighted

logical. Should the between-group covariance matrix be weighted?

Value

The between-group covariance matrix

See Also

cov, cov.wt

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 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])

# Between-group covariance matrix for all populations
B <- cov.B(proc.coord, groups = Tropheus.IK.coord$POP.ID)

# Between-group covariance matrix for all populations, pooled by sex
B.mf <- cov.B(proc.coord, groups = Tropheus.IK.coord$POP.ID, sex = Tropheus.IK.coord$Sex)

vcvComp documentation built on Dec. 17, 2020, 9:07 a.m.